From c9c59dc34323a5e0b1886db5f845c8d41620826e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 12:44:47 -0400 Subject: Reorganize constants/ To do: add comments associating constants with data and code --- macros/data_macros.asm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'macros') diff --git a/macros/data_macros.asm b/macros/data_macros.asm index ee5cb8f0..371247d3 100755 --- a/macros/data_macros.asm +++ b/macros/data_macros.asm @@ -1,7 +1,11 @@ ; Constant enumeration is useful for monsters, items, moves, etc. const_def: MACRO +if _NARG >= 1 +const_value = \1 +else const_value = 0 +endc ENDM const: MACRO -- cgit v1.3.1-sl0p From 710c3275fc6a4caeeff3ad89c029a05984cf8388 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 15:25:43 -0400 Subject: Simplify map connections To do: Polished Map support for detecting the tileset --- data/mapHeaders/AgathasRoom.asm | 11 +- data/mapHeaders/BikeShop.asm | 11 +- data/mapHeaders/BillsHouse.asm | 11 +- data/mapHeaders/BluesHouse.asm | 11 +- data/mapHeaders/BrunosRoom.asm | 11 +- data/mapHeaders/CeladonChiefHouse.asm | 11 +- data/mapHeaders/CeladonCity.asm | 15 +-- data/mapHeaders/CeladonDiner.asm | 11 +- data/mapHeaders/CeladonGym.asm | 11 +- data/mapHeaders/CeladonHotel.asm | 11 +- data/mapHeaders/CeladonMansion1F.asm | 11 +- data/mapHeaders/CeladonMansion2F.asm | 11 +- data/mapHeaders/CeladonMansion3F.asm | 11 +- data/mapHeaders/CeladonMansionRoof.asm | 11 +- data/mapHeaders/CeladonMansionRoofHouse.asm | 11 +- data/mapHeaders/CeladonMart1F.asm | 11 +- data/mapHeaders/CeladonMart2F.asm | 11 +- data/mapHeaders/CeladonMart3F.asm | 11 +- data/mapHeaders/CeladonMart4F.asm | 11 +- data/mapHeaders/CeladonMart5F.asm | 11 +- data/mapHeaders/CeladonMartElevator.asm | 11 +- data/mapHeaders/CeladonMartRoof.asm | 11 +- data/mapHeaders/CeladonPokecenter.asm | 11 +- data/mapHeaders/CeruleanBadgeHouse.asm | 11 +- data/mapHeaders/CeruleanCave1F.asm | 11 +- data/mapHeaders/CeruleanCave2F.asm | 11 +- data/mapHeaders/CeruleanCaveB1F.asm | 11 +- data/mapHeaders/CeruleanCity.asm | 19 +-- data/mapHeaders/CeruleanGym.asm | 11 +- data/mapHeaders/CeruleanMart.asm | 11 +- data/mapHeaders/CeruleanPokecenter.asm | 11 +- data/mapHeaders/CeruleanTradeHouse.asm | 11 +- data/mapHeaders/CeruleanTrashedHouse.asm | 11 +- data/mapHeaders/ChampionsRoom.asm | 11 +- data/mapHeaders/CinnabarGym.asm | 11 +- data/mapHeaders/CinnabarIsland.asm | 15 +-- data/mapHeaders/CinnabarLab.asm | 11 +- data/mapHeaders/CinnabarLabFossilRoom.asm | 11 +- data/mapHeaders/CinnabarLabMetronomeRoom.asm | 11 +- data/mapHeaders/CinnabarLabTradeRoom.asm | 11 +- data/mapHeaders/CinnabarMart.asm | 11 +- data/mapHeaders/CinnabarPokecenter.asm | 11 +- data/mapHeaders/Colosseum.asm | 11 +- data/mapHeaders/CopycatsHouse1F.asm | 11 +- data/mapHeaders/CopycatsHouse2F.asm | 11 +- data/mapHeaders/Daycare.asm | 11 +- data/mapHeaders/DiglettsCave.asm | 11 +- data/mapHeaders/DiglettsCaveRoute11.asm | 11 +- data/mapHeaders/DiglettsCaveRoute2.asm | 11 +- data/mapHeaders/FightingDojo.asm | 11 +- data/mapHeaders/FuchsiaBillsGrandpasHouse.asm | 11 +- data/mapHeaders/FuchsiaCity.asm | 17 +-- data/mapHeaders/FuchsiaGoodRodHouse.asm | 11 +- data/mapHeaders/FuchsiaGym.asm | 11 +- data/mapHeaders/FuchsiaMart.asm | 11 +- data/mapHeaders/FuchsiaMeetingRoom.asm | 11 +- data/mapHeaders/FuchsiaPokecenter.asm | 11 +- data/mapHeaders/GameCorner.asm | 11 +- data/mapHeaders/GameCornerPrizeRoom.asm | 11 +- data/mapHeaders/HallOfFame.asm | 11 +- data/mapHeaders/IndigoPlateau.asm | 13 +- data/mapHeaders/IndigoPlateauLobby.asm | 11 +- data/mapHeaders/LancesRoom.asm | 11 +- data/mapHeaders/LavenderCuboneHouse.asm | 11 +- data/mapHeaders/LavenderMart.asm | 11 +- data/mapHeaders/LavenderPokecenter.asm | 11 +- data/mapHeaders/LavenderTown.asm | 17 +-- data/mapHeaders/LoreleisRoom.asm | 11 +- data/mapHeaders/MrFujisHouse.asm | 11 +- data/mapHeaders/MrPsychicsHouse.asm | 11 +- data/mapHeaders/MtMoon1F.asm | 11 +- data/mapHeaders/MtMoonB1F.asm | 11 +- data/mapHeaders/MtMoonB2F.asm | 11 +- data/mapHeaders/MtMoonPokecenter.asm | 11 +- data/mapHeaders/Museum1F.asm | 11 +- data/mapHeaders/Museum2F.asm | 11 +- data/mapHeaders/NameRatersHouse.asm | 11 +- data/mapHeaders/OaksLab.asm | 11 +- data/mapHeaders/PalletTown.asm | 15 +-- data/mapHeaders/PewterCity.asm | 15 +-- data/mapHeaders/PewterGym.asm | 11 +- data/mapHeaders/PewterMart.asm | 11 +- data/mapHeaders/PewterNidoranHouse.asm | 11 +- data/mapHeaders/PewterPokecenter.asm | 11 +- data/mapHeaders/PewterSpeechHouse.asm | 11 +- data/mapHeaders/PokemonFanClub.asm | 11 +- data/mapHeaders/PokemonMansion1F.asm | 11 +- data/mapHeaders/PokemonMansion2F.asm | 11 +- data/mapHeaders/PokemonMansion3F.asm | 11 +- data/mapHeaders/PokemonMansionB1F.asm | 11 +- data/mapHeaders/PokemonTower1F.asm | 11 +- data/mapHeaders/PokemonTower2F.asm | 11 +- data/mapHeaders/PokemonTower3F.asm | 11 +- data/mapHeaders/PokemonTower4F.asm | 11 +- data/mapHeaders/PokemonTower5F.asm | 11 +- data/mapHeaders/PokemonTower6F.asm | 11 +- data/mapHeaders/PokemonTower7F.asm | 11 +- data/mapHeaders/PowerPlant.asm | 11 +- data/mapHeaders/RedsHouse1F.asm | 11 +- data/mapHeaders/RedsHouse2F.asm | 11 +- data/mapHeaders/RockTunnel1F.asm | 11 +- data/mapHeaders/RockTunnelB1F.asm | 11 +- data/mapHeaders/RockTunnelPokecenter.asm | 11 +- data/mapHeaders/RocketHideoutB1F.asm | 11 +- data/mapHeaders/RocketHideoutB2F.asm | 11 +- data/mapHeaders/RocketHideoutB3F.asm | 11 +- data/mapHeaders/RocketHideoutB4F.asm | 11 +- data/mapHeaders/RocketHideoutElevator.asm | 11 +- data/mapHeaders/Route1.asm | 15 +-- data/mapHeaders/Route10.asm | 15 +-- data/mapHeaders/Route11.asm | 15 +-- data/mapHeaders/Route11Gate1F.asm | 11 +- data/mapHeaders/Route11Gate2F.asm | 11 +- data/mapHeaders/Route12.asm | 17 +-- data/mapHeaders/Route12Gate1F.asm | 11 +- data/mapHeaders/Route12Gate2F.asm | 11 +- data/mapHeaders/Route12SuperRodHouse.asm | 11 +- data/mapHeaders/Route13.asm | 15 +-- data/mapHeaders/Route14.asm | 15 +-- data/mapHeaders/Route15.asm | 15 +-- data/mapHeaders/Route15Gate1F.asm | 11 +- data/mapHeaders/Route15Gate2F.asm | 11 +- data/mapHeaders/Route16.asm | 15 +-- data/mapHeaders/Route16FlyHouse.asm | 11 +- data/mapHeaders/Route16Gate1F.asm | 11 +- data/mapHeaders/Route16Gate2F.asm | 11 +- data/mapHeaders/Route17.asm | 15 +-- data/mapHeaders/Route18.asm | 15 +-- data/mapHeaders/Route18Gate1F.asm | 11 +- data/mapHeaders/Route18Gate2F.asm | 11 +- data/mapHeaders/Route19.asm | 15 +-- data/mapHeaders/Route2.asm | 15 +-- data/mapHeaders/Route20.asm | 15 +-- data/mapHeaders/Route21.asm | 15 +-- data/mapHeaders/Route22.asm | 15 +-- data/mapHeaders/Route22Gate.asm | 11 +- data/mapHeaders/Route23.asm | 15 +-- data/mapHeaders/Route24.asm | 15 +-- data/mapHeaders/Route25.asm | 13 +- data/mapHeaders/Route2Gate.asm | 11 +- data/mapHeaders/Route2TradeHouse.asm | 11 +- data/mapHeaders/Route3.asm | 15 +-- data/mapHeaders/Route4.asm | 15 +-- data/mapHeaders/Route5.asm | 15 +-- data/mapHeaders/Route5Gate.asm | 11 +- data/mapHeaders/Route6.asm | 15 +-- data/mapHeaders/Route6Gate.asm | 11 +- data/mapHeaders/Route7.asm | 15 +-- data/mapHeaders/Route7Gate.asm | 11 +- data/mapHeaders/Route8.asm | 15 +-- data/mapHeaders/Route8Gate.asm | 11 +- data/mapHeaders/Route9.asm | 15 +-- data/mapHeaders/SSAnne1F.asm | 11 +- data/mapHeaders/SSAnne1FRooms.asm | 11 +- data/mapHeaders/SSAnne2F.asm | 11 +- data/mapHeaders/SSAnne2FRooms.asm | 11 +- data/mapHeaders/SSAnne3F.asm | 11 +- data/mapHeaders/SSAnneB1F.asm | 11 +- data/mapHeaders/SSAnneB1FRooms.asm | 11 +- data/mapHeaders/SSAnneBow.asm | 11 +- data/mapHeaders/SSAnneCaptainsRoom.asm | 11 +- data/mapHeaders/SSAnneKitchen.asm | 11 +- data/mapHeaders/SafariZoneCenter.asm | 11 +- data/mapHeaders/SafariZoneCenterRestHouse.asm | 11 +- data/mapHeaders/SafariZoneEast.asm | 11 +- data/mapHeaders/SafariZoneEastRestHouse.asm | 11 +- data/mapHeaders/SafariZoneGate.asm | 11 +- data/mapHeaders/SafariZoneNorth.asm | 11 +- data/mapHeaders/SafariZoneNorthRestHouse.asm | 11 +- data/mapHeaders/SafariZoneSecretHouse.asm | 11 +- data/mapHeaders/SafariZoneWest.asm | 11 +- data/mapHeaders/SafariZoneWestRestHouse.asm | 11 +- data/mapHeaders/SaffronCity.asm | 19 +-- data/mapHeaders/SaffronGym.asm | 11 +- data/mapHeaders/SaffronMart.asm | 11 +- data/mapHeaders/SaffronPidgeyHouse.asm | 11 +- data/mapHeaders/SaffronPokecenter.asm | 11 +- data/mapHeaders/SeafoamIslands1F.asm | 11 +- data/mapHeaders/SeafoamIslandsB1F.asm | 11 +- data/mapHeaders/SeafoamIslandsB2F.asm | 11 +- data/mapHeaders/SeafoamIslandsB3F.asm | 11 +- data/mapHeaders/SeafoamIslandsB4F.asm | 11 +- data/mapHeaders/SilphCo10F.asm | 11 +- data/mapHeaders/SilphCo11F.asm | 11 +- data/mapHeaders/SilphCo1F.asm | 11 +- data/mapHeaders/SilphCo2F.asm | 11 +- data/mapHeaders/SilphCo3F.asm | 11 +- data/mapHeaders/SilphCo4F.asm | 11 +- data/mapHeaders/SilphCo5F.asm | 11 +- data/mapHeaders/SilphCo6F.asm | 11 +- data/mapHeaders/SilphCo7F.asm | 11 +- data/mapHeaders/SilphCo8F.asm | 11 +- data/mapHeaders/SilphCo9F.asm | 11 +- data/mapHeaders/SilphCoElevator.asm | 11 +- data/mapHeaders/TradeCenter.asm | 11 +- data/mapHeaders/UndergroundPathNorthSouth.asm | 11 +- data/mapHeaders/UndergroundPathRoute5.asm | 11 +- data/mapHeaders/UndergroundPathRoute6.asm | 11 +- data/mapHeaders/UndergroundPathRoute7.asm | 11 +- data/mapHeaders/UndergroundPathRoute7Copy.asm | 11 +- data/mapHeaders/UndergroundPathRoute8.asm | 11 +- data/mapHeaders/UndergroundPathWestEast.asm | 11 +- data/mapHeaders/VermilionCity.asm | 15 +-- data/mapHeaders/VermilionDock.asm | 11 +- data/mapHeaders/VermilionGym.asm | 11 +- data/mapHeaders/VermilionMart.asm | 11 +- data/mapHeaders/VermilionOldRodHouse.asm | 11 +- data/mapHeaders/VermilionPidgeyHouse.asm | 11 +- data/mapHeaders/VermilionPokecenter.asm | 11 +- data/mapHeaders/VermilionTradeHouse.asm | 11 +- data/mapHeaders/VictoryRoad1F.asm | 11 +- data/mapHeaders/VictoryRoad2F.asm | 11 +- data/mapHeaders/VictoryRoad3F.asm | 11 +- data/mapHeaders/ViridianCity.asm | 17 +-- data/mapHeaders/ViridianForest.asm | 11 +- data/mapHeaders/ViridianForestNorthGate.asm | 11 +- data/mapHeaders/ViridianForestSouthGate.asm | 11 +- data/mapHeaders/ViridianGym.asm | 11 +- data/mapHeaders/ViridianMart.asm | 11 +- data/mapHeaders/ViridianNicknameHouse.asm | 11 +- data/mapHeaders/ViridianPokecenter.asm | 11 +- data/mapHeaders/ViridianSchoolHouse.asm | 11 +- data/mapHeaders/WardensHouse.asm | 11 +- macros/data_macros.asm | 183 +++++++++++++------------- 224 files changed, 842 insertions(+), 1950 deletions(-) (limited to 'macros') diff --git a/data/mapHeaders/AgathasRoom.asm b/data/mapHeaders/AgathasRoom.asm index 6e31225c..d04e0cfd 100755 --- a/data/mapHeaders/AgathasRoom.asm +++ b/data/mapHeaders/AgathasRoom.asm @@ -1,8 +1,3 @@ -AgathasRoom_h:: - db CEMETERY ; tileset - db AGATHAS_ROOM_HEIGHT, AGATHAS_ROOM_WIDTH ; dimensions (y, x) - dw AgathasRoom_Blocks ; blocks - dw AgathasRoom_TextPointers ; texts - dw AgathasRoom_Script ; scripts - db 0 ; connections - dw AgathasRoom_Object ; objects + + map_header AgathasRoom, AGATHAS_ROOM, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/BikeShop.asm b/data/mapHeaders/BikeShop.asm index ea6f8d60..b4b520e2 100755 --- a/data/mapHeaders/BikeShop.asm +++ b/data/mapHeaders/BikeShop.asm @@ -1,8 +1,3 @@ -BikeShop_h:: - db CLUB ; tileset - db BIKE_SHOP_HEIGHT, BIKE_SHOP_WIDTH ; dimensions (y, x) - dw BikeShop_Blocks ; blocks - dw BikeShop_TextPointers ; texts - dw BikeShop_Script ; scripts - db 0 ; connections - dw BikeShop_Object ; objects + + map_header BikeShop, BIKE_SHOP, CLUB, 0 + end_map_header diff --git a/data/mapHeaders/BillsHouse.asm b/data/mapHeaders/BillsHouse.asm index e58cbd5b..6063175d 100755 --- a/data/mapHeaders/BillsHouse.asm +++ b/data/mapHeaders/BillsHouse.asm @@ -1,8 +1,3 @@ -BillsHouse_h:: - db INTERIOR ; tileset - db BILLS_HOUSE_HEIGHT, BILLS_HOUSE_WIDTH ; dimensions (y, x) - dw BillsHouse_Blocks ; blocks - dw BillsHouse_TextPointers ; texts - dw BillsHouse_Script ; scripts - db 0 ; connections - dw BillsHouse_Object ; objects + + map_header BillsHouse, BILLS_HOUSE, INTERIOR, 0 + end_map_header diff --git a/data/mapHeaders/BluesHouse.asm b/data/mapHeaders/BluesHouse.asm index bc9ed3de..33cee254 100755 --- a/data/mapHeaders/BluesHouse.asm +++ b/data/mapHeaders/BluesHouse.asm @@ -1,8 +1,3 @@ -BluesHouse_h:: - db HOUSE ; tileset - db BLUES_HOUSE_HEIGHT, BLUES_HOUSE_WIDTH ; dimensions (y, x) - dw BluesHouse_Blocks ; blocks - dw BluesHouse_TextPointers ; texts - dw BluesHouse_Script ; scripts - db 0 ; connections - dw BluesHouse_Object ; objects + + map_header BluesHouse, BLUES_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/BrunosRoom.asm b/data/mapHeaders/BrunosRoom.asm index 03398603..a0b2d4fd 100755 --- a/data/mapHeaders/BrunosRoom.asm +++ b/data/mapHeaders/BrunosRoom.asm @@ -1,8 +1,3 @@ -BrunosRoom_h:: - db GYM ; tileset - db BRUNOS_ROOM_HEIGHT, BRUNOS_ROOM_WIDTH ; dimensions (y, x) - dw BrunosRoom_Blocks ; blocks - dw BrunosRoom_TextPointers ; texts - dw BrunosRoom_Script ; scripts - db 0 ; connections - dw BrunosRoom_Object ; objects + + map_header BrunosRoom, BRUNOS_ROOM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/CeladonChiefHouse.asm b/data/mapHeaders/CeladonChiefHouse.asm index e29f722f..34f17273 100755 --- a/data/mapHeaders/CeladonChiefHouse.asm +++ b/data/mapHeaders/CeladonChiefHouse.asm @@ -1,8 +1,3 @@ -CeladonChiefHouse_h:: - db MANSION ; tileset - db CELADON_CHIEF_HOUSE_HEIGHT, CELADON_CHIEF_HOUSE_WIDTH ; dimensions (y, x) - dw CeladonChiefHouse_Blocks ; blocks - dw CeladonChiefHouse_TextPointers ; texts - dw CeladonChiefHouse_Script ; scripts - db 0 ; connections - dw CeladonChiefHouse_Object ; objects + + map_header CeladonChiefHouse, CELADON_CHIEF_HOUSE, MANSION, 0 + end_map_header diff --git a/data/mapHeaders/CeladonCity.asm b/data/mapHeaders/CeladonCity.asm index f2ce1831..6faa6f48 100755 --- a/data/mapHeaders/CeladonCity.asm +++ b/data/mapHeaders/CeladonCity.asm @@ -1,10 +1,5 @@ -CeladonCity_h:: - db OVERWORLD ; tileset - db CELADON_CITY_HEIGHT, CELADON_CITY_WIDTH ; dimensions (y, x) - dw CeladonCity_Blocks ; blocks - dw CeladonCity_TextPointers ; texts - dw CeladonCity_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION CELADON_CITY, ROUTE_16, 4, 0, Route16_Blocks - EAST_MAP_CONNECTION CELADON_CITY, ROUTE_7, 4, 0, Route7_Blocks, 1 - dw CeladonCity_Object ; objects + + map_header CeladonCity, CELADON_CITY, OVERWORLD, WEST | EAST + connection west, Route16, ROUTE_16, 4 + connection east, Route7, ROUTE_7, 4 + end_map_header diff --git a/data/mapHeaders/CeladonDiner.asm b/data/mapHeaders/CeladonDiner.asm index 14501d83..b18d9633 100755 --- a/data/mapHeaders/CeladonDiner.asm +++ b/data/mapHeaders/CeladonDiner.asm @@ -1,8 +1,3 @@ -CeladonDiner_h:: - db LOBBY ; tileset - db CELADON_DINER_HEIGHT, CELADON_DINER_WIDTH ; dimensions (y, x) - dw CeladonDiner_Blocks ; blocks - dw CeladonDiner_TextPointers ; texts - dw CeladonDiner_Script ; scripts - db 0 ; connections - dw CeladonDiner_Object ; objects + + map_header CeladonDiner, CELADON_DINER, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonGym.asm b/data/mapHeaders/CeladonGym.asm index b64c5e19..2302c65a 100755 --- a/data/mapHeaders/CeladonGym.asm +++ b/data/mapHeaders/CeladonGym.asm @@ -1,8 +1,3 @@ -CeladonGym_h:: - db GYM ; tileset - db CELADON_GYM_HEIGHT, CELADON_GYM_WIDTH ; dimensions (y, x) - dw CeladonGym_Blocks ; blocks - dw CeladonGym_TextPointers ; texts - dw CeladonGym_Script ; scripts - db 0 ; connections - dw CeladonGym_Object ; objects + + map_header CeladonGym, CELADON_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/CeladonHotel.asm b/data/mapHeaders/CeladonHotel.asm index ecc943c2..2339c14d 100755 --- a/data/mapHeaders/CeladonHotel.asm +++ b/data/mapHeaders/CeladonHotel.asm @@ -1,8 +1,3 @@ -CeladonHotel_h:: - db POKECENTER ; tileset - db CELADON_HOTEL_HEIGHT, CELADON_HOTEL_WIDTH ; dimensions (y, x) - dw CeladonHotel_Blocks ; blocks - dw CeladonHotel_TextPointers ; texts - dw CeladonHotel_Script ; scripts - db 0 ; connections - dw CeladonHotel_Object ; objects + + map_header CeladonHotel, CELADON_HOTEL, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMansion1F.asm b/data/mapHeaders/CeladonMansion1F.asm index b13f76a7..45970028 100755 --- a/data/mapHeaders/CeladonMansion1F.asm +++ b/data/mapHeaders/CeladonMansion1F.asm @@ -1,8 +1,3 @@ -CeladonMansion1F_h:: - db MANSION ; tileset - db CELADON_MANSION_1F_HEIGHT, CELADON_MANSION_1F_WIDTH ; dimensions (y, x) - dw CeladonMansion1F_Blocks ; blocks - dw CeladonMansion1F_TextPointers ; texts - dw CeladonMansion1F_Script ; scripts - db 0 ; connections - dw CeladonMansion1F_Object ; objects + + map_header CeladonMansion1F, CELADON_MANSION_1F, MANSION, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMansion2F.asm b/data/mapHeaders/CeladonMansion2F.asm index 33493510..d5e3e77b 100755 --- a/data/mapHeaders/CeladonMansion2F.asm +++ b/data/mapHeaders/CeladonMansion2F.asm @@ -1,8 +1,3 @@ -CeladonMansion2F_h:: - db MANSION ; tileset - db CELADON_MANSION_2F_HEIGHT, CELADON_MANSION_2F_WIDTH ; dimensions (y, x) - dw CeladonMansion2F_Blocks ; blocks - dw CeladonMansion2F_TextPointers ; texts - dw CeladonMansion2F_Script ; scripts - db 0 ; connections - dw CeladonMansion2F_Object ; objects + + map_header CeladonMansion2F, CELADON_MANSION_2F, MANSION, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMansion3F.asm b/data/mapHeaders/CeladonMansion3F.asm index 89d0cfe6..7566caad 100755 --- a/data/mapHeaders/CeladonMansion3F.asm +++ b/data/mapHeaders/CeladonMansion3F.asm @@ -1,8 +1,3 @@ -CeladonMansion3F_h:: - db MANSION ; tileset - db CELADON_MANSION_3F_HEIGHT, CELADON_MANSION_3F_WIDTH ; dimensions (y, x) - dw CeladonMansion3F_Blocks ; blocks - dw CeladonMansion3F_TextPointers ; texts - dw CeladonMansion3F_Script ; scripts - db 0 ; connections - dw CeladonMansion3F_Object ; objects + + map_header CeladonMansion3F, CELADON_MANSION_3F, MANSION, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMansionRoof.asm b/data/mapHeaders/CeladonMansionRoof.asm index 7f7fa4ac..9cbae6f6 100755 --- a/data/mapHeaders/CeladonMansionRoof.asm +++ b/data/mapHeaders/CeladonMansionRoof.asm @@ -1,8 +1,3 @@ -CeladonMansionRoof_h:: - db MANSION ; tileset - db CELADON_MANSION_ROOF_HEIGHT, CELADON_MANSION_ROOF_WIDTH ; dimensions (y, x) - dw CeladonMansionRoof_Blocks ; blocks - dw CeladonMansionRoof_TextPointers ; texts - dw CeladonMansionRoof_Script ; scripts - db 0 ; connections - dw CeladonMansionRoof_Object ; objects + + map_header CeladonMansionRoof, CELADON_MANSION_ROOF, MANSION, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMansionRoofHouse.asm b/data/mapHeaders/CeladonMansionRoofHouse.asm index de6771b7..cb80fac8 100755 --- a/data/mapHeaders/CeladonMansionRoofHouse.asm +++ b/data/mapHeaders/CeladonMansionRoofHouse.asm @@ -1,8 +1,3 @@ -CeladonMansionRoofHouse_h:: - db HOUSE ; tileset - db CELADON_MANSION_ROOF_HOUSE_HEIGHT, CELADON_MANSION_ROOF_HOUSE_WIDTH ; dimensions (y, x) - dw CeladonMansionRoofHouse_Blocks ; blocks - dw CeladonMansionRoofHouse_TextPointers ; texts - dw CeladonMansionRoofHouse_Script ; scripts - db 0 ; connections - dw CeladonMansionRoofHouse_Object ; objects + + map_header CeladonMansionRoofHouse, CELADON_MANSION_ROOF_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMart1F.asm b/data/mapHeaders/CeladonMart1F.asm index d392f8a7..30bd9ba9 100755 --- a/data/mapHeaders/CeladonMart1F.asm +++ b/data/mapHeaders/CeladonMart1F.asm @@ -1,8 +1,3 @@ -CeladonMart1F_h:: - db LOBBY ; tileset - db CELADON_MART_1F_HEIGHT, CELADON_MART_1F_WIDTH ; dimensions (y, x) - dw CeladonMart1F_Blocks ; blocks - dw CeladonMart1F_TextPointers ; texts - dw CeladonMart1F_Script ; scripts - db 0 ; connections - dw CeladonMart1F_Object ; objects + + map_header CeladonMart1F, CELADON_MART_1F, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMart2F.asm b/data/mapHeaders/CeladonMart2F.asm index ff39a08c..d78dfe28 100755 --- a/data/mapHeaders/CeladonMart2F.asm +++ b/data/mapHeaders/CeladonMart2F.asm @@ -1,8 +1,3 @@ -CeladonMart2F_h:: - db LOBBY ; tileset - db CELADON_MART_2F_HEIGHT, CELADON_MART_2F_WIDTH ; dimensions (y, x) - dw CeladonMart2F_Blocks ; blocks - dw CeladonMart2F_TextPointers ; texts - dw CeladonMart2F_Script ; scripts - db 0 ; connections - dw CeladonMart2F_Object ; objects + + map_header CeladonMart2F, CELADON_MART_2F, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMart3F.asm b/data/mapHeaders/CeladonMart3F.asm index 2bdd384f..ad415eee 100755 --- a/data/mapHeaders/CeladonMart3F.asm +++ b/data/mapHeaders/CeladonMart3F.asm @@ -1,8 +1,3 @@ -CeladonMart3F_h:: - db LOBBY ; tileset - db CELADON_MART_3F_HEIGHT, CELADON_MART_3F_WIDTH ; dimensions (y, x) - dw CeladonMart3F_Blocks ; blocks - dw CeladonMart3F_TextPointers ; texts - dw CeladonMart3F_Script ; scripts - db 0 ; connections - dw CeladonMart3F_Object ; objects + + map_header CeladonMart3F, CELADON_MART_3F, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMart4F.asm b/data/mapHeaders/CeladonMart4F.asm index d03bde7a..b9ce5b34 100755 --- a/data/mapHeaders/CeladonMart4F.asm +++ b/data/mapHeaders/CeladonMart4F.asm @@ -1,8 +1,3 @@ -CeladonMart4F_h:: - db LOBBY ; tileset - db CELADON_MART_4F_HEIGHT, CELADON_MART_4F_WIDTH ; dimensions (y, x) - dw CeladonMart4F_Blocks ; blocks - dw CeladonMart4F_TextPointers ; texts - dw CeladonMart4F_Script ; scripts - db 0 ; connections - dw CeladonMart4F_Object ; objects + + map_header CeladonMart4F, CELADON_MART_4F, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMart5F.asm b/data/mapHeaders/CeladonMart5F.asm index e0f9c436..04d65b2b 100755 --- a/data/mapHeaders/CeladonMart5F.asm +++ b/data/mapHeaders/CeladonMart5F.asm @@ -1,8 +1,3 @@ -CeladonMart5F_h:: - db LOBBY ; tileset - db CELADON_MART_5F_HEIGHT, CELADON_MART_5F_WIDTH ; dimensions (y, x) - dw CeladonMart5F_Blocks ; blocks - dw CeladonMart5F_TextPointers ; texts - dw CeladonMart5F_Script ; scripts - db 0 ; connections - dw CeladonMart5F_Object ; objects + + map_header CeladonMart5F, CELADON_MART_5F, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMartElevator.asm b/data/mapHeaders/CeladonMartElevator.asm index 391f65fd..2a98ccb0 100755 --- a/data/mapHeaders/CeladonMartElevator.asm +++ b/data/mapHeaders/CeladonMartElevator.asm @@ -1,8 +1,3 @@ -CeladonMartElevator_h:: - db LOBBY ; tileset - db CELADON_MART_ELEVATOR_HEIGHT, CELADON_MART_ELEVATOR_WIDTH ; dimensions (y, x) - dw CeladonMartElevator_Blocks ; blocks - dw CeladonMartElevator_TextPointers ; texts - dw CeladonMartElevator_Script ; scripts - db 0 ; connections - dw CeladonMartElevator_Object ; objects + + map_header CeladonMartElevator, CELADON_MART_ELEVATOR, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonMartRoof.asm b/data/mapHeaders/CeladonMartRoof.asm index 38f863f1..823ff25f 100755 --- a/data/mapHeaders/CeladonMartRoof.asm +++ b/data/mapHeaders/CeladonMartRoof.asm @@ -1,8 +1,3 @@ -CeladonMartRoof_h:: - db LOBBY ; tileset - db CELADON_MART_ROOF_HEIGHT, CELADON_MART_ROOF_WIDTH ; dimensions (y, x) - dw CeladonMartRoof_Blocks ; blocks - dw CeladonMartRoof_TextPointers ; texts - dw CeladonMartRoof_Script ; scripts - db 0 ; connections - dw CeladonMartRoof_Object ; objects + + map_header CeladonMartRoof, CELADON_MART_ROOF, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/CeladonPokecenter.asm b/data/mapHeaders/CeladonPokecenter.asm index 5b945d50..378a41ec 100755 --- a/data/mapHeaders/CeladonPokecenter.asm +++ b/data/mapHeaders/CeladonPokecenter.asm @@ -1,8 +1,3 @@ -CeladonPokecenter_h:: - db POKECENTER ; tileset - db CELADON_POKECENTER_HEIGHT, CELADON_POKECENTER_WIDTH ; dimensions (y, x) - dw CeladonPokecenter_Blocks ; blocks - dw CeladonPokecenter_TextPointers ; texts - dw CeladonPokecenter_Script ; scripts - db 0 ; connections - dw CeladonPokecenter_Object ; objects + + map_header CeladonPokecenter, CELADON_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanBadgeHouse.asm b/data/mapHeaders/CeruleanBadgeHouse.asm index eaf77bb7..47a97b14 100755 --- a/data/mapHeaders/CeruleanBadgeHouse.asm +++ b/data/mapHeaders/CeruleanBadgeHouse.asm @@ -1,8 +1,3 @@ -CeruleanBadgeHouse_h:: - db SHIP ; tileset - db CERULEAN_BADGE_HOUSE_HEIGHT, CERULEAN_BADGE_HOUSE_WIDTH ; dimensions (y, x) - dw CeruleanBadgeHouse_Blocks ; blocks - dw CeruleanBadgeHouse_TextPointers ; texts - dw CeruleanBadgeHouse_Script ; scripts - db 0 ; connections - dw CeruleanBadgeHouse_Object ; objects + + map_header CeruleanBadgeHouse, CERULEAN_BADGE_HOUSE, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanCave1F.asm b/data/mapHeaders/CeruleanCave1F.asm index 0ab0ecf0..7c80bbeb 100755 --- a/data/mapHeaders/CeruleanCave1F.asm +++ b/data/mapHeaders/CeruleanCave1F.asm @@ -1,8 +1,3 @@ -CeruleanCave1F_h:: - db CAVERN ; tileset - db CERULEAN_CAVE_1F_HEIGHT, CERULEAN_CAVE_1F_WIDTH ; dimensions (y, x) - dw CeruleanCave1F_Blocks ; blocks - dw CeruleanCave1F_TextPointers ; texts - dw CeruleanCave1F_Script ; scripts - db 0 ; connections - dw CeruleanCave1F_Object ; objects + + map_header CeruleanCave1F, CERULEAN_CAVE_1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanCave2F.asm b/data/mapHeaders/CeruleanCave2F.asm index 4002e73a..353e265b 100755 --- a/data/mapHeaders/CeruleanCave2F.asm +++ b/data/mapHeaders/CeruleanCave2F.asm @@ -1,8 +1,3 @@ -CeruleanCave2F_h:: - db CAVERN ; tileset - db CERULEAN_CAVE_2F_HEIGHT, CERULEAN_CAVE_2F_WIDTH ; dimensions (y, x) - dw CeruleanCave2F_Blocks ; blocks - dw CeruleanCave2F_TextPointers ; texts - dw CeruleanCave2F_Script ; scripts - db 0 ; connections - dw CeruleanCave2F_Object ; objects + + map_header CeruleanCave2F, CERULEAN_CAVE_2F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanCaveB1F.asm b/data/mapHeaders/CeruleanCaveB1F.asm index e3e9980f..d759aa6b 100755 --- a/data/mapHeaders/CeruleanCaveB1F.asm +++ b/data/mapHeaders/CeruleanCaveB1F.asm @@ -1,8 +1,3 @@ -CeruleanCaveB1F_h:: - db CAVERN ; tileset - db CERULEAN_CAVE_B1F_HEIGHT, CERULEAN_CAVE_B1F_WIDTH ; dimensions (y, x) - dw CeruleanCaveB1F_Blocks ; blocks - dw CeruleanCaveB1F_TextPointers ; texts - dw CeruleanCaveB1F_Script ; scripts - db 0 ; connections - dw CeruleanCaveB1F_Object ; objects + + map_header CeruleanCaveB1F, CERULEAN_CAVE_B1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanCity.asm b/data/mapHeaders/CeruleanCity.asm index 23206c0a..c925713c 100755 --- a/data/mapHeaders/CeruleanCity.asm +++ b/data/mapHeaders/CeruleanCity.asm @@ -1,12 +1,7 @@ -CeruleanCity_h:: - db OVERWORLD ; tileset - db CERULEAN_CITY_HEIGHT, CERULEAN_CITY_WIDTH ; dimensions (y, x) - dw CeruleanCity_Blocks ; blocks - dw CeruleanCity_TextPointers ; texts - dw CeruleanCity_Script ; scripts - db NORTH | SOUTH | WEST | EAST ; connections - NORTH_MAP_CONNECTION CERULEAN_CITY, ROUTE_24, 5, 0, Route24_Blocks - SOUTH_MAP_CONNECTION CERULEAN_CITY, ROUTE_5, 5, 0, Route5_Blocks, 1 - WEST_MAP_CONNECTION CERULEAN_CITY, ROUTE_4, 4, 0, Route4_Blocks - EAST_MAP_CONNECTION CERULEAN_CITY, ROUTE_9, 4, 0, Route9_Blocks - dw CeruleanCity_Object ; objects + + map_header CeruleanCity, CERULEAN_CITY, OVERWORLD, NORTH | SOUTH | WEST | EAST + connection north, Route24, ROUTE_24, 5 + connection south, Route5, ROUTE_5, 5 + connection west, Route4, ROUTE_4, 4 + connection east, Route9, ROUTE_9, 4 + end_map_header diff --git a/data/mapHeaders/CeruleanGym.asm b/data/mapHeaders/CeruleanGym.asm index 32bb563f..b1010ac3 100755 --- a/data/mapHeaders/CeruleanGym.asm +++ b/data/mapHeaders/CeruleanGym.asm @@ -1,8 +1,3 @@ -CeruleanGym_h:: - db GYM ; tileset - db CERULEAN_GYM_HEIGHT, CERULEAN_GYM_WIDTH ; dimensions (y, x) - dw CeruleanGym_Blocks ; blocks - dw CeruleanGym_TextPointers ; texts - dw CeruleanGym_Script ; scripts - db 0 ; connections - dw CeruleanGym_Object ; objects + + map_header CeruleanGym, CERULEAN_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanMart.asm b/data/mapHeaders/CeruleanMart.asm index 106b664c..2ee31666 100755 --- a/data/mapHeaders/CeruleanMart.asm +++ b/data/mapHeaders/CeruleanMart.asm @@ -1,8 +1,3 @@ -CeruleanMart_h:: - db MART ; tileset - db CERULEAN_MART_HEIGHT, CERULEAN_MART_WIDTH ; dimensions (y, x) - dw CeruleanMart_Blocks ; blocks - dw CeruleanMart_TextPointers ; texts - dw CeruleanMart_Script ; scripts - db 0 ; connections - dw CeruleanMart_Object ; objects + + map_header CeruleanMart, CERULEAN_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanPokecenter.asm b/data/mapHeaders/CeruleanPokecenter.asm index d81c0183..b79e7aff 100755 --- a/data/mapHeaders/CeruleanPokecenter.asm +++ b/data/mapHeaders/CeruleanPokecenter.asm @@ -1,8 +1,3 @@ -CeruleanPokecenter_h:: - db POKECENTER ; tileset - db CERULEAN_POKECENTER_HEIGHT, CERULEAN_POKECENTER_WIDTH ; dimensions (y, x) - dw CeruleanPokecenter_Blocks ; blocks - dw CeruleanPokecenter_TextPointers ; texts - dw CeruleanPokecenter_Script ; scripts - db 0 ; connections - dw CeruleanPokecenter_Object ; objects + + map_header CeruleanPokecenter, CERULEAN_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanTradeHouse.asm b/data/mapHeaders/CeruleanTradeHouse.asm index 171586fa..20970b77 100755 --- a/data/mapHeaders/CeruleanTradeHouse.asm +++ b/data/mapHeaders/CeruleanTradeHouse.asm @@ -1,8 +1,3 @@ -CeruleanTradeHouse_h:: - db HOUSE ; tileset - db CERULEAN_TRADE_HOUSE_HEIGHT, CERULEAN_TRADE_HOUSE_WIDTH ; dimensions (y, x) - dw CeruleanTradeHouse_Blocks ; blocks - dw CeruleanTradeHouse_TextPointers ; texts - dw CeruleanTradeHouse_Script ; scripts - db 0 ; connections - dw CeruleanTradeHouse_Object ; objects + + map_header CeruleanTradeHouse, CERULEAN_TRADE_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/CeruleanTrashedHouse.asm b/data/mapHeaders/CeruleanTrashedHouse.asm index b9d53cdb..192a4195 100755 --- a/data/mapHeaders/CeruleanTrashedHouse.asm +++ b/data/mapHeaders/CeruleanTrashedHouse.asm @@ -1,8 +1,3 @@ -CeruleanTrashedHouse_h:: - db HOUSE ; tileset - db CERULEAN_TRASHED_HOUSE_HEIGHT, CERULEAN_TRASHED_HOUSE_WIDTH ; dimensions (y, x) - dw CeruleanTrashedHouse_Blocks ; blocks - dw CeruleanTrashedHouse_TextPointers ; texts - dw CeruleanTrashedHouse_Script ; scripts - db 0 ; connections - dw CeruleanTrashedHouse_Object ; objects + + map_header CeruleanTrashedHouse, CERULEAN_TRASHED_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/ChampionsRoom.asm b/data/mapHeaders/ChampionsRoom.asm index c6794804..aadc70a6 100755 --- a/data/mapHeaders/ChampionsRoom.asm +++ b/data/mapHeaders/ChampionsRoom.asm @@ -1,8 +1,3 @@ -ChampionsRoom_h:: - db GYM ; tileset - db CHAMPIONS_ROOM_HEIGHT, CHAMPIONS_ROOM_WIDTH ; dimensions (y, x) - dw ChampionsRoom_Blocks ; blocks - dw ChampionsRoom_TextPointers ; texts - dw ChampionsRoom_Script ; scripts - db $0 ; connections - dw ChampionsRoom_Object ; objects + + map_header ChampionsRoom, CHAMPIONS_ROOM, GYM, $0 + end_map_header diff --git a/data/mapHeaders/CinnabarGym.asm b/data/mapHeaders/CinnabarGym.asm index 96154af7..cc6dc1d7 100755 --- a/data/mapHeaders/CinnabarGym.asm +++ b/data/mapHeaders/CinnabarGym.asm @@ -1,8 +1,3 @@ -CinnabarGym_h:: - db FACILITY ; tileset - db CINNABAR_GYM_HEIGHT, CINNABAR_GYM_WIDTH ; dimensions (y, x) - dw CinnabarGym_Blocks ; blocks - dw CinnabarGym_TextPointers ; texts - dw CinnabarGym_Script ; scripts - db 0 ; connections - dw CinnabarGym_Object ; objects + + map_header CinnabarGym, CINNABAR_GYM, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarIsland.asm b/data/mapHeaders/CinnabarIsland.asm index 3489fe3c..a94498be 100755 --- a/data/mapHeaders/CinnabarIsland.asm +++ b/data/mapHeaders/CinnabarIsland.asm @@ -1,10 +1,5 @@ -CinnabarIsland_h:: - db OVERWORLD ; tileset - db CINNABAR_ISLAND_HEIGHT, CINNABAR_ISLAND_WIDTH ; dimensions (y, x) - dw CinnabarIsland_Blocks ; blocks - dw CinnabarIsland_TextPointers ; texts - dw CinnabarIsland_Script ; scripts - db NORTH | EAST ; connections - NORTH_MAP_CONNECTION CINNABAR_ISLAND, ROUTE_21, 0, 0, Route21_Blocks - EAST_MAP_CONNECTION CINNABAR_ISLAND, ROUTE_20, 0, 0, Route20_Blocks - dw CinnabarIsland_Object ; objects + + map_header CinnabarIsland, CINNABAR_ISLAND, OVERWORLD, NORTH | EAST + connection north, Route21, ROUTE_21, 0 + connection east, Route20, ROUTE_20, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarLab.asm b/data/mapHeaders/CinnabarLab.asm index ffa3a037..e8081e75 100755 --- a/data/mapHeaders/CinnabarLab.asm +++ b/data/mapHeaders/CinnabarLab.asm @@ -1,8 +1,3 @@ -CinnabarLab_h:: - db LAB ; tileset - db CINNABAR_LAB_HEIGHT, CINNABAR_LAB_WIDTH ; dimensions (y, x) - dw CinnabarLab_Blocks ; blocks - dw CinnabarLab_TextPointers ; texts - dw CinnabarLab_Script ; scripts - db 0 ; connections - dw CinnabarLab_Object ; objects + + map_header CinnabarLab, CINNABAR_LAB, LAB, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarLabFossilRoom.asm b/data/mapHeaders/CinnabarLabFossilRoom.asm index 8e833f70..3cb88437 100755 --- a/data/mapHeaders/CinnabarLabFossilRoom.asm +++ b/data/mapHeaders/CinnabarLabFossilRoom.asm @@ -1,8 +1,3 @@ -CinnabarLabFossilRoom_h:: - db LAB ; tileset - db CINNABAR_LAB_FOSSIL_ROOM_HEIGHT, CINNABAR_LAB_FOSSIL_ROOM_WIDTH ; dimensions (y, x) - dw CinnabarLabFossilRoom_Blocks ; blocks - dw CinnabarLabFossilRoom_TextPointers ; texts - dw CinnabarLabFossilRoom_Script ; scripts - db 0 ; connections - dw CinnabarLabFossilRoom_Object ; objects + + map_header CinnabarLabFossilRoom, CINNABAR_LAB_FOSSIL_ROOM, LAB, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarLabMetronomeRoom.asm b/data/mapHeaders/CinnabarLabMetronomeRoom.asm index 35169504..d77338c8 100755 --- a/data/mapHeaders/CinnabarLabMetronomeRoom.asm +++ b/data/mapHeaders/CinnabarLabMetronomeRoom.asm @@ -1,8 +1,3 @@ -CinnabarLabMetronomeRoom_h:: - db LAB ; tileset - db CINNABAR_LAB_METRONOME_ROOM_HEIGHT, CINNABAR_LAB_METRONOME_ROOM_WIDTH ; dimensions (y, x) - dw CinnabarLabMetronomeRoom_Blocks ; blocks - dw CinnabarLabMetronomeRoom_TextPointers ; texts - dw CinnabarLabMetronomeRoom_Script ; scripts - db 0 ; connections - dw CinnabarLabMetronomeRoom_Object ; objects + + map_header CinnabarLabMetronomeRoom, CINNABAR_LAB_METRONOME_ROOM, LAB, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarLabTradeRoom.asm b/data/mapHeaders/CinnabarLabTradeRoom.asm index a18e6eed..c23d9c15 100755 --- a/data/mapHeaders/CinnabarLabTradeRoom.asm +++ b/data/mapHeaders/CinnabarLabTradeRoom.asm @@ -1,8 +1,3 @@ -CinnabarLabTradeRoom_h:: - db LAB ; tileset - db CINNABAR_LAB_TRADE_ROOM_HEIGHT, CINNABAR_LAB_TRADE_ROOM_WIDTH ; dimensions (y, x) - dw CinnabarLabTradeRoom_Blocks ; blocks - dw CinnabarLabTradeRoom_TextPointers ; texts - dw CinnabarLabTradeRoom_Script ; scripts - db 0 ; connections - dw CinnabarLabTradeRoom_Object ; objects + + map_header CinnabarLabTradeRoom, CINNABAR_LAB_TRADE_ROOM, LAB, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarMart.asm b/data/mapHeaders/CinnabarMart.asm index aac1c69f..c68d582a 100755 --- a/data/mapHeaders/CinnabarMart.asm +++ b/data/mapHeaders/CinnabarMart.asm @@ -1,8 +1,3 @@ -CinnabarMart_h:: - db MART ; tileset - db CINNABAR_MART_HEIGHT, CINNABAR_MART_WIDTH ; dimensions (y, x) - dw CinnabarMart_Blocks ; blocks - dw CinnabarMart_TextPointers ; texts - dw CinnabarMart_Script ; scripts - db 0 ; connections - dw CinnabarMart_Object ; objects + + map_header CinnabarMart, CINNABAR_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/CinnabarPokecenter.asm b/data/mapHeaders/CinnabarPokecenter.asm index d9ade14c..d910133b 100755 --- a/data/mapHeaders/CinnabarPokecenter.asm +++ b/data/mapHeaders/CinnabarPokecenter.asm @@ -1,8 +1,3 @@ -CinnabarPokecenter_h:: - db POKECENTER ; tileset - db CINNABAR_POKECENTER_HEIGHT, CINNABAR_POKECENTER_WIDTH ; dimensions (y, x) - dw CinnabarPokecenter_Blocks ; blocks - dw CinnabarPokecenter_TextPointers ; texts - dw CinnabarPokecenter_Script ; scripts - db 0 ; connections - dw CinnabarPokecenter_Object ; objects + + map_header CinnabarPokecenter, CINNABAR_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/Colosseum.asm b/data/mapHeaders/Colosseum.asm index 3375e0f1..faf03eb4 100755 --- a/data/mapHeaders/Colosseum.asm +++ b/data/mapHeaders/Colosseum.asm @@ -1,8 +1,3 @@ -Colosseum_h:: - db CLUB ; tileset - db COLOSSEUM_HEIGHT, COLOSSEUM_WIDTH ; dimensions (y, x) - dw Colosseum_Blocks ; blocks - dw Colosseum_TextPointers ; texts - dw Colosseum_Script ; scripts - db 0 ; connections - dw Colosseum_Object ; objects + + map_header Colosseum, COLOSSEUM, CLUB, 0 + end_map_header diff --git a/data/mapHeaders/CopycatsHouse1F.asm b/data/mapHeaders/CopycatsHouse1F.asm index b68728ae..532cef93 100755 --- a/data/mapHeaders/CopycatsHouse1F.asm +++ b/data/mapHeaders/CopycatsHouse1F.asm @@ -1,8 +1,3 @@ -CopycatsHouse1F_h:: - db REDS_HOUSE_1 ; tileset - db COPYCATS_HOUSE_1F_HEIGHT, COPYCATS_HOUSE_1F_WIDTH ; dimensions (y, x) - dw CopycatsHouse1F_Blocks ; blocks - dw CopycatsHouse1F_TextPointers ; texts - dw CopycatsHouse1F_Script ; scripts - db 0 ; connections - dw CopycatsHouse1F_Object ; objects + + map_header CopycatsHouse1F, COPYCATS_HOUSE_1F, REDS_HOUSE_1, 0 + end_map_header diff --git a/data/mapHeaders/CopycatsHouse2F.asm b/data/mapHeaders/CopycatsHouse2F.asm index 1c7d9af9..38b1fbbb 100755 --- a/data/mapHeaders/CopycatsHouse2F.asm +++ b/data/mapHeaders/CopycatsHouse2F.asm @@ -1,8 +1,3 @@ -CopycatsHouse2F_h:: - db REDS_HOUSE_2 ; tileset - db COPYCATS_HOUSE_2F_HEIGHT, COPYCATS_HOUSE_2F_WIDTH ; dimensions (y, x) - dw CopycatsHouse2F_Blocks ; blocks - dw CopycatsHouse2F_TextPointers ; texts - dw CopycatsHouse2F_Script ; scripts - db 0 ; connections - dw CopycatsHouse2F_Object ; objects + + map_header CopycatsHouse2F, COPYCATS_HOUSE_2F, REDS_HOUSE_2, 0 + end_map_header diff --git a/data/mapHeaders/Daycare.asm b/data/mapHeaders/Daycare.asm index 4f2e41e7..dabeedd9 100755 --- a/data/mapHeaders/Daycare.asm +++ b/data/mapHeaders/Daycare.asm @@ -1,8 +1,3 @@ -Daycare_h:: - db HOUSE ; tileset - db DAYCARE_HEIGHT, DAYCARE_WIDTH ; dimensions (y, x) - dw Daycare_Blocks ; blocks - dw Daycare_TextPointers ; texts - dw Daycare_Script ; scripts - db 0 ; connections - dw Daycare_Object ; objects + + map_header Daycare, DAYCARE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/DiglettsCave.asm b/data/mapHeaders/DiglettsCave.asm index 9742d306..d3777d31 100755 --- a/data/mapHeaders/DiglettsCave.asm +++ b/data/mapHeaders/DiglettsCave.asm @@ -1,8 +1,3 @@ -DiglettsCave_h:: - db CAVERN ; tileset - db DIGLETTS_CAVE_HEIGHT, DIGLETTS_CAVE_WIDTH ; dimensions (y, x) - dw DiglettsCave_Blocks ; blocks - dw DiglettsCave_TextPointers ; texts - dw DiglettsCave_Script ; scripts - db 0 ; connections - dw DiglettsCave_Object ; objects + + map_header DiglettsCave, DIGLETTS_CAVE, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/DiglettsCaveRoute11.asm b/data/mapHeaders/DiglettsCaveRoute11.asm index ac9082ed..d8bdd704 100755 --- a/data/mapHeaders/DiglettsCaveRoute11.asm +++ b/data/mapHeaders/DiglettsCaveRoute11.asm @@ -1,8 +1,3 @@ -DiglettsCaveRoute11_h:: - db CAVERN ; tileset - db DIGLETTS_CAVE_ROUTE_11_HEIGHT, DIGLETTS_CAVE_ROUTE_11_WIDTH ; dimensions (y, x) - dw DiglettsCaveRoute11_Blocks ; blocks - dw DiglettsCaveRoute11_TextPointers ; texts - dw DiglettsCaveRoute11_Script ; scripts - db 0 ; connections - dw DiglettsCaveRoute11_Object ; objects + + map_header DiglettsCaveRoute11, DIGLETTS_CAVE_ROUTE_11, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/DiglettsCaveRoute2.asm b/data/mapHeaders/DiglettsCaveRoute2.asm index 1279e89f..86f5ae35 100755 --- a/data/mapHeaders/DiglettsCaveRoute2.asm +++ b/data/mapHeaders/DiglettsCaveRoute2.asm @@ -1,8 +1,3 @@ -DiglettsCaveRoute2_h:: - db CAVERN ; tileset - db DIGLETTS_CAVE_ROUTE_2_HEIGHT, DIGLETTS_CAVE_ROUTE_2_WIDTH ; dimensions (y, x) - dw DiglettsCaveRoute2_Blocks ; blocks - dw DiglettsCaveRoute2_TextPointers ; texts - dw DiglettsCaveRoute2_Script ; scripts - db 0 ; connections - dw DiglettsCaveRoute2_Object ; objects + + map_header DiglettsCaveRoute2, DIGLETTS_CAVE_ROUTE_2, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/FightingDojo.asm b/data/mapHeaders/FightingDojo.asm index da8a589a..7ecadc57 100755 --- a/data/mapHeaders/FightingDojo.asm +++ b/data/mapHeaders/FightingDojo.asm @@ -1,8 +1,3 @@ -FightingDojo_h:: - db DOJO ; tileset - db FIGHTING_DOJO_HEIGHT, FIGHTING_DOJO_WIDTH ; dimensions (y, x) - dw FightingDojo_Blocks ; blocks - dw FightingDojo_TextPointers ; texts - dw FightingDojo_Script ; scripts - db 0 ; connections - dw FightingDojo_Object ; objects + + map_header FightingDojo, FIGHTING_DOJO, DOJO, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaBillsGrandpasHouse.asm b/data/mapHeaders/FuchsiaBillsGrandpasHouse.asm index cbef462c..10ba48e9 100755 --- a/data/mapHeaders/FuchsiaBillsGrandpasHouse.asm +++ b/data/mapHeaders/FuchsiaBillsGrandpasHouse.asm @@ -1,8 +1,3 @@ -FuchsiaBillsGrandpasHouse_h:: - db HOUSE ; tileset - db FUCHSIA_BILLS_GRANDPAS_HOUSE_HEIGHT, FUCHSIA_BILLS_GRANDPAS_HOUSE_WIDTH ; dimensions (y, x) - dw FuchsiaBillsGrandpasHouse_Blocks ; blocks - dw FuchsiaBillsGrandpasHouse_TextPointers ; texts - dw FuchsiaBillsGrandpasHouse_Script ; scripts - db 0 ; connections - dw FuchsiaBillsGrandpasHouse_Object ; objects + + map_header FuchsiaBillsGrandpasHouse, FUCHSIA_BILLS_GRANDPAS_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaCity.asm b/data/mapHeaders/FuchsiaCity.asm index 1b247678..6028bce0 100755 --- a/data/mapHeaders/FuchsiaCity.asm +++ b/data/mapHeaders/FuchsiaCity.asm @@ -1,11 +1,6 @@ -FuchsiaCity_h:: - db OVERWORLD ; tileset - db FUCHSIA_CITY_HEIGHT, FUCHSIA_CITY_WIDTH ; dimensions (y, x) - dw FuchsiaCity_Blocks ; blocks - dw FuchsiaCity_TextPointers ; texts - dw FuchsiaCity_Script ; scripts - db SOUTH | WEST | EAST ; connections - SOUTH_MAP_CONNECTION FUCHSIA_CITY, ROUTE_19, 5, 0, Route19_Blocks - WEST_MAP_CONNECTION FUCHSIA_CITY, ROUTE_18, 4, 0, Route18_Blocks - EAST_MAP_CONNECTION FUCHSIA_CITY, ROUTE_15, 4, 0, Route15_Blocks - dw FuchsiaCity_Object ; objects + + map_header FuchsiaCity, FUCHSIA_CITY, OVERWORLD, SOUTH | WEST | EAST + connection south, Route19, ROUTE_19, 5 + connection west, Route18, ROUTE_18, 4 + connection east, Route15, ROUTE_15, 4 + end_map_header diff --git a/data/mapHeaders/FuchsiaGoodRodHouse.asm b/data/mapHeaders/FuchsiaGoodRodHouse.asm index fd2e36b4..d21611c1 100755 --- a/data/mapHeaders/FuchsiaGoodRodHouse.asm +++ b/data/mapHeaders/FuchsiaGoodRodHouse.asm @@ -1,8 +1,3 @@ -FuchsiaGoodRodHouse_h:: - db SHIP ; tileset - db FUCHSIA_GOOD_ROD_HOUSE_HEIGHT, FUCHSIA_GOOD_ROD_HOUSE_WIDTH ; dimensions (y, x) - dw FuchsiaGoodRodHouse_Blocks ; blocks - dw FuchsiaGoodRodHouse_TextPointers ; texts - dw FuchsiaGoodRodHouse_Script ; scripts - db 0 ; connections - dw FuchsiaGoodRodHouse_Object ; objects + + map_header FuchsiaGoodRodHouse, FUCHSIA_GOOD_ROD_HOUSE, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaGym.asm b/data/mapHeaders/FuchsiaGym.asm index ffc5c0fe..44be2971 100755 --- a/data/mapHeaders/FuchsiaGym.asm +++ b/data/mapHeaders/FuchsiaGym.asm @@ -1,8 +1,3 @@ -FuchsiaGym_h:: - db GYM ; tileset - db FUCHSIA_GYM_HEIGHT, FUCHSIA_GYM_WIDTH ; dimensions (y, x) - dw FuchsiaGym_Blocks ; blocks - dw FuchsiaGym_TextPointers ; texts - dw FuchsiaGym_Script ; scripts - db 0 ; connections - dw FuchsiaGym_Object ; objects + + map_header FuchsiaGym, FUCHSIA_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaMart.asm b/data/mapHeaders/FuchsiaMart.asm index b9c0d938..120fe305 100755 --- a/data/mapHeaders/FuchsiaMart.asm +++ b/data/mapHeaders/FuchsiaMart.asm @@ -1,8 +1,3 @@ -FuchsiaMart_h:: - db MART ; tileset - db FUCHSIA_MART_HEIGHT, FUCHSIA_MART_WIDTH ; dimensions (y, x) - dw FuchsiaMart_Blocks ; blocks - dw FuchsiaMart_TextPointers ; texts - dw FuchsiaMart_Script ; scripts - db 0 ; connections - dw FuchsiaMart_Object ; objects + + map_header FuchsiaMart, FUCHSIA_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaMeetingRoom.asm b/data/mapHeaders/FuchsiaMeetingRoom.asm index a3198eea..a5ab4f04 100755 --- a/data/mapHeaders/FuchsiaMeetingRoom.asm +++ b/data/mapHeaders/FuchsiaMeetingRoom.asm @@ -1,8 +1,3 @@ -FuchsiaMeetingRoom_h:: - db LAB ; tileset - db FUCHSIA_MEETING_ROOM_HEIGHT, FUCHSIA_MEETING_ROOM_WIDTH ; dimensions (y, x) - dw FuchsiaMeetingRoom_Blocks ; blocks - dw FuchsiaMeetingRoom_TextPointers ; texts - dw FuchsiaMeetingRoom_Script ; scripts - db 0 ; connections - dw FuchsiaMeetingRoom_Object ; objects + + map_header FuchsiaMeetingRoom, FUCHSIA_MEETING_ROOM, LAB, 0 + end_map_header diff --git a/data/mapHeaders/FuchsiaPokecenter.asm b/data/mapHeaders/FuchsiaPokecenter.asm index beea4fc2..c1c683bd 100755 --- a/data/mapHeaders/FuchsiaPokecenter.asm +++ b/data/mapHeaders/FuchsiaPokecenter.asm @@ -1,8 +1,3 @@ -FuchsiaPokecenter_h:: - db POKECENTER ; tileset - db FUCHSIA_POKECENTER_HEIGHT, FUCHSIA_POKECENTER_WIDTH ; dimensions (y, x) - dw FuchsiaPokecenter_Blocks ; blocks - dw FuchsiaPokecenter_TextPointers ; texts - dw FuchsiaPokecenter_Script ; scripts - db 0 ; connections - dw FuchsiaPokecenter_Object ; objects + + map_header FuchsiaPokecenter, FUCHSIA_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/GameCorner.asm b/data/mapHeaders/GameCorner.asm index 6965e276..ad367b93 100755 --- a/data/mapHeaders/GameCorner.asm +++ b/data/mapHeaders/GameCorner.asm @@ -1,8 +1,3 @@ -GameCorner_h:: - db LOBBY ; tileset - db GAME_CORNER_HEIGHT, GAME_CORNER_WIDTH ; dimensions (y, x) - dw GameCorner_Blocks ; blocks - dw GameCorner_TextPointers ; texts - dw GameCorner_Script ; scripts - db 0 ; connections - dw GameCorner_Object ; objects + + map_header GameCorner, GAME_CORNER, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/GameCornerPrizeRoom.asm b/data/mapHeaders/GameCornerPrizeRoom.asm index 035f1112..4668cbb8 100755 --- a/data/mapHeaders/GameCornerPrizeRoom.asm +++ b/data/mapHeaders/GameCornerPrizeRoom.asm @@ -1,8 +1,3 @@ -GameCornerPrizeRoom_h:: - db LOBBY ; tileset - db GAME_CORNER_PRIZE_ROOM_HEIGHT, GAME_CORNER_PRIZE_ROOM_WIDTH ; dimensions (y, x) - dw GameCornerPrizeRoom_Blocks ; blocks - dw GameCornerPrizeRoom_TextPointers ; texts - dw GameCornerPrizeRoom_Script ; scripts - db 0 ; connections - dw GameCornerPrizeRoom_Object ; objects + + map_header GameCornerPrizeRoom, GAME_CORNER_PRIZE_ROOM, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/HallOfFame.asm b/data/mapHeaders/HallOfFame.asm index 7752ddb5..e2dc3fb3 100755 --- a/data/mapHeaders/HallOfFame.asm +++ b/data/mapHeaders/HallOfFame.asm @@ -1,8 +1,3 @@ -HallOfFame_h:: - db GYM ; tileset - db HALL_OF_FAME_HEIGHT, HALL_OF_FAME_WIDTH ; dimensions (y, x) - dw HallOfFame_Blocks ; blocks - dw HallOfFame_TextPointers ; texts - dw HallOfFame_Script ; scripts - db 0 ; connections - dw HallOfFame_Object ; objects + + map_header HallOfFame, HALL_OF_FAME, GYM, 0 + end_map_header diff --git a/data/mapHeaders/IndigoPlateau.asm b/data/mapHeaders/IndigoPlateau.asm index b5dcf3de..ff394dfe 100755 --- a/data/mapHeaders/IndigoPlateau.asm +++ b/data/mapHeaders/IndigoPlateau.asm @@ -1,9 +1,4 @@ -IndigoPlateau_h:: - db PLATEAU ; tileset - db INDIGO_PLATEAU_HEIGHT, INDIGO_PLATEAU_WIDTH ; dimensions (y, x) - dw IndigoPlateau_Blocks ; blocks - dw IndigoPlateau_TextPointers ; texts - dw IndigoPlateau_Script ; scripts - db SOUTH ; connections - SOUTH_MAP_CONNECTION INDIGO_PLATEAU, ROUTE_23, 0, 0, Route23_Blocks - dw IndigoPlateau_Object ; objects + + map_header IndigoPlateau, INDIGO_PLATEAU, PLATEAU, SOUTH + connection south, Route23, ROUTE_23, 0 + end_map_header diff --git a/data/mapHeaders/IndigoPlateauLobby.asm b/data/mapHeaders/IndigoPlateauLobby.asm index dc32f7d1..b13afa12 100755 --- a/data/mapHeaders/IndigoPlateauLobby.asm +++ b/data/mapHeaders/IndigoPlateauLobby.asm @@ -1,8 +1,3 @@ -IndigoPlateauLobby_h:: - db MART ; tileset - db INDIGO_PLATEAU_LOBBY_HEIGHT, INDIGO_PLATEAU_LOBBY_WIDTH ; dimensions (y, x) - dw IndigoPlateauLobby_Blocks ; blocks - dw IndigoPlateauLobby_TextPointers ; texts - dw IndigoPlateauLobby_Script ; scripts - db 0 ; connections - dw IndigoPlateauLobby_Object ; objects + + map_header IndigoPlateauLobby, INDIGO_PLATEAU_LOBBY, MART, 0 + end_map_header diff --git a/data/mapHeaders/LancesRoom.asm b/data/mapHeaders/LancesRoom.asm index 5373f010..0b69970e 100755 --- a/data/mapHeaders/LancesRoom.asm +++ b/data/mapHeaders/LancesRoom.asm @@ -1,8 +1,3 @@ -LancesRoom_h:: - db DOJO ; tileset - db LANCES_ROOM_HEIGHT, LANCES_ROOM_WIDTH ; dimensions (y, x) - dw LancesRoom_Blocks ; blocks - dw LancesRoom_TextPointers ; texts - dw LancesRoom_Script ; scripts - db 0 ; connections - dw LancesRoom_Object ; objects + + map_header LancesRoom, LANCES_ROOM, DOJO, 0 + end_map_header diff --git a/data/mapHeaders/LavenderCuboneHouse.asm b/data/mapHeaders/LavenderCuboneHouse.asm index 6d883655..dfd38ff1 100755 --- a/data/mapHeaders/LavenderCuboneHouse.asm +++ b/data/mapHeaders/LavenderCuboneHouse.asm @@ -1,8 +1,3 @@ -LavenderCuboneHouse_h:: - db HOUSE ; tileset - db LAVENDER_CUBONE_HOUSE_HEIGHT, LAVENDER_CUBONE_HOUSE_WIDTH ; dimensions (y, x) - dw LavenderCuboneHouse_Blocks ; blocks - dw LavenderCuboneHouse_TextPointers ; texts - dw LavenderCuboneHouse_Script ; scripts - db 0 ; connections - dw LavenderCuboneHouse_Object ; objects + + map_header LavenderCuboneHouse, LAVENDER_CUBONE_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/LavenderMart.asm b/data/mapHeaders/LavenderMart.asm index 500287b4..82c239e6 100755 --- a/data/mapHeaders/LavenderMart.asm +++ b/data/mapHeaders/LavenderMart.asm @@ -1,8 +1,3 @@ -LavenderMart_h:: - db MART ; tileset - db LAVENDER_MART_HEIGHT, LAVENDER_MART_WIDTH ; dimensions (y, x) - dw LavenderMart_Blocks ; blocks - dw LavenderMart_TextPointers ; texts - dw LavenderMart_Script ; scripts - db 0 ; connections - dw LavenderMart_Object ; objects + + map_header LavenderMart, LAVENDER_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/LavenderPokecenter.asm b/data/mapHeaders/LavenderPokecenter.asm index 2c87b401..c0cd0adf 100755 --- a/data/mapHeaders/LavenderPokecenter.asm +++ b/data/mapHeaders/LavenderPokecenter.asm @@ -1,8 +1,3 @@ -LavenderPokecenter_h:: - db POKECENTER ; tileset - db LAVENDER_POKECENTER_HEIGHT, LAVENDER_POKECENTER_WIDTH ; dimensions (y, x) - dw LavenderPokecenter_Blocks ; blocks - dw LavenderPokecenter_TextPointers ; texts - dw LavenderPokecenter_Script ; scripts - db 0 ; connections - dw LavenderPokecenter_Object ; objects + + map_header LavenderPokecenter, LAVENDER_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/LavenderTown.asm b/data/mapHeaders/LavenderTown.asm index 67a88189..7c1c9c46 100755 --- a/data/mapHeaders/LavenderTown.asm +++ b/data/mapHeaders/LavenderTown.asm @@ -1,11 +1,6 @@ -LavenderTown_h:: - db OVERWORLD ; tileset - db LAVENDER_TOWN_HEIGHT, LAVENDER_TOWN_WIDTH ; dimensions (y, x) - dw LavenderTown_Blocks ; blocks - dw LavenderTown_TextPointers ; texts - dw LavenderTown_Script ; scripts - db NORTH | SOUTH | WEST ; connections - NORTH_MAP_CONNECTION LAVENDER_TOWN, ROUTE_10, 0, 0, Route10_Blocks - SOUTH_MAP_CONNECTION LAVENDER_TOWN, ROUTE_12, 0, 0, Route12_Blocks, 1 - WEST_MAP_CONNECTION LAVENDER_TOWN, ROUTE_8, 0, 0, Route8_Blocks - dw LavenderTown_Object ; objects + + map_header LavenderTown, LAVENDER_TOWN, OVERWORLD, NORTH | SOUTH | WEST + connection north, Route10, ROUTE_10, 0 + connection south, Route12, ROUTE_12, 0 + connection west, Route8, ROUTE_8, 0 + end_map_header diff --git a/data/mapHeaders/LoreleisRoom.asm b/data/mapHeaders/LoreleisRoom.asm index d580d9fe..feff946c 100755 --- a/data/mapHeaders/LoreleisRoom.asm +++ b/data/mapHeaders/LoreleisRoom.asm @@ -1,8 +1,3 @@ -LoreleisRoom_h:: - db GYM ; tileset - db LORELEIS_ROOM_HEIGHT, LORELEIS_ROOM_WIDTH ; dimensions (y, x) - dw LoreleisRoom_Blocks ; blocks - dw LoreleisRoom_TextPointers ; texts - dw LoreleisRoom_Script ; scripts - db 0 ; connections - dw LoreleisRoom_Object ; objects + + map_header LoreleisRoom, LORELEIS_ROOM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/MrFujisHouse.asm b/data/mapHeaders/MrFujisHouse.asm index ee82e49c..023cb501 100755 --- a/data/mapHeaders/MrFujisHouse.asm +++ b/data/mapHeaders/MrFujisHouse.asm @@ -1,8 +1,3 @@ -MrFujisHouse_h:: - db HOUSE ; tileset - db MR_FUJIS_HOUSE_HEIGHT, MR_FUJIS_HOUSE_WIDTH ; dimensions (y, x) - dw MrFujisHouse_Blocks ; blocks - dw MrFujisHouse_TextPointers ; texts - dw MrFujisHouse_Script ; scripts - db 0 ; connections - dw MrFujisHouse_Object ; objects + + map_header MrFujisHouse, MR_FUJIS_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/MrPsychicsHouse.asm b/data/mapHeaders/MrPsychicsHouse.asm index ec559ec7..628db044 100755 --- a/data/mapHeaders/MrPsychicsHouse.asm +++ b/data/mapHeaders/MrPsychicsHouse.asm @@ -1,8 +1,3 @@ -MrPsychicsHouse_h:: - db HOUSE ; tileset - db MR_PSYCHICS_HOUSE_HEIGHT, MR_PSYCHICS_HOUSE_WIDTH ; dimensions (y, x) - dw MrPsychicsHouse_Blocks ; blocks - dw MrPsychicsHouse_TextPointers ; texts - dw MrPsychicsHouse_Script ; scripts - db 0 ; connections - dw MrPsychicsHouse_Object ; objects + + map_header MrPsychicsHouse, MR_PSYCHICS_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/MtMoon1F.asm b/data/mapHeaders/MtMoon1F.asm index 37c0ba59..8de2be3e 100755 --- a/data/mapHeaders/MtMoon1F.asm +++ b/data/mapHeaders/MtMoon1F.asm @@ -1,8 +1,3 @@ -MtMoon1F_h:: - db CAVERN ; tileset - db MT_MOON_1F_HEIGHT, MT_MOON_1F_WIDTH ; dimensions (y, x) - dw MtMoon1F_Blocks ; blocks - dw MtMoon1F_TextPointers ; texts - dw MtMoon1F_Script ; scripts - db 0 ; connections - dw MtMoon1F_Object ; objects + + map_header MtMoon1F, MT_MOON_1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/MtMoonB1F.asm b/data/mapHeaders/MtMoonB1F.asm index c14d35d0..9c97b5c7 100755 --- a/data/mapHeaders/MtMoonB1F.asm +++ b/data/mapHeaders/MtMoonB1F.asm @@ -1,8 +1,3 @@ -MtMoonB1F_h:: - db CAVERN ; tileset - db MT_MOON_B1F_HEIGHT, MT_MOON_B1F_WIDTH ; dimensions (y, x) - dw MtMoonB1F_Blocks ; blocks - dw MtMoonB1F_TextPointers ; texts - dw MtMoonB1F_Script ; scripts - db 0 ; connections - dw MtMoonB1F_Object ; objects + + map_header MtMoonB1F, MT_MOON_B1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/MtMoonB2F.asm b/data/mapHeaders/MtMoonB2F.asm index cce8454b..0ed1f96e 100755 --- a/data/mapHeaders/MtMoonB2F.asm +++ b/data/mapHeaders/MtMoonB2F.asm @@ -1,8 +1,3 @@ -MtMoonB2F_h:: - db CAVERN ; tileset - db MT_MOON_B2F_HEIGHT, MT_MOON_B2F_WIDTH ; dimensions (y, x) - dw MtMoonB2F_Blocks ; blocks - dw MtMoonB2F_TextPointers ; texts - dw MtMoonB2F_Script ; scripts - db 0 ; connections - dw MtMoonB2F_Object ; objects + + map_header MtMoonB2F, MT_MOON_B2F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/MtMoonPokecenter.asm b/data/mapHeaders/MtMoonPokecenter.asm index 31f7ec7a..0425eae7 100755 --- a/data/mapHeaders/MtMoonPokecenter.asm +++ b/data/mapHeaders/MtMoonPokecenter.asm @@ -1,8 +1,3 @@ -MtMoonPokecenter_h:: - db POKECENTER ; tileset - db MT_MOON_POKECENTER_HEIGHT, MT_MOON_POKECENTER_WIDTH ; dimensions (y, x) - dw MtMoonPokecenter_Blocks ; blocks - dw MtMoonPokecenter_TextPointers ; texts - dw MtMoonPokecenter_Script ; scripts - db 0 ; connections - dw MtMoonPokecenter_Object ; objects + + map_header MtMoonPokecenter, MT_MOON_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/Museum1F.asm b/data/mapHeaders/Museum1F.asm index f0c967aa..d92176d2 100755 --- a/data/mapHeaders/Museum1F.asm +++ b/data/mapHeaders/Museum1F.asm @@ -1,8 +1,3 @@ -Museum1F_h:: - db MUSEUM ; tileset - db MUSEUM_1F_HEIGHT, MUSEUM_1F_WIDTH ; dimensions (y, x) - dw Museum1F_Blocks ; blocks - dw Museum1F_TextPointers ; texts - dw Museum1F_Script ; scripts - db 0 ; connections - dw Museum1F_Object ; objects + + map_header Museum1F, MUSEUM_1F, MUSEUM, 0 + end_map_header diff --git a/data/mapHeaders/Museum2F.asm b/data/mapHeaders/Museum2F.asm index 9ab38801..d5bf8918 100755 --- a/data/mapHeaders/Museum2F.asm +++ b/data/mapHeaders/Museum2F.asm @@ -1,8 +1,3 @@ -Museum2F_h:: - db MUSEUM ; tileset - db MUSEUM_2F_HEIGHT, MUSEUM_2F_WIDTH ; dimensions (y, x) - dw Museum2F_Blocks ; blocks - dw Museum2F_TextPointers ; texts - dw Museum2F_Script ; scripts - db 0 ; connections - dw Museum2F_Object ; objects + + map_header Museum2F, MUSEUM_2F, MUSEUM, 0 + end_map_header diff --git a/data/mapHeaders/NameRatersHouse.asm b/data/mapHeaders/NameRatersHouse.asm index a727b334..3f9010f0 100755 --- a/data/mapHeaders/NameRatersHouse.asm +++ b/data/mapHeaders/NameRatersHouse.asm @@ -1,8 +1,3 @@ -NameRatersHouse_h:: - db HOUSE ; tileset - db NAME_RATERS_HOUSE_HEIGHT, NAME_RATERS_HOUSE_WIDTH ; dimensions (y, x) - dw NameRatersHouse_Blocks ; blocks - dw NameRatersHouse_TextPointers ; texts - dw NameRatersHouse_Script ; scripts - db 0 ; connections - dw NameRatersHouse_Object ; objects + + map_header NameRatersHouse, NAME_RATERS_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/OaksLab.asm b/data/mapHeaders/OaksLab.asm index ceee34eb..42bb76e8 100755 --- a/data/mapHeaders/OaksLab.asm +++ b/data/mapHeaders/OaksLab.asm @@ -1,8 +1,3 @@ -OaksLab_h:: - db DOJO ; tileset - db OAKS_LAB_HEIGHT, OAKS_LAB_WIDTH ; dimensions (y, x) - dw OaksLab_Blocks ; blocks - dw OaksLab_TextPointers ; texts - dw OaksLab_Script ; scripts - db 0 ; connections - dw OaksLab_Object ; objects + + map_header OaksLab, OAKS_LAB, DOJO, 0 + end_map_header diff --git a/data/mapHeaders/PalletTown.asm b/data/mapHeaders/PalletTown.asm index 72d138e7..2745bdc1 100755 --- a/data/mapHeaders/PalletTown.asm +++ b/data/mapHeaders/PalletTown.asm @@ -1,10 +1,5 @@ -PalletTown_h:: - db OVERWORLD ; tileset - db PALLET_TOWN_HEIGHT, PALLET_TOWN_WIDTH ; dimensions (y, x) - dw PalletTown_Blocks ; blocks - dw PalletTown_TextPointers ; texts - dw PalletTown_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION PALLET_TOWN, ROUTE_1, 0, 0, Route1_Blocks - SOUTH_MAP_CONNECTION PALLET_TOWN, ROUTE_21, 0, 0, Route21_Blocks, 1 - dw PalletTown_Object ; objects + + map_header PalletTown, PALLET_TOWN, OVERWORLD, NORTH | SOUTH + connection north, Route1, ROUTE_1, 0 + connection south, Route21, ROUTE_21, 0 + end_map_header diff --git a/data/mapHeaders/PewterCity.asm b/data/mapHeaders/PewterCity.asm index 17d1d2f3..268adb7a 100755 --- a/data/mapHeaders/PewterCity.asm +++ b/data/mapHeaders/PewterCity.asm @@ -1,10 +1,5 @@ -PewterCity_h:: - db OVERWORLD ; tileset - db PEWTER_CITY_HEIGHT, PEWTER_CITY_WIDTH ; dimensions (y, x) - dw PewterCity_Blocks ; blocks - dw PewterCity_TextPointers ; texts - dw PewterCity_Script ; scripts - db SOUTH | EAST ; connections - SOUTH_MAP_CONNECTION PEWTER_CITY, ROUTE_2, 5, 0, Route2_Blocks - EAST_MAP_CONNECTION PEWTER_CITY, ROUTE_3, 4, 0, Route3_Blocks - dw PewterCity_Object ; objects + + map_header PewterCity, PEWTER_CITY, OVERWORLD, SOUTH | EAST + connection south, Route2, ROUTE_2, 5 + connection east, Route3, ROUTE_3, 4 + end_map_header diff --git a/data/mapHeaders/PewterGym.asm b/data/mapHeaders/PewterGym.asm index 94cdd401..a1659e42 100755 --- a/data/mapHeaders/PewterGym.asm +++ b/data/mapHeaders/PewterGym.asm @@ -1,8 +1,3 @@ -PewterGym_h:: - db GYM ; tileset - db PEWTER_GYM_HEIGHT, PEWTER_GYM_WIDTH ; dimensions (y, x) - dw PewterGym_Blocks ; blocks - dw PewterGym_TextPointers ; texts - dw PewterGym_Script ; scripts - db 0 ; connections - dw PewterGym_Object ; objects + + map_header PewterGym, PEWTER_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/PewterMart.asm b/data/mapHeaders/PewterMart.asm index 962634f4..c9b24eb2 100755 --- a/data/mapHeaders/PewterMart.asm +++ b/data/mapHeaders/PewterMart.asm @@ -1,8 +1,3 @@ -PewterMart_h:: - db MART ; tileset - db PEWTER_MART_HEIGHT, PEWTER_MART_WIDTH ; dimensions (y, x) - dw PewterMart_Blocks ; blocks - dw PewterMart_TextPointers ; texts - dw PewterMart_Script ; scripts - db 0 ; connections - dw PewterMart_Object ; objects + + map_header PewterMart, PEWTER_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/PewterNidoranHouse.asm b/data/mapHeaders/PewterNidoranHouse.asm index 9900360b..ee2e46ca 100755 --- a/data/mapHeaders/PewterNidoranHouse.asm +++ b/data/mapHeaders/PewterNidoranHouse.asm @@ -1,8 +1,3 @@ -PewterNidoranHouse_h:: - db HOUSE ; tileset - db PEWTER_NIDORAN_HOUSE_HEIGHT, PEWTER_NIDORAN_HOUSE_WIDTH ; dimensions (y, x) - dw PewterNidoranHouse_Blocks ; blocks - dw PewterNidoranHouse_TextPointers ; texts - dw PewterNidoranHouse_Script ; scripts - db 0 ; connections - dw PewterNidoranHouse_Object ; objects + + map_header PewterNidoranHouse, PEWTER_NIDORAN_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/PewterPokecenter.asm b/data/mapHeaders/PewterPokecenter.asm index 5738cb64..4e420bf8 100755 --- a/data/mapHeaders/PewterPokecenter.asm +++ b/data/mapHeaders/PewterPokecenter.asm @@ -1,8 +1,3 @@ -PewterPokecenter_h:: - db POKECENTER ; tileset - db PEWTER_POKECENTER_HEIGHT, PEWTER_POKECENTER_WIDTH ; dimensions (y, x) - dw PewterPokecenter_Blocks ; blocks - dw PewterPokecenter_TextPointers ; texts - dw PewterPokecenter_Script ; scripts - db 0 ; connections - dw PewterPokecenter_Object ; objects + + map_header PewterPokecenter, PEWTER_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/PewterSpeechHouse.asm b/data/mapHeaders/PewterSpeechHouse.asm index 9cc2d360..a378d61e 100755 --- a/data/mapHeaders/PewterSpeechHouse.asm +++ b/data/mapHeaders/PewterSpeechHouse.asm @@ -1,8 +1,3 @@ -PewterSpeechHouse_h:: - db HOUSE ; tileset - db PEWTER_SPEECH_HOUSE_HEIGHT, PEWTER_SPEECH_HOUSE_WIDTH ; dimensions (y, x) - dw PewterSpeechHouse_Blocks ; blocks - dw PewterSpeechHouse_TextPointers ; texts - dw PewterSpeechHouse_Script ; scripts - db 0 ; connections - dw PewterSpeechHouse_Object ; objects + + map_header PewterSpeechHouse, PEWTER_SPEECH_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/PokemonFanClub.asm b/data/mapHeaders/PokemonFanClub.asm index 251ac2c4..b4ff8e1c 100755 --- a/data/mapHeaders/PokemonFanClub.asm +++ b/data/mapHeaders/PokemonFanClub.asm @@ -1,8 +1,3 @@ -PokemonFanClub_h:: - db INTERIOR ; tileset - db POKEMON_FAN_CLUB_HEIGHT, POKEMON_FAN_CLUB_WIDTH ; dimensions (y, x) - dw PokemonFanClub_Blocks ; blocks - dw PokemonFanClub_TextPointers ; texts - dw PokemonFanClub_Script ; scripts - db 0 ; connections - dw PokemonFanClub_Object ; objects + + map_header PokemonFanClub, POKEMON_FAN_CLUB, INTERIOR, 0 + end_map_header diff --git a/data/mapHeaders/PokemonMansion1F.asm b/data/mapHeaders/PokemonMansion1F.asm index b3bebb5f..9407f956 100755 --- a/data/mapHeaders/PokemonMansion1F.asm +++ b/data/mapHeaders/PokemonMansion1F.asm @@ -1,8 +1,3 @@ -PokemonMansion1F_h:: - db FACILITY ; tileset - db POKEMON_MANSION_1F_HEIGHT, POKEMON_MANSION_1F_WIDTH ; dimensions (y, x) - dw PokemonMansion1F_Blocks ; blocks - dw PokemonMansion1F_TextPointers ; texts - dw PokemonMansion1F_Script ; scripts - db 0 ; connections - dw PokemonMansion1F_Object ; objects + + map_header PokemonMansion1F, POKEMON_MANSION_1F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonMansion2F.asm b/data/mapHeaders/PokemonMansion2F.asm index d532db2a..deb7c84f 100755 --- a/data/mapHeaders/PokemonMansion2F.asm +++ b/data/mapHeaders/PokemonMansion2F.asm @@ -1,8 +1,3 @@ -PokemonMansion2F_h:: - db FACILITY ; tileset - db POKEMON_MANSION_2F_HEIGHT, POKEMON_MANSION_2F_WIDTH ; dimensions (y, x) - dw PokemonMansion2F_Blocks ; blocks - dw PokemonMansion2F_TextPointers ; texts - dw PokemonMansion2F_Script ; scripts - db 0 ; connections - dw PokemonMansion2F_Object ; objects + + map_header PokemonMansion2F, POKEMON_MANSION_2F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonMansion3F.asm b/data/mapHeaders/PokemonMansion3F.asm index e8887551..e4baa709 100755 --- a/data/mapHeaders/PokemonMansion3F.asm +++ b/data/mapHeaders/PokemonMansion3F.asm @@ -1,8 +1,3 @@ -PokemonMansion3F_h:: - db FACILITY ; tileset - db POKEMON_MANSION_3F_HEIGHT, POKEMON_MANSION_3F_WIDTH ; dimensions (y, x) - dw PokemonMansion3F_Blocks ; blocks - dw PokemonMansion3F_TextPointers ; texts - dw PokemonMansion3F_Script ; scripts - db 0 ; connections - dw PokemonMansion3F_Object ; objects + + map_header PokemonMansion3F, POKEMON_MANSION_3F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonMansionB1F.asm b/data/mapHeaders/PokemonMansionB1F.asm index 08ec13f4..0aae67e6 100755 --- a/data/mapHeaders/PokemonMansionB1F.asm +++ b/data/mapHeaders/PokemonMansionB1F.asm @@ -1,8 +1,3 @@ -PokemonMansionB1F_h:: - db FACILITY ; tileset - db POKEMON_MANSION_B1F_HEIGHT, POKEMON_MANSION_B1F_WIDTH ; dimensions (y, x) - dw PokemonMansionB1F_Blocks ; blocks - dw PokemonMansionB1F_TextPointers ; texts - dw PokemonMansionB1F_Script ; scripts - db 0 ; connections - dw PokemonMansionB1F_Object ; objects + + map_header PokemonMansionB1F, POKEMON_MANSION_B1F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower1F.asm b/data/mapHeaders/PokemonTower1F.asm index 99b129e8..185fd2c0 100755 --- a/data/mapHeaders/PokemonTower1F.asm +++ b/data/mapHeaders/PokemonTower1F.asm @@ -1,8 +1,3 @@ -PokemonTower1F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_1F_HEIGHT, POKEMON_TOWER_1F_WIDTH ; dimensions (y, x) - dw PokemonTower1F_Blocks ; blocks - dw PokemonTower1F_TextPointers ; texts - dw PokemonTower1F_Script ; scripts - db 0 ; connections - dw PokemonTower1F_Object ; objects + + map_header PokemonTower1F, POKEMON_TOWER_1F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower2F.asm b/data/mapHeaders/PokemonTower2F.asm index ce0ea13d..5a6046c8 100755 --- a/data/mapHeaders/PokemonTower2F.asm +++ b/data/mapHeaders/PokemonTower2F.asm @@ -1,8 +1,3 @@ -PokemonTower2F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_2F_HEIGHT, POKEMON_TOWER_2F_WIDTH ; dimensions (y, x) - dw PokemonTower2F_Blocks ; blocks - dw PokemonTower2F_TextPointers ; texts - dw PokemonTower2F_Script ; scripts - db 0 ; connections - dw PokemonTower2F_Object ; objects + + map_header PokemonTower2F, POKEMON_TOWER_2F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower3F.asm b/data/mapHeaders/PokemonTower3F.asm index a495b30f..49ebc4e7 100755 --- a/data/mapHeaders/PokemonTower3F.asm +++ b/data/mapHeaders/PokemonTower3F.asm @@ -1,8 +1,3 @@ -PokemonTower3F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_3F_HEIGHT, POKEMON_TOWER_3F_WIDTH ; dimensions (y, x) - dw PokemonTower3F_Blocks ; blocks - dw PokemonTower3F_TextPointers ; texts - dw PokemonTower3F_Script ; scripts - db 0 ; connections - dw PokemonTower3F_Object ; objects + + map_header PokemonTower3F, POKEMON_TOWER_3F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower4F.asm b/data/mapHeaders/PokemonTower4F.asm index b6932406..0eb9a0d6 100755 --- a/data/mapHeaders/PokemonTower4F.asm +++ b/data/mapHeaders/PokemonTower4F.asm @@ -1,8 +1,3 @@ -PokemonTower4F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_4F_HEIGHT, POKEMON_TOWER_4F_WIDTH ; dimensions (y, x) - dw PokemonTower4F_Blocks ; blocks - dw PokemonTower4F_TextPointers ; texts - dw PokemonTower4F_Script ; scripts - db 0 ; connections - dw PokemonTower4F_Object ; objects + + map_header PokemonTower4F, POKEMON_TOWER_4F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower5F.asm b/data/mapHeaders/PokemonTower5F.asm index f51e6990..e58c63c6 100755 --- a/data/mapHeaders/PokemonTower5F.asm +++ b/data/mapHeaders/PokemonTower5F.asm @@ -1,8 +1,3 @@ -PokemonTower5F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_5F_HEIGHT, POKEMON_TOWER_5F_WIDTH ; dimensions (y, x) - dw PokemonTower5F_Blocks ; blocks - dw PokemonTower5F_TextPointers ; texts - dw PokemonTower5F_Script ; scripts - db 0 ; connections - dw PokemonTower5F_Object ; objects + + map_header PokemonTower5F, POKEMON_TOWER_5F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower6F.asm b/data/mapHeaders/PokemonTower6F.asm index 5fa1a035..ba53347b 100755 --- a/data/mapHeaders/PokemonTower6F.asm +++ b/data/mapHeaders/PokemonTower6F.asm @@ -1,8 +1,3 @@ -PokemonTower6F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_6F_HEIGHT, POKEMON_TOWER_6F_WIDTH ; dimensions (y, x) - dw PokemonTower6F_Blocks ; blocks - dw PokemonTower6F_TextPointers ; texts - dw PokemonTower6F_Script ; scripts - db 0 ; connections - dw PokemonTower6F_Object ; objects + + map_header PokemonTower6F, POKEMON_TOWER_6F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PokemonTower7F.asm b/data/mapHeaders/PokemonTower7F.asm index 90fc1d8b..bd9f839b 100755 --- a/data/mapHeaders/PokemonTower7F.asm +++ b/data/mapHeaders/PokemonTower7F.asm @@ -1,8 +1,3 @@ -PokemonTower7F_h:: - db CEMETERY ; tileset - db POKEMON_TOWER_7F_HEIGHT, POKEMON_TOWER_7F_WIDTH ; dimensions (y, x) - dw PokemonTower7F_Blocks ; blocks - dw PokemonTower7F_TextPointers ; texts - dw PokemonTower7F_Script ; scripts - db 0 ; connections - dw PokemonTower7F_Object ; objects + + map_header PokemonTower7F, POKEMON_TOWER_7F, CEMETERY, 0 + end_map_header diff --git a/data/mapHeaders/PowerPlant.asm b/data/mapHeaders/PowerPlant.asm index 3cb4efcd..88d82ae2 100755 --- a/data/mapHeaders/PowerPlant.asm +++ b/data/mapHeaders/PowerPlant.asm @@ -1,8 +1,3 @@ -PowerPlant_h:: - db FACILITY ; tileset - db POWER_PLANT_HEIGHT, POWER_PLANT_WIDTH ; dimensions (y, x) - dw PowerPlant_Blocks ; blocks - dw PowerPlant_TextPointers ; texts - dw PowerPlant_Script ; scripts - db 0 ; connections - dw PowerPlant_Object ; objects + + map_header PowerPlant, POWER_PLANT, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/RedsHouse1F.asm b/data/mapHeaders/RedsHouse1F.asm index b13008ae..018bdc80 100755 --- a/data/mapHeaders/RedsHouse1F.asm +++ b/data/mapHeaders/RedsHouse1F.asm @@ -1,8 +1,3 @@ -RedsHouse1F_h:: - db REDS_HOUSE_1 ; tileset - db REDS_HOUSE_1F_HEIGHT, REDS_HOUSE_1F_WIDTH ; dimensions (y, x) - dw RedsHouse1F_Blocks ; blocks - dw RedsHouse1F_TextPointers ; texts - dw RedsHouse1F_Script ; scripts - db 0 ; connections - dw RedsHouse1F_Object ; objects + + map_header RedsHouse1F, REDS_HOUSE_1F, REDS_HOUSE_1, 0 + end_map_header diff --git a/data/mapHeaders/RedsHouse2F.asm b/data/mapHeaders/RedsHouse2F.asm index 8824ebf2..10332e2c 100755 --- a/data/mapHeaders/RedsHouse2F.asm +++ b/data/mapHeaders/RedsHouse2F.asm @@ -1,8 +1,3 @@ -RedsHouse2F_h:: - db REDS_HOUSE_2 ; tileset - db REDS_HOUSE_2F_HEIGHT, REDS_HOUSE_2F_WIDTH ; dimensions (y, x) - dw RedsHouse2F_Blocks ; blocks - dw RedsHouse2F_TextPointers ; texts - dw RedsHouse2F_Script ; scripts - db $00 ; connections - dw RedsHouse2F_Object ; objects + + map_header RedsHouse2F, REDS_HOUSE_2F, REDS_HOUSE_2, $00 + end_map_header diff --git a/data/mapHeaders/RockTunnel1F.asm b/data/mapHeaders/RockTunnel1F.asm index 8dd5929b..268ee645 100755 --- a/data/mapHeaders/RockTunnel1F.asm +++ b/data/mapHeaders/RockTunnel1F.asm @@ -1,8 +1,3 @@ -RockTunnel1F_h:: - db CAVERN ; tileset - db ROCK_TUNNEL_1F_HEIGHT, ROCK_TUNNEL_1F_WIDTH ; dimensions (y, x) - dw RockTunnel1F_Blocks ; blocks - dw RockTunnel1F_TextPointers ; texts - dw RockTunnel1F_Script ; scripts - db 0 ; connections - dw RockTunnel1F_Object ; objects + + map_header RockTunnel1F, ROCK_TUNNEL_1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/RockTunnelB1F.asm b/data/mapHeaders/RockTunnelB1F.asm index 36cd7f37..7b13f647 100755 --- a/data/mapHeaders/RockTunnelB1F.asm +++ b/data/mapHeaders/RockTunnelB1F.asm @@ -1,8 +1,3 @@ -RockTunnelB1F_h:: - db CAVERN ; tileset - db ROCK_TUNNEL_B1F_HEIGHT, ROCK_TUNNEL_B1F_WIDTH ; dimensions (y, x) - dw RockTunnelB1F_Blocks ; blocks - dw RockTunnelB1F_TextPointers ; texts - dw RockTunnelB1F_Script ; scripts - db 0 ; connections - dw RockTunnelB1F_Object ; objects + + map_header RockTunnelB1F, ROCK_TUNNEL_B1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/RockTunnelPokecenter.asm b/data/mapHeaders/RockTunnelPokecenter.asm index 3d0bbed0..a873854b 100755 --- a/data/mapHeaders/RockTunnelPokecenter.asm +++ b/data/mapHeaders/RockTunnelPokecenter.asm @@ -1,8 +1,3 @@ -RockTunnelPokecenter_h:: - db POKECENTER ; tileset - db ROCK_TUNNEL_POKECENTER_HEIGHT, ROCK_TUNNEL_POKECENTER_WIDTH ; dimensions (y, x) - dw RockTunnelPokecenter_Blocks ; blocks - dw RockTunnelPokecenter_TextPointers ; texts - dw RockTunnelPokecenter_Script ; scripts - db 0 ; connections - dw RockTunnelPokecenter_Object ; objects + + map_header RockTunnelPokecenter, ROCK_TUNNEL_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/RocketHideoutB1F.asm b/data/mapHeaders/RocketHideoutB1F.asm index 4d875a1b..521a6693 100755 --- a/data/mapHeaders/RocketHideoutB1F.asm +++ b/data/mapHeaders/RocketHideoutB1F.asm @@ -1,8 +1,3 @@ -RocketHideoutB1F_h:: - db FACILITY ; tileset - db ROCKET_HIDEOUT_B1F_HEIGHT, ROCKET_HIDEOUT_B1F_WIDTH ; dimensions (y, x) - dw RocketHideoutB1F_Blocks ; blocks - dw RocketHideoutB1F_TextPointers ; texts - dw RocketHideoutB1F_Script ; scripts - db 0 ; connections - dw RocketHideoutB1F_Object ; objects + + map_header RocketHideoutB1F, ROCKET_HIDEOUT_B1F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/RocketHideoutB2F.asm b/data/mapHeaders/RocketHideoutB2F.asm index 0d56f2a1..ab2a965d 100755 --- a/data/mapHeaders/RocketHideoutB2F.asm +++ b/data/mapHeaders/RocketHideoutB2F.asm @@ -1,8 +1,3 @@ -RocketHideoutB2F_h:: - db FACILITY ; tileset - db ROCKET_HIDEOUT_B2F_HEIGHT, ROCKET_HIDEOUT_B2F_WIDTH ; dimensions (y, x) - dw RocketHideoutB2F_Blocks ; blocks - dw RocketHideoutB2F_TextPointers ; texts - dw RocketHideoutB2F_Script ; scripts - db 0 ; connections - dw RocketHideoutB2F_Object ; objects + + map_header RocketHideoutB2F, ROCKET_HIDEOUT_B2F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/RocketHideoutB3F.asm b/data/mapHeaders/RocketHideoutB3F.asm index e71fcff1..0a04b00e 100755 --- a/data/mapHeaders/RocketHideoutB3F.asm +++ b/data/mapHeaders/RocketHideoutB3F.asm @@ -1,8 +1,3 @@ -RocketHideoutB3F_h:: - db FACILITY ; tileset - db ROCKET_HIDEOUT_B3F_HEIGHT, ROCKET_HIDEOUT_B3F_WIDTH ; dimensions (y, x) - dw RocketHideoutB3F_Blocks ; blocks - dw RocketHideoutB3F_TextPointers ; texts - dw RocketHideoutB3F_Script ; scripts - db 0 ; connections - dw RocketHideoutB3F_Object ; objects + + map_header RocketHideoutB3F, ROCKET_HIDEOUT_B3F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/RocketHideoutB4F.asm b/data/mapHeaders/RocketHideoutB4F.asm index 05ad471a..11512c01 100755 --- a/data/mapHeaders/RocketHideoutB4F.asm +++ b/data/mapHeaders/RocketHideoutB4F.asm @@ -1,8 +1,3 @@ -RocketHideoutB4F_h:: - db FACILITY ; tileset - db ROCKET_HIDEOUT_B4F_HEIGHT, ROCKET_HIDEOUT_B4F_WIDTH ; dimensions (y, x) - dw RocketHideoutB4F_Blocks ; blocks - dw RocketHideoutB4F_TextPointers ; texts - dw RocketHideoutB4F_Script ; scripts - db 0 ; connections - dw RocketHideoutB4F_Object ; objects + + map_header RocketHideoutB4F, ROCKET_HIDEOUT_B4F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/RocketHideoutElevator.asm b/data/mapHeaders/RocketHideoutElevator.asm index 6221dddd..90ece237 100755 --- a/data/mapHeaders/RocketHideoutElevator.asm +++ b/data/mapHeaders/RocketHideoutElevator.asm @@ -1,8 +1,3 @@ -RocketHideoutElevator_h:: - db LOBBY ; tileset - db ROCKET_HIDEOUT_ELEVATOR_HEIGHT, ROCKET_HIDEOUT_ELEVATOR_WIDTH ; dimensions (y, x) - dw RocketHideoutElevator_Blocks ; blocks - dw RocketHideoutElevator_TextPointers ; texts - dw RocketHideoutElevator_Script ; scripts - db 0 ; connections - dw RocketHideoutElevator_Object ; objects + + map_header RocketHideoutElevator, ROCKET_HIDEOUT_ELEVATOR, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/Route1.asm b/data/mapHeaders/Route1.asm index 20d389ab..6eeb0347 100755 --- a/data/mapHeaders/Route1.asm +++ b/data/mapHeaders/Route1.asm @@ -1,10 +1,5 @@ -Route1_h:: - db OVERWORLD ; tileset - db ROUTE_1_HEIGHT, ROUTE_1_WIDTH ; dimensions (y, x) - dw Route1_Blocks ; blocks - dw Route1_TextPointers ; texts - dw Route1_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_1, VIRIDIAN_CITY, -3, 2, ViridianCity_Blocks - SOUTH_MAP_CONNECTION ROUTE_1, PALLET_TOWN, 0, 0, PalletTown_Blocks, 1 - dw Route1_Object ; objects + + map_header Route1, ROUTE_1, OVERWORLD, NORTH | SOUTH + connection north, ViridianCity, VIRIDIAN_CITY, -5 + connection south, PalletTown, PALLET_TOWN, 0 + end_map_header diff --git a/data/mapHeaders/Route10.asm b/data/mapHeaders/Route10.asm index 5759483b..ba498b0a 100755 --- a/data/mapHeaders/Route10.asm +++ b/data/mapHeaders/Route10.asm @@ -1,10 +1,5 @@ -Route10_h:: - db OVERWORLD ; tileset - db ROUTE_10_HEIGHT, ROUTE_10_WIDTH ; dimensions (y, x) - dw Route10_Blocks ; blocks - dw Route10_TextPointers ; texts - dw Route10_Script ; scripts - db SOUTH | WEST ; connections - SOUTH_MAP_CONNECTION ROUTE_10, LAVENDER_TOWN, 0, 0, LavenderTown_Blocks - WEST_MAP_CONNECTION ROUTE_10, ROUTE_9, 0, 0, Route9_Blocks - dw Route10_Object ; objects + + map_header Route10, ROUTE_10, OVERWORLD, SOUTH | WEST + connection south, LavenderTown, LAVENDER_TOWN, 0 + connection west, Route9, ROUTE_9, 0 + end_map_header diff --git a/data/mapHeaders/Route11.asm b/data/mapHeaders/Route11.asm index 6b95cebc..d8f2e72f 100755 --- a/data/mapHeaders/Route11.asm +++ b/data/mapHeaders/Route11.asm @@ -1,10 +1,5 @@ -Route11_h:: - db OVERWORLD ; tileset - db ROUTE_11_HEIGHT, ROUTE_11_WIDTH ; dimensions (y, x) - dw Route11_Blocks ; blocks - dw Route11_TextPointers ; texts - dw Route11_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_11, VERMILION_CITY, -3, 1, VermilionCity_Blocks - EAST_MAP_CONNECTION ROUTE_11, ROUTE_12, -3, 24, Route12_Blocks, 1 - dw Route11_Object ; objects + + map_header Route11, ROUTE_11, OVERWORLD, WEST | EAST + connection west, VermilionCity, VERMILION_CITY, -4 + connection east, Route12, ROUTE_12, -27 + end_map_header diff --git a/data/mapHeaders/Route11Gate1F.asm b/data/mapHeaders/Route11Gate1F.asm index 0f26b117..aa97b791 100755 --- a/data/mapHeaders/Route11Gate1F.asm +++ b/data/mapHeaders/Route11Gate1F.asm @@ -1,8 +1,3 @@ -Route11Gate1F_h:: - db GATE ; tileset - db ROUTE_11_GATE_1F_HEIGHT, ROUTE_11_GATE_1F_WIDTH ; dimensions (y, x) - dw Route11Gate1F_Blocks ; blocks - dw Route11Gate1F_TextPointers ; texts - dw Route11Gate1F_Script ; scripts - db 0 ; connections - dw Route11Gate1F_Object ; objects + + map_header Route11Gate1F, ROUTE_11_GATE_1F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route11Gate2F.asm b/data/mapHeaders/Route11Gate2F.asm index b408b5a7..560d38db 100755 --- a/data/mapHeaders/Route11Gate2F.asm +++ b/data/mapHeaders/Route11Gate2F.asm @@ -1,8 +1,3 @@ -Route11Gate2F_h:: - db GATE ; tileset - db ROUTE_11_GATE_2F_HEIGHT, ROUTE_11_GATE_2F_WIDTH ; dimensions (y, x) - dw Route11Gate2F_Blocks ; blocks - dw Route11Gate2F_TextPointers ; texts - dw Route11Gate2F_Script ; scripts - db 0 ; connections - dw Route11Gate2F_Object ; objects + + map_header Route11Gate2F, ROUTE_11_GATE_2F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route12.asm b/data/mapHeaders/Route12.asm index 284105fa..931ddf1d 100755 --- a/data/mapHeaders/Route12.asm +++ b/data/mapHeaders/Route12.asm @@ -1,11 +1,6 @@ -Route12_h:: - db OVERWORLD ; tileset - db ROUTE_12_HEIGHT, ROUTE_12_WIDTH ; dimensions (y, x) - dw Route12_Blocks ; blocks - dw Route12_TextPointers ; texts - dw Route12_Script ; scripts - db NORTH | SOUTH | WEST ; connections - NORTH_MAP_CONNECTION ROUTE_12, LAVENDER_TOWN, 0, 0, LavenderTown_Blocks - SOUTH_MAP_CONNECTION ROUTE_12, ROUTE_13, -3, 17, Route13_Blocks - WEST_MAP_CONNECTION ROUTE_12, ROUTE_11, 27, 0, Route11_Blocks - dw Route12_Object ; objects + + map_header Route12, ROUTE_12, OVERWORLD, NORTH | SOUTH | WEST + connection north, LavenderTown, LAVENDER_TOWN, 0 + connection south, Route13, ROUTE_13, -20 + connection west, Route11, ROUTE_11, 27 + end_map_header diff --git a/data/mapHeaders/Route12Gate1F.asm b/data/mapHeaders/Route12Gate1F.asm index dbce0ab9..047a670c 100755 --- a/data/mapHeaders/Route12Gate1F.asm +++ b/data/mapHeaders/Route12Gate1F.asm @@ -1,8 +1,3 @@ -Route12Gate1F_h:: - db GATE ; tileset - db ROUTE_12_GATE_1F_HEIGHT, ROUTE_12_GATE_1F_WIDTH ; dimensions (y, x) - dw Route12Gate1F_Blocks ; blocks - dw Route12Gate1F_TextPointers ; texts - dw Route12Gate1F_Script ; scripts - db 0 ; connections - dw Route12Gate1F_Object ; objects + + map_header Route12Gate1F, ROUTE_12_GATE_1F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route12Gate2F.asm b/data/mapHeaders/Route12Gate2F.asm index f4e2330d..e1366736 100755 --- a/data/mapHeaders/Route12Gate2F.asm +++ b/data/mapHeaders/Route12Gate2F.asm @@ -1,8 +1,3 @@ -Route12Gate2F_h:: - db GATE ; tileset - db ROUTE_12_GATE_2F_HEIGHT, ROUTE_12_GATE_2F_WIDTH ; dimensions (y, x) - dw Route12Gate2F_Blocks ; blocks - dw Route12Gate2F_TextPointers ; texts - dw Route12Gate2F_Script ; scripts - db 0 ; connections - dw Route12Gate2F_Object ; objects + + map_header Route12Gate2F, ROUTE_12_GATE_2F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route12SuperRodHouse.asm b/data/mapHeaders/Route12SuperRodHouse.asm index 70357a3a..2195a9b1 100755 --- a/data/mapHeaders/Route12SuperRodHouse.asm +++ b/data/mapHeaders/Route12SuperRodHouse.asm @@ -1,8 +1,3 @@ -Route12SuperRodHouse_h:: - db HOUSE ; tileset - db ROUTE_12_SUPER_ROD_HOUSE_HEIGHT, ROUTE_12_SUPER_ROD_HOUSE_WIDTH ; dimensions (y, x) - dw Route12SuperRodHouse_Blocks ; blocks - dw Route12SuperRodHouse_TextPointers ; texts - dw Route12SuperRodHouse_Script ; scripts - db 0 ; connections - dw Route12SuperRodHouse_Object ; objects + + map_header Route12SuperRodHouse, ROUTE_12_SUPER_ROD_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/Route13.asm b/data/mapHeaders/Route13.asm index fb85dd60..242aaa02 100755 --- a/data/mapHeaders/Route13.asm +++ b/data/mapHeaders/Route13.asm @@ -1,10 +1,5 @@ -Route13_h:: - db OVERWORLD ; tileset - db ROUTE_13_HEIGHT, ROUTE_13_WIDTH ; dimensions (y, x) - dw Route13_Blocks ; blocks - dw Route13_TextPointers ; texts - dw Route13_Script ; scripts - db NORTH | WEST ; connections - NORTH_MAP_CONNECTION ROUTE_13, ROUTE_12, 20, 0, Route12_Blocks - WEST_MAP_CONNECTION ROUTE_13, ROUTE_14, 0, 0, Route14_Blocks - dw Route13_Object ; objects + + map_header Route13, ROUTE_13, OVERWORLD, NORTH | WEST + connection north, Route12, ROUTE_12, 20 + connection west, Route14, ROUTE_14, 0 + end_map_header diff --git a/data/mapHeaders/Route14.asm b/data/mapHeaders/Route14.asm index d1484f6b..c0c39c56 100755 --- a/data/mapHeaders/Route14.asm +++ b/data/mapHeaders/Route14.asm @@ -1,10 +1,5 @@ -Route14_h:: - db OVERWORLD ; tileset - db ROUTE_14_HEIGHT, ROUTE_14_WIDTH ; dimensions (y, x) - dw Route14_Blocks ; blocks - dw Route14_TextPointers ; texts - dw Route14_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_14, ROUTE_15, 18, 0, Route15_Blocks - EAST_MAP_CONNECTION ROUTE_14, ROUTE_13, 0, 0, Route13_Blocks - dw Route14_Object ; objects + + map_header Route14, ROUTE_14, OVERWORLD, WEST | EAST + connection west, Route15, ROUTE_15, 18 + connection east, Route13, ROUTE_13, 0 + end_map_header diff --git a/data/mapHeaders/Route15.asm b/data/mapHeaders/Route15.asm index 5f66a521..28a811d2 100755 --- a/data/mapHeaders/Route15.asm +++ b/data/mapHeaders/Route15.asm @@ -1,10 +1,5 @@ -Route15_h:: - db OVERWORLD ; tileset - db ROUTE_15_HEIGHT, ROUTE_15_WIDTH ; dimensions (y, x) - dw Route15_Blocks ; blocks - dw Route15_TextPointers ; texts - dw Route15_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_15, FUCHSIA_CITY, -3, 1, FuchsiaCity_Blocks - EAST_MAP_CONNECTION ROUTE_15, ROUTE_14, -3, 15, Route14_Blocks - dw Route15_Object ; objects + + map_header Route15, ROUTE_15, OVERWORLD, WEST | EAST + connection west, FuchsiaCity, FUCHSIA_CITY, -4 + connection east, Route14, ROUTE_14, -18 + end_map_header diff --git a/data/mapHeaders/Route15Gate1F.asm b/data/mapHeaders/Route15Gate1F.asm index d3f5a377..a23d15a0 100755 --- a/data/mapHeaders/Route15Gate1F.asm +++ b/data/mapHeaders/Route15Gate1F.asm @@ -1,8 +1,3 @@ -Route15Gate1F_h:: - db GATE ; tileset - db ROUTE_15_GATE_1F_HEIGHT, ROUTE_15_GATE_1F_WIDTH ; dimensions (y, x) - dw Route15Gate1F_Blocks ; blocks - dw Route15Gate1F_TextPointers ; texts - dw Route15Gate1F_Script ; scripts - db 0 ; connections - dw Route15Gate1F_Object ; objects + + map_header Route15Gate1F, ROUTE_15_GATE_1F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route15Gate2F.asm b/data/mapHeaders/Route15Gate2F.asm index 87b05105..8ca89872 100755 --- a/data/mapHeaders/Route15Gate2F.asm +++ b/data/mapHeaders/Route15Gate2F.asm @@ -1,8 +1,3 @@ -Route15Gate2F_h:: - db GATE ; tileset - db ROUTE_15_GATE_2F_HEIGHT, ROUTE_15_GATE_2F_WIDTH ; dimensions (y, x) - dw Route15Gate2F_Blocks ; blocks - dw Route15Gate2F_TextPointers ; texts - dw Route15Gate2F_Script ; scripts - db 0 ; connections - dw Route15Gate2F_Object ; objects + + map_header Route15Gate2F, ROUTE_15_GATE_2F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route16.asm b/data/mapHeaders/Route16.asm index be436134..423c7af2 100755 --- a/data/mapHeaders/Route16.asm +++ b/data/mapHeaders/Route16.asm @@ -1,10 +1,5 @@ -Route16_h:: - db OVERWORLD ; tileset - db ROUTE_16_HEIGHT, ROUTE_16_WIDTH ; dimensions (y, x) - dw Route16_Blocks ; blocks - dw Route16_TextPointers ; texts - dw Route16_Script ; scripts - db SOUTH | EAST ; connections - SOUTH_MAP_CONNECTION ROUTE_16, ROUTE_17, 0, 0, Route17_Blocks - EAST_MAP_CONNECTION ROUTE_16, CELADON_CITY, -3, 1, CeladonCity_Blocks, 1 - dw Route16_Object ; objects + + map_header Route16, ROUTE_16, OVERWORLD, SOUTH | EAST + connection south, Route17, ROUTE_17, 0 + connection east, CeladonCity, CELADON_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route16FlyHouse.asm b/data/mapHeaders/Route16FlyHouse.asm index 6bc41d1d..240b6df4 100755 --- a/data/mapHeaders/Route16FlyHouse.asm +++ b/data/mapHeaders/Route16FlyHouse.asm @@ -1,8 +1,3 @@ -Route16FlyHouse_h:: - db HOUSE ; tileset - db ROUTE_16_FLY_HOUSE_HEIGHT, ROUTE_16_FLY_HOUSE_WIDTH ; dimensions (y, x) - dw Route16FlyHouse_Blocks ; blocks - dw Route16FlyHouse_TextPointers ; texts - dw Route16FlyHouse_Script ; scripts - db 0 ; connections - dw Route16FlyHouse_Object ; objects + + map_header Route16FlyHouse, ROUTE_16_FLY_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/Route16Gate1F.asm b/data/mapHeaders/Route16Gate1F.asm index 16bbb30b..74fd1b7f 100755 --- a/data/mapHeaders/Route16Gate1F.asm +++ b/data/mapHeaders/Route16Gate1F.asm @@ -1,8 +1,3 @@ -Route16Gate1F_h:: - db GATE ; tileset - db ROUTE_16_GATE_1F_HEIGHT, ROUTE_16_GATE_1F_WIDTH ; dimensions (y, x) - dw Route16Gate1F_Blocks ; blocks - dw Route16Gate1F_TextPointers ; texts - dw Route16Gate1F_Script ; scripts - db 0 ; connections - dw Route16Gate1F_Object ; objects + + map_header Route16Gate1F, ROUTE_16_GATE_1F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route16Gate2F.asm b/data/mapHeaders/Route16Gate2F.asm index 600101c9..ed889f4b 100755 --- a/data/mapHeaders/Route16Gate2F.asm +++ b/data/mapHeaders/Route16Gate2F.asm @@ -1,8 +1,3 @@ -Route16Gate2F_h:: - db GATE ; tileset - db ROUTE_16_GATE_2F_HEIGHT, ROUTE_16_GATE_2F_WIDTH ; dimensions (y, x) - dw Route16Gate2F_Blocks ; blocks - dw Route16Gate2F_TextPointers ; texts - dw Route16Gate2F_Script ; scripts - db 0 ; connections - dw Route16Gate2F_Object ; objects + + map_header Route16Gate2F, ROUTE_16_GATE_2F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route17.asm b/data/mapHeaders/Route17.asm index 32bdb541..5e853299 100755 --- a/data/mapHeaders/Route17.asm +++ b/data/mapHeaders/Route17.asm @@ -1,10 +1,5 @@ -Route17_h:: - db OVERWORLD ; tileset - db ROUTE_17_HEIGHT, ROUTE_17_WIDTH ; dimensions (y, x) - dw Route17_Blocks ; blocks - dw Route17_TextPointers ; texts - dw Route17_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_17, ROUTE_16, 0, 0, Route16_Blocks - SOUTH_MAP_CONNECTION ROUTE_17, ROUTE_18, 0, 0, Route18_Blocks, 1 - dw Route17_Object ; objects + + map_header Route17, ROUTE_17, OVERWORLD, NORTH | SOUTH + connection north, Route16, ROUTE_16, 0 + connection south, Route18, ROUTE_18, 0 + end_map_header diff --git a/data/mapHeaders/Route18.asm b/data/mapHeaders/Route18.asm index e0b5daef..34573051 100755 --- a/data/mapHeaders/Route18.asm +++ b/data/mapHeaders/Route18.asm @@ -1,10 +1,5 @@ -Route18_h:: - db OVERWORLD ; tileset - db ROUTE_18_HEIGHT, ROUTE_18_WIDTH ; dimensions (y, x) - dw Route18_Blocks ; blocks - dw Route18_TextPointers ; texts - dw Route18_Script ; scripts - db NORTH | EAST ; connections - NORTH_MAP_CONNECTION ROUTE_18, ROUTE_17, 0, 0, Route17_Blocks - EAST_MAP_CONNECTION ROUTE_18, FUCHSIA_CITY, -3, 1, FuchsiaCity_Blocks, 1 - dw Route18_Object ; objects + + map_header Route18, ROUTE_18, OVERWORLD, NORTH | EAST + connection north, Route17, ROUTE_17, 0 + connection east, FuchsiaCity, FUCHSIA_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route18Gate1F.asm b/data/mapHeaders/Route18Gate1F.asm index d04288d5..2847e0e3 100755 --- a/data/mapHeaders/Route18Gate1F.asm +++ b/data/mapHeaders/Route18Gate1F.asm @@ -1,8 +1,3 @@ -Route18Gate1F_h:: - db GATE ; tileset - db ROUTE_18_GATE_1F_HEIGHT, ROUTE_18_GATE_1F_WIDTH ; dimensions (y, x) - dw Route18Gate1F_Blocks ; blocks - dw Route18Gate1F_TextPointers ; texts - dw Route18Gate1F_Script ; scripts - db 0 ; connections - dw Route18Gate1F_Object ; objects + + map_header Route18Gate1F, ROUTE_18_GATE_1F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route18Gate2F.asm b/data/mapHeaders/Route18Gate2F.asm index cf8c6d6a..f25fa700 100755 --- a/data/mapHeaders/Route18Gate2F.asm +++ b/data/mapHeaders/Route18Gate2F.asm @@ -1,8 +1,3 @@ -Route18Gate2F_h:: - db GATE ; tileset - db ROUTE_18_GATE_2F_HEIGHT, ROUTE_18_GATE_2F_WIDTH ; dimensions (y, x) - dw Route18Gate2F_Blocks ; blocks - dw Route18Gate2F_TextPointers ; texts - dw Route18Gate2F_Script ; scripts - db 0 ; connections - dw Route18Gate2F_Object ; objects + + map_header Route18Gate2F, ROUTE_18_GATE_2F, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route19.asm b/data/mapHeaders/Route19.asm index 2b6c8ca2..7f01c804 100755 --- a/data/mapHeaders/Route19.asm +++ b/data/mapHeaders/Route19.asm @@ -1,10 +1,5 @@ -Route19_h:: - db OVERWORLD ; tileset - db ROUTE_19_HEIGHT, ROUTE_19_WIDTH ; dimensions (y, x) - dw Route19_Blocks ; blocks - dw Route19_TextPointers ; texts - dw Route19_Script ; scripts - db NORTH | WEST ; connections - NORTH_MAP_CONNECTION ROUTE_19, FUCHSIA_CITY, -3, 2, FuchsiaCity_Blocks - WEST_MAP_CONNECTION ROUTE_19, ROUTE_20, 18, 0, Route20_Blocks - dw Route19_Object ; objects + + map_header Route19, ROUTE_19, OVERWORLD, NORTH | WEST + connection north, FuchsiaCity, FUCHSIA_CITY, -5 + connection west, Route20, ROUTE_20, 18 + end_map_header diff --git a/data/mapHeaders/Route2.asm b/data/mapHeaders/Route2.asm index 6dc96c4e..521eef69 100755 --- a/data/mapHeaders/Route2.asm +++ b/data/mapHeaders/Route2.asm @@ -1,10 +1,5 @@ -Route2_h:: - db OVERWORLD ; tileset - db ROUTE_2_HEIGHT, ROUTE_2_WIDTH ; dimensions (y, x) - dw Route2_Blocks ; blocks - dw Route2_TextPointers ; texts - dw Route2_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_2, PEWTER_CITY, -3, 2, PewterCity_Blocks - SOUTH_MAP_CONNECTION ROUTE_2, VIRIDIAN_CITY, -3, 2, ViridianCity_Blocks, 1 - dw Route2_Object ; objects + + map_header Route2, ROUTE_2, OVERWORLD, NORTH | SOUTH + connection north, PewterCity, PEWTER_CITY, -5 + connection south, ViridianCity, VIRIDIAN_CITY, -5 + end_map_header diff --git a/data/mapHeaders/Route20.asm b/data/mapHeaders/Route20.asm index 03455c54..3495b785 100755 --- a/data/mapHeaders/Route20.asm +++ b/data/mapHeaders/Route20.asm @@ -1,10 +1,5 @@ -Route20_h:: - db OVERWORLD ; tileset - db ROUTE_20_HEIGHT, ROUTE_20_WIDTH ; dimensions (y, x) - dw Route20_Blocks ; blocks - dw Route20_TextPointers ; texts - dw Route20_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_20, CINNABAR_ISLAND, 0, 0, CinnabarIsland_Blocks - EAST_MAP_CONNECTION ROUTE_20, ROUTE_19, -3, 15, Route19_Blocks - dw Route20_Object ; objects + + map_header Route20, ROUTE_20, OVERWORLD, WEST | EAST + connection west, CinnabarIsland, CINNABAR_ISLAND, 0 + connection east, Route19, ROUTE_19, -18 + end_map_header diff --git a/data/mapHeaders/Route21.asm b/data/mapHeaders/Route21.asm index 81e749e0..803bf217 100755 --- a/data/mapHeaders/Route21.asm +++ b/data/mapHeaders/Route21.asm @@ -1,10 +1,5 @@ -Route21_h:: - db OVERWORLD ; tileset - db ROUTE_21_HEIGHT, ROUTE_21_WIDTH ; dimensions (y, x) - dw Route21_Blocks ; blocks - dw Route21_TextPointers ; texts - dw Route21_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_21, PALLET_TOWN, 0, 0, PalletTown_Blocks - SOUTH_MAP_CONNECTION ROUTE_21, CINNABAR_ISLAND, 0, 0, CinnabarIsland_Blocks, 1 - dw Route21_Object ; objects + + map_header Route21, ROUTE_21, OVERWORLD, NORTH | SOUTH + connection north, PalletTown, PALLET_TOWN, 0 + connection south, CinnabarIsland, CINNABAR_ISLAND, 0 + end_map_header diff --git a/data/mapHeaders/Route22.asm b/data/mapHeaders/Route22.asm index 083652cc..e235efa1 100755 --- a/data/mapHeaders/Route22.asm +++ b/data/mapHeaders/Route22.asm @@ -1,10 +1,5 @@ -Route22_h:: - db OVERWORLD ; tileset - db ROUTE_22_HEIGHT, ROUTE_22_WIDTH ; dimensions (y, x) - dw Route22_Blocks ; blocks - dw Route22_TextPointers ; texts - dw Route22_Script ; scripts - db NORTH | EAST ; connections - NORTH_MAP_CONNECTION ROUTE_22, ROUTE_23, 0, 0, Route23_Blocks - EAST_MAP_CONNECTION ROUTE_22, VIRIDIAN_CITY, -3, 1, ViridianCity_Blocks, 1 - dw Route22_Object ; objects + + map_header Route22, ROUTE_22, OVERWORLD, NORTH | EAST + connection north, Route23, ROUTE_23, 0 + connection east, ViridianCity, VIRIDIAN_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route22Gate.asm b/data/mapHeaders/Route22Gate.asm index b0fae3e4..a9d1dd37 100755 --- a/data/mapHeaders/Route22Gate.asm +++ b/data/mapHeaders/Route22Gate.asm @@ -1,8 +1,3 @@ -Route22Gate_h:: - db GATE ; tileset - db ROUTE_22_GATE_HEIGHT, ROUTE_22_GATE_WIDTH ; dimensions (y, x) - dw Route22Gate_Blocks ; blocks - dw Route22Gate_TextPointers ; texts - dw Route22Gate_Script ; scripts - db 0 ; connections - dw Route22Gate_Object ; objects + + map_header Route22Gate, ROUTE_22_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route23.asm b/data/mapHeaders/Route23.asm index 1bc27a5f..e1535c9d 100755 --- a/data/mapHeaders/Route23.asm +++ b/data/mapHeaders/Route23.asm @@ -1,10 +1,5 @@ -Route23_h:: - db PLATEAU ; tileset - db ROUTE_23_HEIGHT, ROUTE_23_WIDTH ; dimensions (y, x) - dw Route23_Blocks ; blocks - dw Route23_TextPointers ; texts - dw Route23_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_23, INDIGO_PLATEAU, 0, 0, IndigoPlateau_Blocks - SOUTH_MAP_CONNECTION ROUTE_23, ROUTE_22, 0, 0, Route22_Blocks, 1 - dw Route23_Object ; objects + + map_header Route23, ROUTE_23, PLATEAU, NORTH | SOUTH + connection north, IndigoPlateau, INDIGO_PLATEAU, 0 + connection south, Route22, ROUTE_22, 0 + end_map_header diff --git a/data/mapHeaders/Route24.asm b/data/mapHeaders/Route24.asm index acb98d40..faf53660 100755 --- a/data/mapHeaders/Route24.asm +++ b/data/mapHeaders/Route24.asm @@ -1,10 +1,5 @@ -Route24_h:: - db OVERWORLD ; tileset - db ROUTE_24_HEIGHT, ROUTE_24_WIDTH ; dimensions (y, x) - dw Route24_Blocks ; blocks - dw Route24_TextPointers ; texts - dw Route24_Script ; scripts - db SOUTH | EAST ; connections - SOUTH_MAP_CONNECTION ROUTE_24, CERULEAN_CITY, -3, 2, CeruleanCity_Blocks, 1 - EAST_MAP_CONNECTION ROUTE_24, ROUTE_25, 0, 0, Route25_Blocks - dw Route24_Object ; objects + + map_header Route24, ROUTE_24, OVERWORLD, SOUTH | EAST + connection south, CeruleanCity, CERULEAN_CITY, -5 + connection east, Route25, ROUTE_25, 0 + end_map_header diff --git a/data/mapHeaders/Route25.asm b/data/mapHeaders/Route25.asm index d8da8583..1873d19b 100755 --- a/data/mapHeaders/Route25.asm +++ b/data/mapHeaders/Route25.asm @@ -1,9 +1,4 @@ -Route25_h:: - db OVERWORLD ; tileset - db ROUTE_25_HEIGHT, ROUTE_25_WIDTH ; dimensions (y, x) - dw Route25_Blocks ; blocks - dw Route25_TextPointers ; texts - dw Route25_Script ; scripts - db WEST ; connections - WEST_MAP_CONNECTION ROUTE_25, ROUTE_24, 0, 0, Route24_Blocks - dw Route25_Object ; objects + + map_header Route25, ROUTE_25, OVERWORLD, WEST + connection west, Route24, ROUTE_24, 0 + end_map_header diff --git a/data/mapHeaders/Route2Gate.asm b/data/mapHeaders/Route2Gate.asm index 68581910..730d8f2d 100755 --- a/data/mapHeaders/Route2Gate.asm +++ b/data/mapHeaders/Route2Gate.asm @@ -1,8 +1,3 @@ -Route2Gate_h:: - db GATE ; tileset - db ROUTE_2_GATE_HEIGHT, ROUTE_2_GATE_WIDTH ; dimensions (y, x) - dw Route2Gate_Blocks ; blocks - dw Route2Gate_TextPointers ; texts - dw Route2Gate_Script ; scripts - db 0 ; connections - dw Route2Gate_Object ; objects + + map_header Route2Gate, ROUTE_2_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route2TradeHouse.asm b/data/mapHeaders/Route2TradeHouse.asm index 98dc7aed..b9937dad 100755 --- a/data/mapHeaders/Route2TradeHouse.asm +++ b/data/mapHeaders/Route2TradeHouse.asm @@ -1,8 +1,3 @@ -Route2TradeHouse_h:: - db HOUSE ; tileset - db ROUTE_2_TRADE_HOUSE_HEIGHT, ROUTE_2_TRADE_HOUSE_WIDTH ; dimensions (y, x) - dw Route2TradeHouse_Blocks ; blocks - dw Route2TradeHouse_TextPointers ; texts - dw Route2TradeHouse_Script ; scripts - db 0 ; connections - dw Route2TradeHouse_Object ; objects + + map_header Route2TradeHouse, ROUTE_2_TRADE_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/Route3.asm b/data/mapHeaders/Route3.asm index a84b5bf9..ddbd7783 100755 --- a/data/mapHeaders/Route3.asm +++ b/data/mapHeaders/Route3.asm @@ -1,10 +1,5 @@ -Route3_h:: - db OVERWORLD ; tileset - db ROUTE_3_HEIGHT, ROUTE_3_WIDTH ; dimensions (y, x) - dw Route3_Blocks ; blocks - dw Route3_TextPointers ; texts - dw Route3_Script ; scripts - db NORTH | WEST ; connections - NORTH_MAP_CONNECTION ROUTE_3, ROUTE_4, 25, 0, Route4_Blocks - WEST_MAP_CONNECTION ROUTE_3, PEWTER_CITY, -3, 1, PewterCity_Blocks - dw Route3_Object ; objects + + map_header Route3, ROUTE_3, OVERWORLD, NORTH | WEST + connection north, Route4, ROUTE_4, 25 + connection west, PewterCity, PEWTER_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route4.asm b/data/mapHeaders/Route4.asm index d0d27d9c..6c43171a 100755 --- a/data/mapHeaders/Route4.asm +++ b/data/mapHeaders/Route4.asm @@ -1,10 +1,5 @@ -Route4_h:: - db OVERWORLD ; tileset - db ROUTE_4_HEIGHT, ROUTE_4_WIDTH ; dimensions (y, x) - dw Route4_Blocks ; blocks - dw Route4_TextPointers ; texts - dw Route4_Script ; scripts - db SOUTH | EAST ; connections - SOUTH_MAP_CONNECTION ROUTE_4, ROUTE_3, -3, 22, Route3_Blocks - EAST_MAP_CONNECTION ROUTE_4, CERULEAN_CITY, -3, 1, CeruleanCity_Blocks, 1 - dw Route4_Object ; objects + + map_header Route4, ROUTE_4, OVERWORLD, SOUTH | EAST + connection south, Route3, ROUTE_3, -25 + connection east, CeruleanCity, CERULEAN_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route5.asm b/data/mapHeaders/Route5.asm index 5a0e0cd4..ea84090c 100755 --- a/data/mapHeaders/Route5.asm +++ b/data/mapHeaders/Route5.asm @@ -1,10 +1,5 @@ -Route5_h:: - db OVERWORLD ; tileset - db ROUTE_5_HEIGHT, ROUTE_5_WIDTH ; dimensions (y, x) - dw Route5_Blocks ; blocks - dw Route5_TextPointers ; texts - dw Route5_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_5, CERULEAN_CITY, -3, 2, CeruleanCity_Blocks - SOUTH_MAP_CONNECTION ROUTE_5, SAFFRON_CITY, -3, 2, SaffronCity_Blocks, 1 - dw Route5_Object ; objects + + map_header Route5, ROUTE_5, OVERWORLD, NORTH | SOUTH + connection north, CeruleanCity, CERULEAN_CITY, -5 + connection south, SaffronCity, SAFFRON_CITY, -5 + end_map_header diff --git a/data/mapHeaders/Route5Gate.asm b/data/mapHeaders/Route5Gate.asm index d5de72b4..a0115533 100755 --- a/data/mapHeaders/Route5Gate.asm +++ b/data/mapHeaders/Route5Gate.asm @@ -1,8 +1,3 @@ -Route5Gate_h:: - db GATE ; tileset - db ROUTE_5_GATE_HEIGHT, ROUTE_5_GATE_WIDTH ; dimensions (y, x) - dw Route5Gate_Blocks ; blocks - dw Route5Gate_TextPointers ; texts - dw Route5Gate_Script ; scripts - db 0 ; connections - dw Route5Gate_Object ; objects + + map_header Route5Gate, ROUTE_5_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route6.asm b/data/mapHeaders/Route6.asm index 85cb1054..956aa4d6 100755 --- a/data/mapHeaders/Route6.asm +++ b/data/mapHeaders/Route6.asm @@ -1,10 +1,5 @@ -Route6_h:: - db OVERWORLD ; tileset - db ROUTE_6_HEIGHT, ROUTE_6_WIDTH ; dimensions (y, x) - dw Route6_Blocks ; blocks - dw Route6_TextPointers ; texts - dw Route6_Script ; scripts - db NORTH | SOUTH ; connections - NORTH_MAP_CONNECTION ROUTE_6, SAFFRON_CITY, -3, 2, SaffronCity_Blocks - SOUTH_MAP_CONNECTION ROUTE_6, VERMILION_CITY, -3, 2, VermilionCity_Blocks, 1 - dw Route6_Object ; objects + + map_header Route6, ROUTE_6, OVERWORLD, NORTH | SOUTH + connection north, SaffronCity, SAFFRON_CITY, -5 + connection south, VermilionCity, VERMILION_CITY, -5 + end_map_header diff --git a/data/mapHeaders/Route6Gate.asm b/data/mapHeaders/Route6Gate.asm index e5896518..f80b57c8 100755 --- a/data/mapHeaders/Route6Gate.asm +++ b/data/mapHeaders/Route6Gate.asm @@ -1,8 +1,3 @@ -Route6Gate_h:: - db GATE ; tileset - db ROUTE_6_GATE_HEIGHT, ROUTE_6_GATE_WIDTH ; dimensions (y, x) - dw Route6Gate_Blocks ; blocks - dw Route6Gate_TextPointers ; texts - dw Route6Gate_Script ; scripts - db 0 ; connections - dw Route6Gate_Object ; objects + + map_header Route6Gate, ROUTE_6_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route7.asm b/data/mapHeaders/Route7.asm index cb12c75a..8368c3fe 100755 --- a/data/mapHeaders/Route7.asm +++ b/data/mapHeaders/Route7.asm @@ -1,10 +1,5 @@ -Route7_h:: - db OVERWORLD ; tileset - db ROUTE_7_HEIGHT, ROUTE_7_WIDTH ; dimensions (y, x) - dw Route7_Blocks ; blocks - dw Route7_TextPointers ; texts - dw Route7_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_7, CELADON_CITY, -3, 1, CeladonCity_Blocks - EAST_MAP_CONNECTION ROUTE_7, SAFFRON_CITY, -3, 1, SaffronCity_Blocks, 1 - dw Route7_Object ; objects + + map_header Route7, ROUTE_7, OVERWORLD, WEST | EAST + connection west, CeladonCity, CELADON_CITY, -4 + connection east, SaffronCity, SAFFRON_CITY, -4 + end_map_header diff --git a/data/mapHeaders/Route7Gate.asm b/data/mapHeaders/Route7Gate.asm index d8400dae..e9b9b16d 100755 --- a/data/mapHeaders/Route7Gate.asm +++ b/data/mapHeaders/Route7Gate.asm @@ -1,8 +1,3 @@ -Route7Gate_h:: - db GATE ; tileset - db ROUTE_7_GATE_HEIGHT, ROUTE_7_GATE_WIDTH ; dimensions (y, x) - dw Route7Gate_Blocks ; blocks - dw Route7Gate_TextPointers ; texts - dw Route7Gate_Script ; scripts - db 0 ; connections - dw Route7Gate_Object ; objects + + map_header Route7Gate, ROUTE_7_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route8.asm b/data/mapHeaders/Route8.asm index 482e12f9..8df9e023 100755 --- a/data/mapHeaders/Route8.asm +++ b/data/mapHeaders/Route8.asm @@ -1,10 +1,5 @@ -Route8_h:: - db OVERWORLD ; tileset - db ROUTE_8_HEIGHT, ROUTE_8_WIDTH ; dimensions (y, x) - dw Route8_Blocks ; blocks - dw Route8_TextPointers ; texts - dw Route8_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_8, SAFFRON_CITY, -3, 1, SaffronCity_Blocks - EAST_MAP_CONNECTION ROUTE_8, LAVENDER_TOWN, 0, 0, LavenderTown_Blocks - dw Route8_Object ; objects + + map_header Route8, ROUTE_8, OVERWORLD, WEST | EAST + connection west, SaffronCity, SAFFRON_CITY, -4 + connection east, LavenderTown, LAVENDER_TOWN, 0 + end_map_header diff --git a/data/mapHeaders/Route8Gate.asm b/data/mapHeaders/Route8Gate.asm index 7599276b..f6a320a4 100755 --- a/data/mapHeaders/Route8Gate.asm +++ b/data/mapHeaders/Route8Gate.asm @@ -1,8 +1,3 @@ -Route8Gate_h:: - db GATE ; tileset - db ROUTE_8_GATE_HEIGHT, ROUTE_8_GATE_WIDTH ; dimensions (y, x) - dw Route8Gate_Blocks ; blocks - dw Route8Gate_TextPointers ; texts - dw Route8Gate_Script ; scripts - db 0 ; connections - dw Route8Gate_Object ; objects + + map_header Route8Gate, ROUTE_8_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/Route9.asm b/data/mapHeaders/Route9.asm index a0aef316..c1ed9225 100755 --- a/data/mapHeaders/Route9.asm +++ b/data/mapHeaders/Route9.asm @@ -1,10 +1,5 @@ -Route9_h:: - db OVERWORLD ; tileset - db ROUTE_9_HEIGHT, ROUTE_9_WIDTH ; dimensions (y, x) - dw Route9_Blocks ; blocks - dw Route9_TextPointers ; texts - dw Route9_Script ; scripts - db WEST | EAST ; connections - WEST_MAP_CONNECTION ROUTE_9, CERULEAN_CITY, -3, 1, CeruleanCity_Blocks - EAST_MAP_CONNECTION ROUTE_9, ROUTE_10, 0, 0, Route10_Blocks, 1 - dw Route9_Object ; objects + + map_header Route9, ROUTE_9, OVERWORLD, WEST | EAST + connection west, CeruleanCity, CERULEAN_CITY, -4 + connection east, Route10, ROUTE_10, 0 + end_map_header diff --git a/data/mapHeaders/SSAnne1F.asm b/data/mapHeaders/SSAnne1F.asm index 3b82a4ed..80d25e2d 100755 --- a/data/mapHeaders/SSAnne1F.asm +++ b/data/mapHeaders/SSAnne1F.asm @@ -1,8 +1,3 @@ -SSAnne1F_h:: - db SHIP ; tileset - db SS_ANNE_1F_HEIGHT, SS_ANNE_1F_WIDTH ; dimensions (y, x) - dw SSAnne1F_Blocks ; blocks - dw SSAnne1F_TextPointers ; texts - dw SSAnne1F_Script ; scripts - db 0 ; connections - dw SSAnne1F_Object ; objects + + map_header SSAnne1F, SS_ANNE_1F, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnne1FRooms.asm b/data/mapHeaders/SSAnne1FRooms.asm index 14260765..8bdd8d00 100755 --- a/data/mapHeaders/SSAnne1FRooms.asm +++ b/data/mapHeaders/SSAnne1FRooms.asm @@ -1,8 +1,3 @@ -SSAnne1FRooms_h:: - db SHIP ; tileset - db SS_ANNE_1F_ROOMS_HEIGHT, SS_ANNE_1F_ROOMS_WIDTH ; dimensions (y, x) - dw SSAnne1FRooms_Blocks ; blocks - dw SSAnne1FRooms_TextPointers ; texts - dw SSAnne1FRooms_Script ; scripts - db 0 ; connections - dw SSAnne1FRooms_Object ; objects + + map_header SSAnne1FRooms, SS_ANNE_1F_ROOMS, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnne2F.asm b/data/mapHeaders/SSAnne2F.asm index aef34599..b2fe14d7 100755 --- a/data/mapHeaders/SSAnne2F.asm +++ b/data/mapHeaders/SSAnne2F.asm @@ -1,8 +1,3 @@ -SSAnne2F_h:: - db SHIP ; tileset - db SS_ANNE_2F_HEIGHT, SS_ANNE_2F_WIDTH ; dimensions (y, x) - dw SSAnne2F_Blocks ; blocks - dw SSAnne2F_TextPointers ; texts - dw SSAnne2F_Script ; scripts - db 0 ; connections - dw SSAnne2F_Object ; objects + + map_header SSAnne2F, SS_ANNE_2F, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnne2FRooms.asm b/data/mapHeaders/SSAnne2FRooms.asm index 12ecca80..2d349e4c 100755 --- a/data/mapHeaders/SSAnne2FRooms.asm +++ b/data/mapHeaders/SSAnne2FRooms.asm @@ -1,8 +1,3 @@ -SSAnne2FRooms_h:: - db SHIP ; tileset - db SS_ANNE_2F_ROOMS_HEIGHT, SS_ANNE_2F_ROOMS_WIDTH ; dimensions (y, x) - dw SSAnne2FRooms_Blocks ; blocks - dw SSAnne2FRooms_TextPointers ; texts - dw SSAnne2FRooms_Script ; scripts - db 0 ; connections - dw SSAnne2FRooms_Object ; objects + + map_header SSAnne2FRooms, SS_ANNE_2F_ROOMS, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnne3F.asm b/data/mapHeaders/SSAnne3F.asm index 22ddfa03..f391a0cd 100755 --- a/data/mapHeaders/SSAnne3F.asm +++ b/data/mapHeaders/SSAnne3F.asm @@ -1,8 +1,3 @@ -SSAnne3F_h:: - db SHIP ; tileset - db SS_ANNE_3F_HEIGHT, SS_ANNE_3F_WIDTH ; dimensions (y, x) - dw SSAnne3F_Blocks ; blocks - dw SSAnne3F_TextPointers ; texts - dw SSAnne3F_Script ; scripts - db 0 ; connections - dw SSAnne3F_Object ; objects + + map_header SSAnne3F, SS_ANNE_3F, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnneB1F.asm b/data/mapHeaders/SSAnneB1F.asm index 28f0bbe3..c21d7cff 100755 --- a/data/mapHeaders/SSAnneB1F.asm +++ b/data/mapHeaders/SSAnneB1F.asm @@ -1,8 +1,3 @@ -SSAnneB1F_h:: - db SHIP ; tileset - db SS_ANNE_B1F_HEIGHT, SS_ANNE_B1F_WIDTH ; dimensions (y, x) - dw SSAnneB1F_Blocks ; blocks - dw SSAnneB1F_TextPointers ; texts - dw SSAnneB1F_Script ; scripts - db 0 ; connections - dw SSAnneB1F_Object ; objects + + map_header SSAnneB1F, SS_ANNE_B1F, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnneB1FRooms.asm b/data/mapHeaders/SSAnneB1FRooms.asm index 3d439984..1b8b4620 100755 --- a/data/mapHeaders/SSAnneB1FRooms.asm +++ b/data/mapHeaders/SSAnneB1FRooms.asm @@ -1,8 +1,3 @@ -SSAnneB1FRooms_h:: - db SHIP ; tileset - db SS_ANNE_B1F_ROOMS_HEIGHT, SS_ANNE_B1F_ROOMS_WIDTH ; dimensions (y, x) - dw SSAnneB1FRooms_Blocks ; blocks - dw SSAnneB1FRooms_TextPointers ; texts - dw SSAnneB1FRooms_Script ; scripts - db 0 ; connections - dw SSAnneB1FRooms_Object ; objects + + map_header SSAnneB1FRooms, SS_ANNE_B1F_ROOMS, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnneBow.asm b/data/mapHeaders/SSAnneBow.asm index 1b1be8cb..2195e970 100755 --- a/data/mapHeaders/SSAnneBow.asm +++ b/data/mapHeaders/SSAnneBow.asm @@ -1,8 +1,3 @@ -SSAnneBow_h:: - db SHIP ; tileset - db SS_ANNE_BOW_HEIGHT, SS_ANNE_BOW_WIDTH ; dimensions (y, x) - dw SSAnneBow_Blocks ; blocks - dw SSAnneBow_TextPointers ; texts - dw SSAnneBow_Script ; scripts - db 0 ; connections - dw SSAnneBow_Object ; objects + + map_header SSAnneBow, SS_ANNE_BOW, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnneCaptainsRoom.asm b/data/mapHeaders/SSAnneCaptainsRoom.asm index 78522804..a24f930d 100755 --- a/data/mapHeaders/SSAnneCaptainsRoom.asm +++ b/data/mapHeaders/SSAnneCaptainsRoom.asm @@ -1,8 +1,3 @@ -SSAnneCaptainsRoom_h:: - db SHIP ; tileset - db SS_ANNE_CAPTAINS_ROOM_HEIGHT, SS_ANNE_CAPTAINS_ROOM_WIDTH ; dimensions (y, x) - dw SSAnneCaptainsRoom_Blocks ; blocks - dw SSAnneCaptainsRoom_TextPointers ; texts - dw SSAnneCaptainsRoom_Script ; scripts - db 0 ; connections - dw SSAnneCaptainsRoom_Object ; objects + + map_header SSAnneCaptainsRoom, SS_ANNE_CAPTAINS_ROOM, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SSAnneKitchen.asm b/data/mapHeaders/SSAnneKitchen.asm index e4c6c472..47e84fbe 100755 --- a/data/mapHeaders/SSAnneKitchen.asm +++ b/data/mapHeaders/SSAnneKitchen.asm @@ -1,8 +1,3 @@ -SSAnneKitchen_h:: - db SHIP ; tileset - db SS_ANNE_KITCHEN_HEIGHT, SS_ANNE_KITCHEN_WIDTH ; dimensions (y, x) - dw SSAnneKitchen_Blocks ; blocks - dw SSAnneKitchen_TextPointers ; texts - dw SSAnneKitchen_Script ; scripts - db 0 ; connections - dw SSAnneKitchen_Object ; objects + + map_header SSAnneKitchen, SS_ANNE_KITCHEN, SHIP, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneCenter.asm b/data/mapHeaders/SafariZoneCenter.asm index a6e98bc3..ccc58ed1 100755 --- a/data/mapHeaders/SafariZoneCenter.asm +++ b/data/mapHeaders/SafariZoneCenter.asm @@ -1,8 +1,3 @@ -SafariZoneCenter_h:: - db FOREST ; tileset - db SAFARI_ZONE_CENTER_HEIGHT, SAFARI_ZONE_CENTER_WIDTH ; dimensions (y, x) - dw SafariZoneCenter_Blocks ; blocks - dw SafariZoneCenter_TextPointers ; texts - dw SafariZoneCenter_Script ; scripts - db 0 ; connections - dw SafariZoneCenter_Object ; objects + + map_header SafariZoneCenter, SAFARI_ZONE_CENTER, FOREST, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneCenterRestHouse.asm b/data/mapHeaders/SafariZoneCenterRestHouse.asm index 3dc9fba2..a866003f 100755 --- a/data/mapHeaders/SafariZoneCenterRestHouse.asm +++ b/data/mapHeaders/SafariZoneCenterRestHouse.asm @@ -1,8 +1,3 @@ -SafariZoneCenterRestHouse_h:: - db GATE ; tileset - db SAFARI_ZONE_CENTER_REST_HOUSE_HEIGHT, SAFARI_ZONE_CENTER_REST_HOUSE_WIDTH ; dimensions (y, x) - dw SafariZoneCenterRestHouse_Blocks ; blocks - dw SafariZoneCenterRestHouse_TextPointers ; texts - dw SafariZoneCenterRestHouse_Script ; scripts - db 0 ; connections - dw SafariZoneCenterRestHouse_Object ; objects + + map_header SafariZoneCenterRestHouse, SAFARI_ZONE_CENTER_REST_HOUSE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneEast.asm b/data/mapHeaders/SafariZoneEast.asm index 4f9c0989..c23e9334 100755 --- a/data/mapHeaders/SafariZoneEast.asm +++ b/data/mapHeaders/SafariZoneEast.asm @@ -1,8 +1,3 @@ -SafariZoneEast_h:: - db FOREST ; tileset - db SAFARI_ZONE_EAST_HEIGHT, SAFARI_ZONE_EAST_WIDTH ; dimensions (y, x) - dw SafariZoneEast_Blocks ; blocks - dw SafariZoneEast_TextPointers ; texts - dw SafariZoneEast_Script ; scripts - db 0 ; connections - dw SafariZoneEast_Object ; objects + + map_header SafariZoneEast, SAFARI_ZONE_EAST, FOREST, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneEastRestHouse.asm b/data/mapHeaders/SafariZoneEastRestHouse.asm index 4afa17c4..1f8d76c6 100755 --- a/data/mapHeaders/SafariZoneEastRestHouse.asm +++ b/data/mapHeaders/SafariZoneEastRestHouse.asm @@ -1,8 +1,3 @@ -SafariZoneEastRestHouse_h:: - db GATE ; tileset - db SAFARI_ZONE_EAST_REST_HOUSE_HEIGHT, SAFARI_ZONE_EAST_REST_HOUSE_WIDTH ; dimensions (y, x) - dw SafariZoneEastRestHouse_Blocks ; blocks - dw SafariZoneEastRestHouse_TextPointers ; texts - dw SafariZoneEastRestHouse_Script ; scripts - db 0 ; connections - dw SafariZoneEastRestHouse_Object ; objects + + map_header SafariZoneEastRestHouse, SAFARI_ZONE_EAST_REST_HOUSE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneGate.asm b/data/mapHeaders/SafariZoneGate.asm index 49d56b52..7816460d 100755 --- a/data/mapHeaders/SafariZoneGate.asm +++ b/data/mapHeaders/SafariZoneGate.asm @@ -1,8 +1,3 @@ -SafariZoneGate_h:: - db GATE ; tileset - db SAFARI_ZONE_GATE_HEIGHT, SAFARI_ZONE_GATE_WIDTH ; dimensions (y, x) - dw SafariZoneGate_Blocks ; blocks - dw SafariZoneGate_TextPointers ; texts - dw SafariZoneGate_Script ; scripts - db 0 ; connections - dw SafariZoneGate_Object ; objects + + map_header SafariZoneGate, SAFARI_ZONE_GATE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneNorth.asm b/data/mapHeaders/SafariZoneNorth.asm index a8364c74..32639d22 100755 --- a/data/mapHeaders/SafariZoneNorth.asm +++ b/data/mapHeaders/SafariZoneNorth.asm @@ -1,8 +1,3 @@ -SafariZoneNorth_h:: - db FOREST ; tileset - db SAFARI_ZONE_NORTH_HEIGHT, SAFARI_ZONE_NORTH_WIDTH ; dimensions (y, x) - dw SafariZoneNorth_Blocks ; blocks - dw SafariZoneNorth_TextPointers ; texts - dw SafariZoneNorth_Script ; scripts - db 0 ; connections - dw SafariZoneNorth_Object ; objects + + map_header SafariZoneNorth, SAFARI_ZONE_NORTH, FOREST, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneNorthRestHouse.asm b/data/mapHeaders/SafariZoneNorthRestHouse.asm index faf16451..ec083803 100755 --- a/data/mapHeaders/SafariZoneNorthRestHouse.asm +++ b/data/mapHeaders/SafariZoneNorthRestHouse.asm @@ -1,8 +1,3 @@ -SafariZoneNorthRestHouse_h:: - db GATE ; tileset - db SAFARI_ZONE_NORTH_REST_HOUSE_HEIGHT, SAFARI_ZONE_NORTH_REST_HOUSE_WIDTH ; dimensions (y, x) - dw SafariZoneNorthRestHouse_Blocks ; blocks - dw SafariZoneNorthRestHouse_TextPointers ; texts - dw SafariZoneNorthRestHouse_Script ; scripts - db 0 ; connections - dw SafariZoneNorthRestHouse_Object ; objects + + map_header SafariZoneNorthRestHouse, SAFARI_ZONE_NORTH_REST_HOUSE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneSecretHouse.asm b/data/mapHeaders/SafariZoneSecretHouse.asm index 1db35d37..630577c4 100755 --- a/data/mapHeaders/SafariZoneSecretHouse.asm +++ b/data/mapHeaders/SafariZoneSecretHouse.asm @@ -1,8 +1,3 @@ -SafariZoneSecretHouse_h:: - db LAB ; tileset - db SAFARI_ZONE_SECRET_HOUSE_HEIGHT, SAFARI_ZONE_SECRET_HOUSE_WIDTH ; dimensions (y, x) - dw SafariZoneSecretHouse_Blocks ; blocks - dw SafariZoneSecretHouse_TextPointers ; texts - dw SafariZoneSecretHouse_Script ; scripts - db 0 ; connections - dw SafariZoneSecretHouse_Object ; objects + + map_header SafariZoneSecretHouse, SAFARI_ZONE_SECRET_HOUSE, LAB, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneWest.asm b/data/mapHeaders/SafariZoneWest.asm index 00fd7d91..a1117d09 100755 --- a/data/mapHeaders/SafariZoneWest.asm +++ b/data/mapHeaders/SafariZoneWest.asm @@ -1,8 +1,3 @@ -SafariZoneWest_h:: - db FOREST ; tileset - db SAFARI_ZONE_WEST_HEIGHT, SAFARI_ZONE_WEST_WIDTH ; dimensions (y, x) - dw SafariZoneWest_Blocks ; blocks - dw SafariZoneWest_TextPointers ; texts - dw SafariZoneWest_Script ; scripts - db 0 ; connections - dw SafariZoneWest_Object ; objects + + map_header SafariZoneWest, SAFARI_ZONE_WEST, FOREST, 0 + end_map_header diff --git a/data/mapHeaders/SafariZoneWestRestHouse.asm b/data/mapHeaders/SafariZoneWestRestHouse.asm index 6b630df3..e4618e1d 100755 --- a/data/mapHeaders/SafariZoneWestRestHouse.asm +++ b/data/mapHeaders/SafariZoneWestRestHouse.asm @@ -1,8 +1,3 @@ -SafariZoneWestRestHouse_h:: - db GATE ; tileset - db SAFARI_ZONE_WEST_REST_HOUSE_HEIGHT, SAFARI_ZONE_WEST_REST_HOUSE_WIDTH ; dimensions (y, x) - dw SafariZoneWestRestHouse_Blocks ; blocks - dw SafariZoneWestRestHouse_TextPointers ; texts - dw SafariZoneWestRestHouse_Script ; scripts - db 0 ; connections - dw SafariZoneWestRestHouse_Object ; objects + + map_header SafariZoneWestRestHouse, SAFARI_ZONE_WEST_REST_HOUSE, GATE, 0 + end_map_header diff --git a/data/mapHeaders/SaffronCity.asm b/data/mapHeaders/SaffronCity.asm index c7a498de..ee1f71e4 100755 --- a/data/mapHeaders/SaffronCity.asm +++ b/data/mapHeaders/SaffronCity.asm @@ -1,12 +1,7 @@ -SaffronCity_h:: - db OVERWORLD ; tileset - db SAFFRON_CITY_HEIGHT, SAFFRON_CITY_WIDTH ; dimensions (y, x) - dw SaffronCity_Blocks ; blocks - dw SaffronCity_TextPointers ; texts - dw SaffronCity_Script ; scripts - db NORTH | SOUTH | WEST | EAST ; connections - NORTH_MAP_CONNECTION SAFFRON_CITY, ROUTE_5, 5, 0, Route5_Blocks - SOUTH_MAP_CONNECTION SAFFRON_CITY, ROUTE_6, 5, 0, Route6_Blocks, 1 - WEST_MAP_CONNECTION SAFFRON_CITY, ROUTE_7, 4, 0, Route7_Blocks - EAST_MAP_CONNECTION SAFFRON_CITY, ROUTE_8, 4, 0, Route8_Blocks - dw SaffronCity_Object ; objects + + map_header SaffronCity, SAFFRON_CITY, OVERWORLD, NORTH | SOUTH | WEST | EAST + connection north, Route5, ROUTE_5, 5 + connection south, Route6, ROUTE_6, 5 + connection west, Route7, ROUTE_7, 4 + connection east, Route8, ROUTE_8, 4 + end_map_header diff --git a/data/mapHeaders/SaffronGym.asm b/data/mapHeaders/SaffronGym.asm index d9ca460d..14ee3323 100755 --- a/data/mapHeaders/SaffronGym.asm +++ b/data/mapHeaders/SaffronGym.asm @@ -1,8 +1,3 @@ -SaffronGym_h:: - db FACILITY ; tileset - db SAFFRON_GYM_HEIGHT, SAFFRON_GYM_WIDTH ; dimensions (y, x) - dw SaffronGym_Blocks ; blocks - dw SaffronGym_TextPointers ; texts - dw SaffronGym_Script ; scripts - db 0 ; connections - dw SaffronGym_Object ; objects + + map_header SaffronGym, SAFFRON_GYM, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SaffronMart.asm b/data/mapHeaders/SaffronMart.asm index d8c477a4..f03132d2 100755 --- a/data/mapHeaders/SaffronMart.asm +++ b/data/mapHeaders/SaffronMart.asm @@ -1,8 +1,3 @@ -SaffronMart_h:: - db MART ; tileset - db SAFFRON_MART_HEIGHT, SAFFRON_MART_WIDTH ; dimensions (y, x) - dw SaffronMart_Blocks ; blocks - dw SaffronMart_TextPointers ; texts - dw SaffronMart_Script ; scripts - db 0 ; connections - dw SaffronMart_Object ; objects + + map_header SaffronMart, SAFFRON_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/SaffronPidgeyHouse.asm b/data/mapHeaders/SaffronPidgeyHouse.asm index 8e2e8b47..e9f8dde7 100755 --- a/data/mapHeaders/SaffronPidgeyHouse.asm +++ b/data/mapHeaders/SaffronPidgeyHouse.asm @@ -1,8 +1,3 @@ -SaffronPidgeyHouse_h:: - db HOUSE ; tileset - db SAFFRON_PIDGEY_HOUSE_HEIGHT, SAFFRON_PIDGEY_HOUSE_WIDTH ; dimensions (y, x) - dw SaffronPidgeyHouse_Blocks ; blocks - dw SaffronPidgeyHouse_TextPointers ; texts - dw SaffronPidgeyHouse_Script ; scripts - db 0 ; connections - dw SaffronPidgeyHouse_Object ; objects + + map_header SaffronPidgeyHouse, SAFFRON_PIDGEY_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/SaffronPokecenter.asm b/data/mapHeaders/SaffronPokecenter.asm index 18f7a7de..9b250050 100755 --- a/data/mapHeaders/SaffronPokecenter.asm +++ b/data/mapHeaders/SaffronPokecenter.asm @@ -1,8 +1,3 @@ -SaffronPokecenter_h:: - db POKECENTER ; tileset - db SAFFRON_POKECENTER_HEIGHT, SAFFRON_POKECENTER_WIDTH ; dimensions (y, x) - dw SaffronPokecenter_Blocks ; blocks - dw SaffronPokecenter_TextPointers ; texts - dw SaffronPokecenter_Script ; scripts - db 0 ; connections - dw SaffronPokecenter_Object ; objects + + map_header SaffronPokecenter, SAFFRON_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/SeafoamIslands1F.asm b/data/mapHeaders/SeafoamIslands1F.asm index 67df46fa..db530549 100755 --- a/data/mapHeaders/SeafoamIslands1F.asm +++ b/data/mapHeaders/SeafoamIslands1F.asm @@ -1,8 +1,3 @@ -SeafoamIslands1F_h:: - db CAVERN ; tileset - db SEAFOAM_ISLANDS_1F_HEIGHT, SEAFOAM_ISLANDS_1F_WIDTH ; dimensions (y, x) - dw SeafoamIslands1F_Blocks ; blocks - dw SeafoamIslands1F_TextPointers ; texts - dw SeafoamIslands1F_Script ; scripts - db 0 ; connections - dw SeafoamIslands1F_Object ; objects + + map_header SeafoamIslands1F, SEAFOAM_ISLANDS_1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/SeafoamIslandsB1F.asm b/data/mapHeaders/SeafoamIslandsB1F.asm index e1a667b6..589eef93 100755 --- a/data/mapHeaders/SeafoamIslandsB1F.asm +++ b/data/mapHeaders/SeafoamIslandsB1F.asm @@ -1,8 +1,3 @@ -SeafoamIslandsB1F_h:: - db CAVERN ; tileset - db SEAFOAM_ISLANDS_B1F_HEIGHT, SEAFOAM_ISLANDS_B1F_WIDTH ; dimensions (y, x) - dw SeafoamIslandsB1F_Blocks ; blocks - dw SeafoamIslandsB1F_TextPointers ; texts - dw SeafoamIslandsB1F_Script ; scripts - db 0 ; connections - dw SeafoamIslandsB1F_Object ; objects + + map_header SeafoamIslandsB1F, SEAFOAM_ISLANDS_B1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/SeafoamIslandsB2F.asm b/data/mapHeaders/SeafoamIslandsB2F.asm index d8074e20..f7e624ed 100755 --- a/data/mapHeaders/SeafoamIslandsB2F.asm +++ b/data/mapHeaders/SeafoamIslandsB2F.asm @@ -1,8 +1,3 @@ -SeafoamIslandsB2F_h:: - db CAVERN ; tileset - db SEAFOAM_ISLANDS_B2F_HEIGHT, SEAFOAM_ISLANDS_B2F_WIDTH ; dimensions (y, x) - dw SeafoamIslandsB2F_Blocks ; blocks - dw SeafoamIslandsB2F_TextPointers ; texts - dw SeafoamIslandsB2F_Script ; scripts - db 0 ; connections - dw SeafoamIslandsB2F_Object ; objects + + map_header SeafoamIslandsB2F, SEAFOAM_ISLANDS_B2F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/SeafoamIslandsB3F.asm b/data/mapHeaders/SeafoamIslandsB3F.asm index 2976a45b..b57da3c0 100755 --- a/data/mapHeaders/SeafoamIslandsB3F.asm +++ b/data/mapHeaders/SeafoamIslandsB3F.asm @@ -1,8 +1,3 @@ -SeafoamIslandsB3F_h:: - db CAVERN ; tileset - db SEAFOAM_ISLANDS_B3F_HEIGHT, SEAFOAM_ISLANDS_B3F_WIDTH ; dimensions (y, x) - dw SeafoamIslandsB3F_Blocks ; blocks - dw SeafoamIslandsB3F_TextPointers ; texts - dw SeafoamIslandsB3F_Script ; scripts - db 0 ; connections - dw SeafoamIslandsB3F_Object ; objects + + map_header SeafoamIslandsB3F, SEAFOAM_ISLANDS_B3F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/SeafoamIslandsB4F.asm b/data/mapHeaders/SeafoamIslandsB4F.asm index fcc98db5..bae1e3a2 100755 --- a/data/mapHeaders/SeafoamIslandsB4F.asm +++ b/data/mapHeaders/SeafoamIslandsB4F.asm @@ -1,8 +1,3 @@ -SeafoamIslandsB4F_h:: - db CAVERN ; tileset - db SEAFOAM_ISLANDS_B4F_HEIGHT, SEAFOAM_ISLANDS_B4F_WIDTH ; dimensions (y, x) - dw SeafoamIslandsB4F_Blocks ; blocks - dw SeafoamIslandsB4F_TextPointers ; texts - dw SeafoamIslandsB4F_Script ; scripts - db 0 ; connections - dw SeafoamIslandsB4F_Object ; objects + + map_header SeafoamIslandsB4F, SEAFOAM_ISLANDS_B4F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo10F.asm b/data/mapHeaders/SilphCo10F.asm index be016e65..7a6786e7 100755 --- a/data/mapHeaders/SilphCo10F.asm +++ b/data/mapHeaders/SilphCo10F.asm @@ -1,8 +1,3 @@ -SilphCo10F_h:: - db FACILITY ; tileset - db SILPH_CO_10F_HEIGHT, SILPH_CO_10F_WIDTH ; dimensions (y, x) - dw SilphCo10F_Blocks ; blocks - dw SilphCo10F_TextPointers ; texts - dw SilphCo10F_Script ; scripts - db 0 ; connections - dw SilphCo10F_Object ; objects + + map_header SilphCo10F, SILPH_CO_10F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo11F.asm b/data/mapHeaders/SilphCo11F.asm index c16255dd..72eaaca2 100755 --- a/data/mapHeaders/SilphCo11F.asm +++ b/data/mapHeaders/SilphCo11F.asm @@ -1,8 +1,3 @@ -SilphCo11F_h:: - db INTERIOR ; tileset - db SILPH_CO_11F_HEIGHT, SILPH_CO_11F_WIDTH ; dimensions (y, x) - dw SilphCo11F_Blocks ; blocks - dw SilphCo11F_TextPointers ; texts - dw SilphCo11F_Script ; scripts - db 0 ; connections - dw SilphCo11F_Object ; objects + + map_header SilphCo11F, SILPH_CO_11F, INTERIOR, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo1F.asm b/data/mapHeaders/SilphCo1F.asm index 0109677e..4c4ac97d 100755 --- a/data/mapHeaders/SilphCo1F.asm +++ b/data/mapHeaders/SilphCo1F.asm @@ -1,8 +1,3 @@ -SilphCo1F_h:: - db FACILITY ; tileset - db SILPH_CO_1F_HEIGHT, SILPH_CO_1F_WIDTH ; dimensions (y, x) - dw SilphCo1F_Blocks ; blocks - dw SilphCo1F_TextPointers ; texts - dw SilphCo1F_Script ; scripts - db 0 ; connections - dw SilphCo1F_Object ; objects + + map_header SilphCo1F, SILPH_CO_1F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo2F.asm b/data/mapHeaders/SilphCo2F.asm index c9a21b17..7dc44a55 100755 --- a/data/mapHeaders/SilphCo2F.asm +++ b/data/mapHeaders/SilphCo2F.asm @@ -1,8 +1,3 @@ -SilphCo2F_h:: - db FACILITY ; tileset - db SILPH_CO_2F_HEIGHT, SILPH_CO_2F_WIDTH ; dimensions (y, x) - dw SilphCo2F_Blocks ; blocks - dw SilphCo2F_TextPointers ; texts - dw SilphCo2F_Script ; scripts - db 0 ; connections - dw SilphCo2F_Object ; objects + + map_header SilphCo2F, SILPH_CO_2F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo3F.asm b/data/mapHeaders/SilphCo3F.asm index bd027dba..99e4aa15 100755 --- a/data/mapHeaders/SilphCo3F.asm +++ b/data/mapHeaders/SilphCo3F.asm @@ -1,8 +1,3 @@ -SilphCo3F_h:: - db FACILITY ; tileset - db SILPH_CO_3F_HEIGHT, SILPH_CO_3F_WIDTH ; dimensions (y, x) - dw SilphCo3F_Blocks ; blocks - dw SilphCo3F_TextPointers ; texts - dw SilphCo3F_Script ; scripts - db 0 ; connections - dw SilphCo3F_Object ; objects + + map_header SilphCo3F, SILPH_CO_3F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo4F.asm b/data/mapHeaders/SilphCo4F.asm index 6f45da8d..8eed0f9a 100755 --- a/data/mapHeaders/SilphCo4F.asm +++ b/data/mapHeaders/SilphCo4F.asm @@ -1,8 +1,3 @@ -SilphCo4F_h:: - db FACILITY ; tileset - db SILPH_CO_4F_HEIGHT, SILPH_CO_4F_WIDTH ; dimensions (y, x) - dw SilphCo4F_Blocks ; blocks - dw SilphCo4F_TextPointers ; texts - dw SilphCo4F_Script ; scripts - db 0 ; connections - dw SilphCo4F_Object ; objects + + map_header SilphCo4F, SILPH_CO_4F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo5F.asm b/data/mapHeaders/SilphCo5F.asm index 355aa258..3b40c360 100755 --- a/data/mapHeaders/SilphCo5F.asm +++ b/data/mapHeaders/SilphCo5F.asm @@ -1,8 +1,3 @@ -SilphCo5F_h:: - db FACILITY ; tileset - db SILPH_CO_5F_HEIGHT, SILPH_CO_5F_WIDTH ; dimensions (y, x) - dw SilphCo5F_Blocks ; blocks - dw SilphCo5F_TextPointers ; texts - dw SilphCo5F_Script ; scripts - db 0 ; connections - dw SilphCo5F_Object ; objects + + map_header SilphCo5F, SILPH_CO_5F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo6F.asm b/data/mapHeaders/SilphCo6F.asm index 732248ac..3d2b3b8c 100755 --- a/data/mapHeaders/SilphCo6F.asm +++ b/data/mapHeaders/SilphCo6F.asm @@ -1,8 +1,3 @@ -SilphCo6F_h:: - db FACILITY ; tileset - db SILPH_CO_6F_HEIGHT, SILPH_CO_6F_WIDTH ; dimensions (y, x) - dw SilphCo6F_Blocks ; blocks - dw SilphCo6F_TextPointers ; texts - dw SilphCo6F_Script ; scripts - db 0 ; connections - dw SilphCo6F_Object ; objects + + map_header SilphCo6F, SILPH_CO_6F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo7F.asm b/data/mapHeaders/SilphCo7F.asm index 116e0342..1591837a 100755 --- a/data/mapHeaders/SilphCo7F.asm +++ b/data/mapHeaders/SilphCo7F.asm @@ -1,8 +1,3 @@ -SilphCo7F_h:: - db FACILITY ; tileset - db SILPH_CO_7F_HEIGHT, SILPH_CO_7F_WIDTH ; dimensions (y, x) - dw SilphCo7F_Blocks ; blocks - dw SilphCo7F_TextPointers ; texts - dw SilphCo7F_Script ; scripts - db 0 ; connections - dw SilphCo7F_Object ; objects + + map_header SilphCo7F, SILPH_CO_7F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo8F.asm b/data/mapHeaders/SilphCo8F.asm index 6d1c7faf..e676fa86 100755 --- a/data/mapHeaders/SilphCo8F.asm +++ b/data/mapHeaders/SilphCo8F.asm @@ -1,8 +1,3 @@ -SilphCo8F_h:: - db FACILITY ; tileset - db SILPH_CO_8F_HEIGHT, SILPH_CO_8F_WIDTH ; dimensions (y, x) - dw SilphCo8F_Blocks ; blocks - dw SilphCo8F_TextPointers ; texts - dw SilphCo8F_Script ; scripts - db 0 ; connections - dw SilphCo8F_Object ; objects + + map_header SilphCo8F, SILPH_CO_8F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCo9F.asm b/data/mapHeaders/SilphCo9F.asm index 3465e2fc..89f0300a 100755 --- a/data/mapHeaders/SilphCo9F.asm +++ b/data/mapHeaders/SilphCo9F.asm @@ -1,8 +1,3 @@ -SilphCo9F_h:: - db FACILITY ; tileset - db SILPH_CO_9F_HEIGHT, SILPH_CO_9F_WIDTH ; dimensions (y, x) - dw SilphCo9F_Blocks ; blocks - dw SilphCo9F_TextPointers ; texts - dw SilphCo9F_Script ; scripts - db 0 ; connections - dw SilphCo9F_Object ; objects + + map_header SilphCo9F, SILPH_CO_9F, FACILITY, 0 + end_map_header diff --git a/data/mapHeaders/SilphCoElevator.asm b/data/mapHeaders/SilphCoElevator.asm index 5bf164da..4dd9cd9f 100755 --- a/data/mapHeaders/SilphCoElevator.asm +++ b/data/mapHeaders/SilphCoElevator.asm @@ -1,8 +1,3 @@ -SilphCoElevator_h:: - db LOBBY ; tileset - db SILPH_CO_ELEVATOR_HEIGHT, SILPH_CO_ELEVATOR_WIDTH ; dimensions (y, x) - dw SilphCoElevator_Blocks ; blocks - dw SilphCoElevator_TextPointers ; texts - dw SilphCoElevator_Script ; scripts - db 0 ; connections - dw SilphCoElevator_Object ; objects + + map_header SilphCoElevator, SILPH_CO_ELEVATOR, LOBBY, 0 + end_map_header diff --git a/data/mapHeaders/TradeCenter.asm b/data/mapHeaders/TradeCenter.asm index 584cf3c6..268d76b2 100755 --- a/data/mapHeaders/TradeCenter.asm +++ b/data/mapHeaders/TradeCenter.asm @@ -1,8 +1,3 @@ -TradeCenter_h:: - db CLUB ; tileset - db TRADE_CENTER_HEIGHT, TRADE_CENTER_WIDTH ; dimensions (y, x) - dw TradeCenter_Blocks ; blocks - dw TradeCenter_TextPointers ; texts - dw TradeCenter_Script ; scripts - db 0 ; connections - dw TradeCenter_Object ; objects + + map_header TradeCenter, TRADE_CENTER, CLUB, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathNorthSouth.asm b/data/mapHeaders/UndergroundPathNorthSouth.asm index 1443d875..4bb03c79 100755 --- a/data/mapHeaders/UndergroundPathNorthSouth.asm +++ b/data/mapHeaders/UndergroundPathNorthSouth.asm @@ -1,8 +1,3 @@ -UndergroundPathNorthSouth_h:: - db UNDERGROUND ; tileset - db UNDERGROUND_PATH_NORTH_SOUTH_HEIGHT, UNDERGROUND_PATH_NORTH_SOUTH_WIDTH ; dimensions (y, x) - dw UndergroundPathNorthSouth_Blocks ; blocks - dw UndergroundPathNorthSouth_TextPointers ; texts - dw UndergroundPathNorthSouth_Script ; scripts - db 0 ; connections - dw UndergroundPathNorthSouth_Object ; objects + + map_header UndergroundPathNorthSouth, UNDERGROUND_PATH_NORTH_SOUTH, UNDERGROUND, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathRoute5.asm b/data/mapHeaders/UndergroundPathRoute5.asm index 769bd1c0..18287254 100755 --- a/data/mapHeaders/UndergroundPathRoute5.asm +++ b/data/mapHeaders/UndergroundPathRoute5.asm @@ -1,8 +1,3 @@ -UndergroundPathRoute5_h:: - db GATE ; tileset - db UNDERGROUND_PATH_ROUTE_5_HEIGHT, UNDERGROUND_PATH_ROUTE_5_WIDTH ; dimensions (y, x) - dw UndergroundPathRoute5_Blocks ; blocks - dw UndergroundPathRoute5_TextPointers ; texts - dw UndergroundPathRoute5_Script ; scripts - db 0 ; connections - dw UndergroundPathRoute5_Object ; objects + + map_header UndergroundPathRoute5, UNDERGROUND_PATH_ROUTE_5, GATE, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathRoute6.asm b/data/mapHeaders/UndergroundPathRoute6.asm index f2a5beb7..67772543 100755 --- a/data/mapHeaders/UndergroundPathRoute6.asm +++ b/data/mapHeaders/UndergroundPathRoute6.asm @@ -1,8 +1,3 @@ -UndergroundPathRoute6_h:: - db GATE ; tileset - db UNDERGROUND_PATH_ROUTE_6_HEIGHT, UNDERGROUND_PATH_ROUTE_6_WIDTH ; dimensions (y, x) - dw UndergroundPathRoute6_Blocks ; blocks - dw UndergroundPathRoute6_TextPointers ; texts - dw UndergroundPathRoute6_Script ; scripts - db 0 ; connections - dw UndergroundPathRoute6_Object ; objects + + map_header UndergroundPathRoute6, UNDERGROUND_PATH_ROUTE_6, GATE, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathRoute7.asm b/data/mapHeaders/UndergroundPathRoute7.asm index b8120ef4..d70548ed 100755 --- a/data/mapHeaders/UndergroundPathRoute7.asm +++ b/data/mapHeaders/UndergroundPathRoute7.asm @@ -1,8 +1,3 @@ -UndergroundPathRoute7_h:: - db GATE ; tileset - db UNDERGROUND_PATH_ROUTE_7_HEIGHT, UNDERGROUND_PATH_ROUTE_7_WIDTH ; dimensions (y, x) - dw UndergroundPathRoute7_Blocks ; blocks - dw UndergroundPathRoute7_TextPointers ; texts - dw UndergroundPathRoute7_Script ; scripts - db 0 ; connections - dw UndergroundPathRoute7_Object ; objects + + map_header UndergroundPathRoute7, UNDERGROUND_PATH_ROUTE_7, GATE, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathRoute7Copy.asm b/data/mapHeaders/UndergroundPathRoute7Copy.asm index 2ccdac57..30bb70a8 100755 --- a/data/mapHeaders/UndergroundPathRoute7Copy.asm +++ b/data/mapHeaders/UndergroundPathRoute7Copy.asm @@ -1,8 +1,3 @@ -UndergroundPathRoute7Copy_h:: - db GATE ; tileset - db UNDERGROUND_PATH_ROUTE_7_HEIGHT, UNDERGROUND_PATH_ROUTE_7_WIDTH ; dimensions (y, x) - dw UndergroundPathRoute7Copy_Blocks ; blocks - dw UndergroundPathRoute7Copy_TextPointers ; texts - dw UndergroundPathRoute7Copy_Script ; scripts - db 0 ; connections - dw UndergroundPathRoute7Copy_Object ; objects + + map_header UndergroundPathRoute7Copy, UNDERGROUND_PATH_ROUTE_7, GATE, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathRoute8.asm b/data/mapHeaders/UndergroundPathRoute8.asm index a1971c3c..102d8413 100755 --- a/data/mapHeaders/UndergroundPathRoute8.asm +++ b/data/mapHeaders/UndergroundPathRoute8.asm @@ -1,8 +1,3 @@ -UndergroundPathRoute8_h:: - db GATE ; tileset - db UNDERGROUND_PATH_ROUTE_8_HEIGHT, UNDERGROUND_PATH_ROUTE_8_WIDTH ; dimensions (y, x) - dw UndergroundPathRoute8_Blocks ; blocks - dw UndergroundPathRoute8_TextPointers ; texts - dw UndergroundPathRoute8_Script ; scripts - db 0 ; connections - dw UndergroundPathRoute8_Object ; objects + + map_header UndergroundPathRoute8, UNDERGROUND_PATH_ROUTE_8, GATE, 0 + end_map_header diff --git a/data/mapHeaders/UndergroundPathWestEast.asm b/data/mapHeaders/UndergroundPathWestEast.asm index 1d50c103..05976e87 100755 --- a/data/mapHeaders/UndergroundPathWestEast.asm +++ b/data/mapHeaders/UndergroundPathWestEast.asm @@ -1,8 +1,3 @@ -UndergroundPathWestEast_h:: - db UNDERGROUND ; tileset - db UNDERGROUND_PATH_WEST_EAST_HEIGHT, UNDERGROUND_PATH_WEST_EAST_WIDTH ; dimensions (y, x) - dw UndergroundPathWestEast_Blocks ; blocks - dw UndergroundPathWestEast_TextPointers ; texts - dw UndergroundPathWestEast_Script ; scripts - db 0 ; connections - dw UndergroundPathWestEast_Object ; objects + + map_header UndergroundPathWestEast, UNDERGROUND_PATH_WEST_EAST, UNDERGROUND, 0 + end_map_header diff --git a/data/mapHeaders/VermilionCity.asm b/data/mapHeaders/VermilionCity.asm index 8026c214..e211562c 100755 --- a/data/mapHeaders/VermilionCity.asm +++ b/data/mapHeaders/VermilionCity.asm @@ -1,10 +1,5 @@ -VermilionCity_h:: - db OVERWORLD ; tileset - db VERMILION_CITY_HEIGHT, VERMILION_CITY_WIDTH ; dimensions (y, x) - dw VermilionCity_Blocks ; blocks - dw VermilionCity_TextPointers ; texts - dw VermilionCity_Script ; scripts - db NORTH | EAST ; connections - NORTH_MAP_CONNECTION VERMILION_CITY, ROUTE_6, 5, 0, Route6_Blocks - EAST_MAP_CONNECTION VERMILION_CITY, ROUTE_11, 4, 0, Route11_Blocks - dw VermilionCity_Object ; objects + + map_header VermilionCity, VERMILION_CITY, OVERWORLD, NORTH | EAST + connection north, Route6, ROUTE_6, 5 + connection east, Route11, ROUTE_11, 4 + end_map_header diff --git a/data/mapHeaders/VermilionDock.asm b/data/mapHeaders/VermilionDock.asm index 0eb0edac..9a9b61c2 100755 --- a/data/mapHeaders/VermilionDock.asm +++ b/data/mapHeaders/VermilionDock.asm @@ -1,8 +1,3 @@ -VermilionDock_h:: - db SHIP_PORT ; tileset - db VERMILION_DOCK_HEIGHT, VERMILION_DOCK_WIDTH ; dimensions (y, x) - dw VermilionDock_Blocks ; blocks - dw VermilionDock_TextPointers ; texts - dw VermilionDock_Script ; scripts - db 0 ; connections - dw VermilionDock_Object ; objects + + map_header VermilionDock, VERMILION_DOCK, SHIP_PORT, 0 + end_map_header diff --git a/data/mapHeaders/VermilionGym.asm b/data/mapHeaders/VermilionGym.asm index 0b5913f1..ca75b8c1 100755 --- a/data/mapHeaders/VermilionGym.asm +++ b/data/mapHeaders/VermilionGym.asm @@ -1,8 +1,3 @@ -VermilionGym_h:: - db GYM ; tileset - db VERMILION_GYM_HEIGHT, VERMILION_GYM_WIDTH ; dimensions (y, x) - dw VermilionGym_Blocks ; blocks - dw VermilionGym_TextPointers ; texts - dw VermilionGym_Script ; scripts - db 0 ; connections - dw VermilionGym_Object ; objects + + map_header VermilionGym, VERMILION_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/VermilionMart.asm b/data/mapHeaders/VermilionMart.asm index 2fc1c79a..5777db4b 100755 --- a/data/mapHeaders/VermilionMart.asm +++ b/data/mapHeaders/VermilionMart.asm @@ -1,8 +1,3 @@ -VermilionMart_h:: - db MART ; tileset - db VERMILION_MART_HEIGHT, VERMILION_MART_WIDTH ; dimensions (y, x) - dw VermilionMart_Blocks ; blocks - dw VermilionMart_TextPointers ; texts - dw VermilionMart_Script ; scripts - db 0 ; connections - dw VermilionMart_Object ; objects + + map_header VermilionMart, VERMILION_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/VermilionOldRodHouse.asm b/data/mapHeaders/VermilionOldRodHouse.asm index 88a6e5d8..f9c890e0 100755 --- a/data/mapHeaders/VermilionOldRodHouse.asm +++ b/data/mapHeaders/VermilionOldRodHouse.asm @@ -1,8 +1,3 @@ -VermilionOldRodHouse_h:: - db HOUSE ; tileset - db VERMILION_OLD_ROD_HOUSE_HEIGHT, VERMILION_OLD_ROD_HOUSE_WIDTH ; dimensions (y, x) - dw VermilionOldRodHouse_Blocks ; blocks - dw VermilionOldRodHouse_TextPointers ; texts - dw VermilionOldRodHouse_Script ; scripts - db 0 ; connections - dw VermilionOldRodHouse_Object ; objects + + map_header VermilionOldRodHouse, VERMILION_OLD_ROD_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/VermilionPidgeyHouse.asm b/data/mapHeaders/VermilionPidgeyHouse.asm index d355805a..afb81784 100755 --- a/data/mapHeaders/VermilionPidgeyHouse.asm +++ b/data/mapHeaders/VermilionPidgeyHouse.asm @@ -1,8 +1,3 @@ -VermilionPidgeyHouse_h:: - db HOUSE ; tileset - db VERMILION_PIDGEY_HOUSE_HEIGHT, VERMILION_PIDGEY_HOUSE_WIDTH ; dimensions (y, x) - dw VermilionPidgeyHouse_Blocks ; blocks - dw VermilionPidgeyHouse_TextPointers ; texts - dw VermilionPidgeyHouse_Script ; scripts - db 0 ; connections - dw VermilionPidgeyHouse_Object ; objects + + map_header VermilionPidgeyHouse, VERMILION_PIDGEY_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/VermilionPokecenter.asm b/data/mapHeaders/VermilionPokecenter.asm index face28d6..af9827ac 100755 --- a/data/mapHeaders/VermilionPokecenter.asm +++ b/data/mapHeaders/VermilionPokecenter.asm @@ -1,8 +1,3 @@ -VermilionPokecenter_h:: - db POKECENTER ; tileset - db VERMILION_POKECENTER_HEIGHT, VERMILION_POKECENTER_WIDTH ; dimensions (y, x) - dw VermilionPokecenter_Blocks ; blocks - dw VermilionPokecenter_TextPointers ; texts - dw VermilionPokecenter_Script ; scripts - db 0 ; connections - dw VermilionPokecenter_Object ; objects + + map_header VermilionPokecenter, VERMILION_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/VermilionTradeHouse.asm b/data/mapHeaders/VermilionTradeHouse.asm index cadd14b2..3cb82c47 100755 --- a/data/mapHeaders/VermilionTradeHouse.asm +++ b/data/mapHeaders/VermilionTradeHouse.asm @@ -1,8 +1,3 @@ -VermilionTradeHouse_h:: - db HOUSE ; tileset - db VERMILION_TRADE_HOUSE_HEIGHT, VERMILION_TRADE_HOUSE_WIDTH ; dimensions (y, x) - dw VermilionTradeHouse_Blocks ; blocks - dw VermilionTradeHouse_TextPointers ; texts - dw VermilionTradeHouse_Script ; scripts - db 0 ; connections - dw VermilionTradeHouse_Object ; objects + + map_header VermilionTradeHouse, VERMILION_TRADE_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/VictoryRoad1F.asm b/data/mapHeaders/VictoryRoad1F.asm index 239a8de3..dae95f16 100755 --- a/data/mapHeaders/VictoryRoad1F.asm +++ b/data/mapHeaders/VictoryRoad1F.asm @@ -1,8 +1,3 @@ -VictoryRoad1F_h:: - db CAVERN ; tileset - db VICTORY_ROAD_1F_HEIGHT, VICTORY_ROAD_1F_WIDTH ; dimensions (y, x) - dw VictoryRoad1F_Blocks ; blocks - dw VictoryRoad1F_TextPointers ; texts - dw VictoryRoad1F_Script ; scripts - db 0 ; connections - dw VictoryRoad1F_Object ; objects + + map_header VictoryRoad1F, VICTORY_ROAD_1F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/VictoryRoad2F.asm b/data/mapHeaders/VictoryRoad2F.asm index a0138cb2..99079ad3 100755 --- a/data/mapHeaders/VictoryRoad2F.asm +++ b/data/mapHeaders/VictoryRoad2F.asm @@ -1,8 +1,3 @@ -VictoryRoad2F_h:: - db CAVERN ; tileset - db VICTORY_ROAD_2F_HEIGHT, VICTORY_ROAD_2F_WIDTH ; dimensions (y, x) - dw VictoryRoad2F_Blocks ; blocks - dw VictoryRoad2F_TextPointers ; texts - dw VictoryRoad2F_Script ; scripts - db 0 ; connections - dw VictoryRoad2F_Object ; objects + + map_header VictoryRoad2F, VICTORY_ROAD_2F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/VictoryRoad3F.asm b/data/mapHeaders/VictoryRoad3F.asm index 32133afa..bc15cad7 100755 --- a/data/mapHeaders/VictoryRoad3F.asm +++ b/data/mapHeaders/VictoryRoad3F.asm @@ -1,8 +1,3 @@ -VictoryRoad3F_h:: - db CAVERN ; tileset - db VICTORY_ROAD_3F_HEIGHT, VICTORY_ROAD_3F_WIDTH ; dimensions (y, x) - dw VictoryRoad3F_Blocks ; blocks - dw VictoryRoad3F_TextPointers ; texts - dw VictoryRoad3F_Script ; scripts - db 0 ; connections - dw VictoryRoad3F_Object ; objects + + map_header VictoryRoad3F, VICTORY_ROAD_3F, CAVERN, 0 + end_map_header diff --git a/data/mapHeaders/ViridianCity.asm b/data/mapHeaders/ViridianCity.asm index 5dc56820..0771cc81 100755 --- a/data/mapHeaders/ViridianCity.asm +++ b/data/mapHeaders/ViridianCity.asm @@ -1,11 +1,6 @@ -ViridianCity_h:: - db OVERWORLD ; tileset - db VIRIDIAN_CITY_HEIGHT, VIRIDIAN_CITY_WIDTH ; dimensions (y, x) - dw ViridianCity_Blocks ; blocks - dw ViridianCity_TextPointers ; texts - dw ViridianCity_Script ; scripts - db NORTH | SOUTH | WEST ; connections - NORTH_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_2, 5, 0, Route2_Blocks - SOUTH_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_1, 5, 0, Route1_Blocks, 1 - WEST_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_22, 4, 0, Route22_Blocks - dw ViridianCity_Object ; objects + + map_header ViridianCity, VIRIDIAN_CITY, OVERWORLD, NORTH | SOUTH | WEST + connection north, Route2, ROUTE_2, 5 + connection south, Route1, ROUTE_1, 5 + connection west, Route22, ROUTE_22, 4 + end_map_header diff --git a/data/mapHeaders/ViridianForest.asm b/data/mapHeaders/ViridianForest.asm index 557b99ed..d531ec86 100755 --- a/data/mapHeaders/ViridianForest.asm +++ b/data/mapHeaders/ViridianForest.asm @@ -1,8 +1,3 @@ -ViridianForest_h:: - db FOREST ; tileset - db VIRIDIAN_FOREST_HEIGHT, VIRIDIAN_FOREST_WIDTH ; dimensions (y, x) - dw ViridianForest_Blocks ; blocks - dw ViridianForest_TextPointers ; texts - dw ViridianForest_Script ; scripts - db 0 ; connections - dw ViridianForest_Object ; objects + + map_header ViridianForest, VIRIDIAN_FOREST, FOREST, 0 + end_map_header diff --git a/data/mapHeaders/ViridianForestNorthGate.asm b/data/mapHeaders/ViridianForestNorthGate.asm index 1fd4ac7d..5bfcd6ed 100755 --- a/data/mapHeaders/ViridianForestNorthGate.asm +++ b/data/mapHeaders/ViridianForestNorthGate.asm @@ -1,8 +1,3 @@ -ViridianForestNorthGate_h:: - db FOREST_GATE ; tileset - db VIRIDIAN_FOREST_NORTH_GATE_HEIGHT, VIRIDIAN_FOREST_NORTH_GATE_WIDTH ; dimensions (y, x) - dw ViridianForestNorthGate_Blocks ; blocks - dw ViridianForestNorthGate_TextPointers ; texts - dw ViridianForestNorthGate_Script ; scripts - db 0 ; connections - dw ViridianForestNorthGate_Object ; objects + + map_header ViridianForestNorthGate, VIRIDIAN_FOREST_NORTH_GATE, FOREST_GATE, 0 + end_map_header diff --git a/data/mapHeaders/ViridianForestSouthGate.asm b/data/mapHeaders/ViridianForestSouthGate.asm index 65d587f8..87a49284 100755 --- a/data/mapHeaders/ViridianForestSouthGate.asm +++ b/data/mapHeaders/ViridianForestSouthGate.asm @@ -1,8 +1,3 @@ -ViridianForestSouthGate_h:: - db FOREST_GATE ; tileset - db VIRIDIAN_FOREST_SOUTH_GATE_HEIGHT, VIRIDIAN_FOREST_SOUTH_GATE_WIDTH ; dimensions (y, x) - dw ViridianForestSouthGate_Blocks ; blocks - dw ViridianForestSouthGate_TextPointers ; texts - dw ViridianForestSouthGate_Script ; scripts - db 0 ; connections - dw ViridianForestSouthGate_Object ; objects + + map_header ViridianForestSouthGate, VIRIDIAN_FOREST_SOUTH_GATE, FOREST_GATE, 0 + end_map_header diff --git a/data/mapHeaders/ViridianGym.asm b/data/mapHeaders/ViridianGym.asm index 136a13b5..640a71b6 100755 --- a/data/mapHeaders/ViridianGym.asm +++ b/data/mapHeaders/ViridianGym.asm @@ -1,8 +1,3 @@ -ViridianGym_h:: - db GYM ; tileset - db VIRIDIAN_GYM_HEIGHT, VIRIDIAN_GYM_WIDTH ; dimensions (y, x) - dw ViridianGym_Blocks ; blocks - dw ViridianGym_TextPointers ; texts - dw ViridianGym_Script ; scripts - db 0 ; connections - dw ViridianGym_Object ; objects + + map_header ViridianGym, VIRIDIAN_GYM, GYM, 0 + end_map_header diff --git a/data/mapHeaders/ViridianMart.asm b/data/mapHeaders/ViridianMart.asm index 341caa86..817b5265 100755 --- a/data/mapHeaders/ViridianMart.asm +++ b/data/mapHeaders/ViridianMart.asm @@ -1,8 +1,3 @@ -ViridianMart_h:: - db MART ; tileset - db VIRIDIAN_MART_HEIGHT, VIRIDIAN_MART_WIDTH ; dimensions (y, x) - dw ViridianMart_Blocks ; blocks - dw ViridianMart_TextPointers ; texts - dw ViridianMart_Script ; scripts - db 0 ; connections - dw ViridianMart_Object ; objects + + map_header ViridianMart, VIRIDIAN_MART, MART, 0 + end_map_header diff --git a/data/mapHeaders/ViridianNicknameHouse.asm b/data/mapHeaders/ViridianNicknameHouse.asm index db817b2f..5a7c272f 100755 --- a/data/mapHeaders/ViridianNicknameHouse.asm +++ b/data/mapHeaders/ViridianNicknameHouse.asm @@ -1,8 +1,3 @@ -ViridianNicknameHouse_h:: - db HOUSE ; tileset - db VIRIDIAN_NICKNAME_HOUSE_HEIGHT, VIRIDIAN_NICKNAME_HOUSE_WIDTH ; dimensions (y, x) - dw ViridianNicknameHouse_Blocks ; blocks - dw ViridianNicknameHouse_TextPointers ; texts - dw ViridianNicknameHouse_Script ; scripts - db 0 ; connections - dw ViridianNicknameHouse_Object ; objects + + map_header ViridianNicknameHouse, VIRIDIAN_NICKNAME_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/ViridianPokecenter.asm b/data/mapHeaders/ViridianPokecenter.asm index 203abf06..daac19f3 100755 --- a/data/mapHeaders/ViridianPokecenter.asm +++ b/data/mapHeaders/ViridianPokecenter.asm @@ -1,8 +1,3 @@ -ViridianPokecenter_h:: - db POKECENTER ; tileset - db VIRIDIAN_POKECENTER_HEIGHT, VIRIDIAN_POKECENTER_WIDTH ; dimensions (y, x) - dw ViridianPokecenter_Blocks ; blocks - dw ViridianPokecenter_TextPointers ; texts - dw ViridianPokecenter_Script ; scripts - db 0 ; connections - dw ViridianPokecenter_Object ; objects + + map_header ViridianPokecenter, VIRIDIAN_POKECENTER, POKECENTER, 0 + end_map_header diff --git a/data/mapHeaders/ViridianSchoolHouse.asm b/data/mapHeaders/ViridianSchoolHouse.asm index fdf1090a..f5b77212 100755 --- a/data/mapHeaders/ViridianSchoolHouse.asm +++ b/data/mapHeaders/ViridianSchoolHouse.asm @@ -1,8 +1,3 @@ -ViridianSchoolHouse_h:: - db HOUSE ; tileset - db VIRIDIAN_SCHOOL_HOUSE_HEIGHT, VIRIDIAN_SCHOOL_HOUSE_WIDTH ; dimensions (y, x) - dw ViridianSchoolHouse_Blocks ; blocks - dw ViridianSchoolHouse_TextPointers ; texts - dw ViridianSchoolHouse_Script ; scripts - db 0 ; connections - dw ViridianSchoolHouse_Object ; objects + + map_header ViridianSchoolHouse, VIRIDIAN_SCHOOL_HOUSE, HOUSE, 0 + end_map_header diff --git a/data/mapHeaders/WardensHouse.asm b/data/mapHeaders/WardensHouse.asm index 6c6b0f6c..08216f59 100755 --- a/data/mapHeaders/WardensHouse.asm +++ b/data/mapHeaders/WardensHouse.asm @@ -1,8 +1,3 @@ -WardensHouse_h:: - db LAB ; tileset - db WARDENS_HOUSE_HEIGHT, WARDENS_HOUSE_WIDTH ; dimensions (y, x) - dw WardensHouse_Blocks ; blocks - dw WardensHouse_TextPointers ; texts - dw WardensHouse_Script ; scripts - db 0 ; connections - dw WardensHouse_Object ; objects + + map_header WardensHouse, WARDENS_HOUSE, LAB, 0 + end_map_header diff --git a/macros/data_macros.asm b/macros/data_macros.asm index 371247d3..794b75f7 100755 --- a/macros/data_macros.asm +++ b/macros/data_macros.asm @@ -144,94 +144,101 @@ warp_to: MACRO EVENT_DISP \3, \2, \1 ENDM -;\1 (byte) = current map id -;\2 (byte) = connected map id -;\3 (byte) = x movement of connection strip -;\4 (byte) = connection strip offset -;\5 (word) = connected map blocks pointer -NORTH_MAP_CONNECTION: MACRO - db \2 ; map id - dw \5 + (\2_WIDTH * (\2_HEIGHT - 3)) + \4; "Connection Strip" location - dw wOverworldMap + 3 + \3 ; current map position - IF (\1_WIDTH < \2_WIDTH) - db \1_WIDTH - \3 + 3 ; width of connection strip - ELSE - db \2_WIDTH - \4 ; width of connection strip - ENDC - db \2_WIDTH ; map width - db (\2_HEIGHT * 2) - 1 ; y alignment (y coordinate of player when entering map) - db (\3 - \4) * -2 ; x alignment (x coordinate of player when entering map) - dw wOverworldMap + 1 + (\2_HEIGHT * (\2_WIDTH + 6)) ; window (position of the upper left block after entering the map) -ENDM - -;\1 (byte) = current map id -;\2 (byte) = connected map id -;\3 (byte) = x movement of connection strip -;\4 (byte) = connection strip offset -;\5 (word) = connected map blocks pointer -;\6 (flag) = add 3 to width of connection strip (why?) -SOUTH_MAP_CONNECTION: MACRO - db \2 ; map id - dw \5 + \4 ; "Connection Strip" location - dw wOverworldMap + 3 + (\1_HEIGHT + 3) * (\1_WIDTH + 6) + \3 ; current map position - IF (\1_WIDTH < \2_WIDTH) - IF (_NARG > 5) - db \1_WIDTH - \3 + 3 ; width of connection strip - ELSE - db \1_WIDTH - \3 ; width of connection strip - ENDC - ELSE - db \2_WIDTH - \4 ; width of connection strip - ENDC - db \2_WIDTH ; map width - db 0 ; y alignment (y coordinate of player when entering map) - db (\3 - \4) * -2 ; x alignment (x coordinate of player when entering map) - dw wOverworldMap + 7 + \2_WIDTH ; window (position of the upper left block after entering the map) -ENDM - -;\1 (byte) = current map id -;\2 (byte) = connected map id -;\3 (byte) = y movement of connection strip -;\4 (byte) = connection strip offset -;\5 (word) = connected map blocks pointer -WEST_MAP_CONNECTION: MACRO - db \2 ; map id - dw \5 + (\2_WIDTH * \4) + \2_WIDTH - 3 ; "Connection Strip" location - dw wOverworldMap + (\1_WIDTH + 6) * (\3 + 3) ; current map position - IF (\1_HEIGHT < \2_HEIGHT) - db \1_HEIGHT - \3 + 3 ; height of connection strip - ELSE - db \2_HEIGHT - \4 ; height of connection strip - ENDC - db \2_WIDTH ; map width - db (\3 - \4) * -2 ; y alignment - db (\2_WIDTH * 2) - 1 ; x alignment - dw wOverworldMap + 6 + (2 * \2_WIDTH) ; window (position of the upper left block after entering the map) -ENDM - -;\1 (byte) = current map id -;\2 (byte) = connected map id -;\3 (byte) = y movement of connection strip -;\4 (byte) = connection strip offset -;\5 (word) = connected map blocks pointer -;\6 (flag) = add 3 to height of connection strip (why?) -EAST_MAP_CONNECTION: MACRO - db \2 ; map id - dw \5 + (\2_WIDTH * \4) ; "Connection Strip" location - dw wOverworldMap - 3 + (\1_WIDTH + 6) * (\3 + 4) ; current map position - IF (\1_HEIGHT < \2_HEIGHT) - IF (_NARG > 5) - db \1_HEIGHT - \3 + 3 ; height of connection strip - ELSE - db \1_HEIGHT - \3 ; height of connection strip - ENDC - ELSE - db \2_HEIGHT - \4 ; height of connection strip - ENDC - db \2_WIDTH ; map width - db (\3 - \4) * -2 ; y alignment - db 0 ; x alignment - dw wOverworldMap + 7 + \2_WIDTH ; window (position of the upper left block after entering the map) +map_header: MACRO +;\1: map name +;\2: map id +;\3: tileset +;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none +CURRENT_MAP_WIDTH = \2_WIDTH +CURRENT_MAP_HEIGHT = \2_HEIGHT +CURRENT_MAP_OBJECT EQUS "\1_Object" +\1_h:: + db \3 + db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH + dw \1_Blocks + dw \1_TextPointers + dw \1_Script + db \4 +ENDM + +end_map_header: MACRO + dw CURRENT_MAP_OBJECT +PURGE CURRENT_MAP_WIDTH +PURGE CURRENT_MAP_HEIGHT +PURGE CURRENT_MAP_OBJECT +ENDM + +; Connections go in order: north, south, west, east +connection: MACRO +;\1: direction +;\2: map name +;\3: map id +;\4: offset of the target map relative to the current map +; (x offset for east/west, y offset for north/south) + +; Calculate tile offsets for source (current) and target maps +_src = 0 +_tgt = (\4) + 3 +if _tgt < 2 +_src = -_tgt +_tgt = 0 +endc + +if "\1" == "north" +_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src +_map = _tgt +_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 +_y = \3_HEIGHT * 2 - 1 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "south" +_blk = _src +_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt +_win = \3_WIDTH + 7 +_y = 0 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "west" +_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 +_map = (CURRENT_MAP_WIDTH + 6) * _tgt +_win = (\3_WIDTH + 6) * 2 - 6 +_y = (\4) * -2 +_x = \3_WIDTH * 2 - 1 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +elif "\1" == "east" +_blk = (\3_WIDTH * _src) +_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 +_win = \3_WIDTH + 7 +_y = (\4) * -2 +_x = 0 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +else +fail "Invalid direction for 'connection'." +endc + + db \3 + dw \2_Blocks + _blk + dw wOverworldMap + _map + db _len - _src + db \3_WIDTH + db _y, _x + dw wOverworldMap + _win ENDM tmlearn: MACRO -- cgit v1.3.1-sl0p From 9878f01e29b1443d6c894c1332cbf381fa12646e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 16:37:47 -0400 Subject: Organize macros/ like pokecrystal While doing so I replaced the StopAllMusic macro with a SFX_STOP_ALL_MUSIC constant and applied it throughout the code. --- audio/play_battle_music.asm | 4 +- audio/pokedex_rating_sfx.asm | 2 +- constants.asm | 1 + constants/audio_constants.asm | 26 ++ constants/map_data_constants.asm | 5 + constants/map_object_constants.asm | 14 + constants/music_constants.asm | 2 + constants/sprite_data_constants.asm | 6 - data/tilesets/tileset_headers.asm | 8 + engine/battle/core.asm | 2 +- engine/events/hidden_objects/bills_house_pc.asm | 2 +- engine/events/hidden_objects/safari_game.asm | 2 +- engine/items/item_effects.asm | 4 +- engine/link/cable_club.asm | 4 +- engine/movie/credits.asm | 2 +- engine/movie/evolution.asm | 4 +- engine/movie/oak_speech/oak_speech.asm | 8 +- engine/overworld/elevator.asm | 4 +- engine/overworld/healing_machine.asm | 4 +- home.asm | 4 +- home/overworld.asm | 2 +- macros.asm | 16 +- macros/asm_macros.asm | 192 ---------- macros/audio_macros.asm | 214 ----------- macros/code.asm | 9 + macros/coords.asm | 65 ++++ macros/data.asm | 62 ++++ macros/data_macros.asm | 253 ------------- macros/enum.asm | 43 +++ macros/event_macros.asm | 441 ---------------------- macros/farcall.asm | 37 ++ macros/predef.asm | 49 +++ macros/scripts/audio.asm | 186 ++++++++++ macros/scripts/events.asm | 471 ++++++++++++++++++++++++ macros/scripts/maps.asm | 184 +++++++++ macros/scripts/text.asm | 78 ++++ macros/text_macros.asm | 80 ---- scripts/CeruleanCity.asm | 4 +- scripts/OaksLab.asm | 4 +- scripts/PalletTown.asm | 4 +- scripts/PewterPokecenter.asm | 3 +- scripts/PokemonTower2F.asm | 4 +- scripts/Route22.asm | 10 +- scripts/SSAnne2F.asm | 4 +- scripts/SSAnneCaptainsRoom.asm | 2 +- scripts/SilphCo7F.asm | 4 +- scripts/VermilionDock.asm | 2 +- 47 files changed, 1296 insertions(+), 1235 deletions(-) create mode 100644 constants/map_object_constants.asm delete mode 100755 macros/asm_macros.asm delete mode 100755 macros/audio_macros.asm create mode 100755 macros/code.asm create mode 100644 macros/coords.asm create mode 100755 macros/data.asm delete mode 100755 macros/data_macros.asm create mode 100644 macros/enum.asm delete mode 100755 macros/event_macros.asm create mode 100644 macros/farcall.asm create mode 100644 macros/predef.asm create mode 100755 macros/scripts/audio.asm create mode 100755 macros/scripts/events.asm create mode 100644 macros/scripts/maps.asm create mode 100755 macros/scripts/text.asm delete mode 100755 macros/text_macros.asm (limited to 'macros') diff --git a/audio/play_battle_music.asm b/audio/play_battle_music.asm index 35dd19ad..f8bfcd19 100644 --- a/audio/play_battle_music.asm +++ b/audio/play_battle_music.asm @@ -2,9 +2,9 @@ PlayBattleMusic:: xor a ld [wAudioFadeOutControl], a ld [wLowHealthAlarm], a - dec a + dec a ; SFX_STOP_ALL_MUSIC ld [wNewSoundID], a - call PlaySound ; stop music + call PlaySound call DelayFrame ld c, BANK(Music_GymLeaderBattle) ld a, [wGymLeaderNo] diff --git a/audio/pokedex_rating_sfx.asm b/audio/pokedex_rating_sfx.asm index a218d5e6..f3aace8a 100644 --- a/audio/pokedex_rating_sfx.asm +++ b/audio/pokedex_rating_sfx.asm @@ -10,7 +10,7 @@ PlayPokedexRatingSfx:: jr .getSfxPointer .gotSfxPointer push bc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySoundWaitForCurrent pop bc diff --git a/constants.asm b/constants.asm index 996458a4..cd306680 100644 --- a/constants.asm +++ b/constants.asm @@ -29,6 +29,7 @@ INCLUDE "constants/palette_constants.asm" INCLUDE "constants/list_constants.asm" INCLUDE "constants/map_constants.asm" INCLUDE "constants/map_data_constants.asm" +INCLUDE "constants/map_object_constants.asm" INCLUDE "constants/hide_show_constants.asm" INCLUDE "constants/credits_constants.asm" INCLUDE "constants/audio_constants.asm" diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index bb2bb7f2..38719f92 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -1,3 +1,29 @@ +; pitch + const_def + const C_ ; 0 + const C# ; 1 + const D_ ; 2 + const D# ; 3 + const E_ ; 4 + const F_ ; 5 + const F# ; 6 + const G_ ; 7 + const G# ; 8 + const A_ ; 9 + const A# ; A + const B_ ; B + +; channel + const_def + const Ch1 ; 0 + const Ch2 ; 1 + const Ch3 ; 2 + const Ch4 ; 3 + const Ch5 ; 4 + const Ch6 ; 5 + const Ch7 ; 6 + const Ch8 ; 7 + ; HW sound channel register base addresses HW_CH1_BASE EQU (rNR10 % $100) HW_CH2_BASE EQU ((rNR21 % $100) - 1) diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 154c4163..4b98bdb3 100755 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -7,3 +7,8 @@ EAST EQU 1 WEST EQU 2 SOUTH EQU 4 NORTH EQU 8 + +; tileset environments +INDOOR EQU 0 +CAVE EQU 1 +OUTDOOR EQU 2 diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm new file mode 100644 index 00000000..f5fc952b --- /dev/null +++ b/constants/map_object_constants.asm @@ -0,0 +1,14 @@ +; different kinds of people events +ITEM EQU $80 +TRAINER EQU $40 + +WALK EQU $FE +STAY EQU $FF + +DOWN EQU $D0 +UP EQU $D1 +LEFT EQU $D2 +RIGHT EQU $D3 +NONE EQU $FF + +BOULDER_MOVEMENT_BYTE_2 EQU $10 diff --git a/constants/music_constants.asm b/constants/music_constants.asm index 9f726fb7..7bbe5c62 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -238,3 +238,5 @@ MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE" music_const SFX_SLOTS_NEW_SPIN, SFX_Slots_New_Spin music_const SFX_SHOOTING_STAR, SFX_Shooting_Star MAX_SFX_ID_3 EQUS "SFX_SHOOTING_STAR" + +SFX_STOP_ALL_MUSIC EQU $ff diff --git a/constants/sprite_data_constants.asm b/constants/sprite_data_constants.asm index d5788cb1..48a34446 100644 --- a/constants/sprite_data_constants.asm +++ b/constants/sprite_data_constants.asm @@ -1,9 +1,3 @@ -; different kinds of people events -ITEM EQU $80 -TRAINER EQU $40 - -BOULDER_MOVEMENT_BYTE_2 EQU $10 - ; sprite facing directions SPRITE_FACING_DOWN EQU $00 SPRITE_FACING_UP EQU $04 diff --git a/data/tilesets/tileset_headers.asm b/data/tilesets/tileset_headers.asm index d8e0d9b4..8f825330 100755 --- a/data/tilesets/tileset_headers.asm +++ b/data/tilesets/tileset_headers.asm @@ -1,3 +1,11 @@ +tileset: MACRO + db BANK(\2) ; BANK(GFX) + dw \1, \2, \3 ; Block, GFX, Coll + db \4, \5, \6 ; counter tiles + db \7 ; grass tile + db \8 ; permission (indoor, cave, outdoor) +ENDM + Tilesets: tileset Overworld_Block, Overworld_GFX, Overworld_Coll, $FF,$FF,$FF, $52, OUTDOOR tileset RedsHouse1_Block, RedsHouse1_GFX, RedsHouse1_Coll, $FF,$FF,$FF, $FF, INDOOR diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 86c3f5e5..647436ff 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -958,7 +958,7 @@ TrainerDefeatedText: PlayBattleVictoryMusic: push af - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySoundWaitForCurrent ld c, BANK(Music_DefeatedTrainer) diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index 1ffb6954..836aace0 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -52,7 +52,7 @@ BillsHouseInitiatedText:: TX_FAR _BillsHouseInitiatedText TX_BLINK TX_ASM - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, 16 diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index 785bab7f..68fc943f 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -27,7 +27,7 @@ SafariZoneGameOver: call EnableAutoTextBoxDrawing xor a ld [wAudioFadeOutControl], a - dec a + dec a ; SFX_STOP_ALL_MUSIC call PlaySound ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index e1723118..1214a3f8 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1844,8 +1844,8 @@ PlayedFluteHadEffectText: and a jr nz, .done ; play out-of-battle pokeflute music - ld a, $ff - call PlaySound ; turn off music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, SFX_POKEFLUTE ld c, BANK(SFX_Pokeflute) call PlayMusic diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 141ed396..8aadf1e5 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -139,7 +139,7 @@ CableClub_DoBattleOrTradeAgain: call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ld [rIE], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK @@ -261,7 +261,7 @@ CableClub_DoBattleOrTradeAgain: ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index f6900602..dd735df6 100755 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -21,7 +21,7 @@ HallOfFamePC: ld a, %11000000 ld [rBGP], a call EnableLCD - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySoundWaitForCurrent ld c, BANK(Music_Credits) ld a, MUSIC_CREDITS diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index 731735c5..af2ed13b 100755 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -9,7 +9,7 @@ EvolveMon: xor a ld [wLowHealthAlarm], a ld [wChannelSoundIDs + Ch5], a - dec a + dec a ; SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, $1 @@ -67,7 +67,7 @@ EvolveMon: ld a, [wEvoNewSpecies] .done ld [wWholeScreenPaletteMonSpecies], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, [wWholeScreenPaletteMonSpecies] diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index b1acfb65..fdcb4778 100755 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -32,8 +32,8 @@ SetDefaultNames: jp CopyData OakSpeech: - ld a, $FF - call PlaySound ; stop music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, BANK(Music_Routes2) ld c, a ld a, MUSIC_ROUTES2 @@ -133,9 +133,9 @@ OakSpeech: ld [wAudioSavedROMBank], a ld a, 10 ld [wAudioFadeOutControl], a - ld a, $FF + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a - call PlaySound ; stop music + call PlaySound pop af ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index d36e2f2c..05ca08c9 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -4,7 +4,7 @@ ShakeElevator:: ld de, SCREEN_HEIGHT * $20 call ShakeElevatorRedrawRow call Delay3 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSCY] ld d, a @@ -27,7 +27,7 @@ ShakeElevator:: jr nz, .shakeLoop ld a, d ld [hSCY], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 510f963b..836af44d 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -17,7 +17,7 @@ AnimateHealingMachine: call CopyHealingMachineOAM ld a, 4 ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .waitLoop @@ -38,7 +38,7 @@ AnimateHealingMachine: cp BANK(Audio3_UpdateMusic) ld [wAudioSavedROMBank], a jr nz, .next - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, BANK(Music_PkmnHealed) diff --git a/home.asm b/home.asm index bb581454..07cb6c0e 100644 --- a/home.asm +++ b/home.asm @@ -939,7 +939,7 @@ FadeOutAudio:: ld b, a xor a ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, [wAudioSavedROMBank] @@ -2506,7 +2506,7 @@ PlayTrainerMusic:: ret nz xor a ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, BANK(Music_MeetEvilTrainer) ld [wAudioROMBank], a diff --git a/home/overworld.asm b/home/overworld.asm index 460ce11e..cc8c498c 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -772,7 +772,7 @@ HandleBlackOut:: StopMusic:: ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .wait diff --git a/macros.asm b/macros.asm index b779ec5f..a092d25c 100644 --- a/macros.asm +++ b/macros.asm @@ -1,5 +1,11 @@ -INCLUDE "macros/asm_macros.asm" -INCLUDE "macros/data_macros.asm" -INCLUDE "macros/text_macros.asm" -INCLUDE "macros/audio_macros.asm" -INCLUDE "macros/event_macros.asm" +INCLUDE "macros/enum.asm" +INCLUDE "macros/predef.asm" +INCLUDE "macros/farcall.asm" +INCLUDE "macros/data.asm" +INCLUDE "macros/code.asm" +INCLUDE "macros/coords.asm" + +INCLUDE "macros/scripts/audio.asm" +INCLUDE "macros/scripts/maps.asm" +INCLUDE "macros/scripts/events.asm" +INCLUDE "macros/scripts/text.asm" diff --git a/macros/asm_macros.asm b/macros/asm_macros.asm deleted file mode 100755 index d3f00b0c..00000000 --- a/macros/asm_macros.asm +++ /dev/null @@ -1,192 +0,0 @@ - -lb: MACRO ; r, hi, lo - ld \1, ((\2) & $ff) << 8 + ((\3) & $ff) -ENDM - -homecall: MACRO - ld a, [H_LOADEDROMBANK] - push af - ld a, BANK(\1) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call \1 - pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a -ENDM - -farcall EQUS "callba" - -callba: MACRO - ld b, BANK(\1) - ld hl, \1 - call Bankswitch -ENDM - -callab: MACRO - ld hl, \1 - ld b, BANK(\1) - call Bankswitch -ENDM - -jpba: MACRO - ld b, BANK(\1) - ld hl, \1 - jp Bankswitch -ENDM - -jpab: MACRO - ld hl, \1 - ld b, BANK(\1) - jp Bankswitch -ENDM - -validateCoords: MACRO - IF \1 >= SCREEN_WIDTH - fail "x coord out of range" - ENDC - IF \2 >= SCREEN_HEIGHT - fail "y coord out of range" - ENDC -ENDM - -;\1 = r -;\2 = X -;\3 = Y -;\4 = which tilemap (optional) -coord: MACRO - validateCoords \2, \3 - IF _NARG >= 4 - ld \1, \4 + SCREEN_WIDTH * \3 + \2 - ELSE - ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -aCoord: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - ld a, [\3 + SCREEN_WIDTH * \2 + \1] - ELSE - ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -Coorda: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - ld [\3 + SCREEN_WIDTH * \2 + \1], a - ELSE - ld [wTileMap + SCREEN_WIDTH * \2 + \1], a - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -dwCoord: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - dw \3 + SCREEN_WIDTH * \2 + \1 - ELSE - dw wTileMap + SCREEN_WIDTH * \2 + \1 - ENDC -ENDM - -;\1 = r -;\2 = X -;\3 = Y -;\4 = map width -overworldMapCoord: MACRO - ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2))) -ENDM - -; macro for two nibbles -dn: MACRO - db (\1 << 4 | \2) -ENDM - -; macro for putting a byte then a word -dbw: MACRO - db \1 - dw \2 -ENDM - -dba: MACRO - dbw BANK(\1), \1 -ENDM - -dwb: MACRO - dw \1 - db \2 -ENDM - -dab: MACRO - dwb \1, BANK(\1) -ENDM - -dbbw: MACRO - db \1, \2 - dw \3 -ENDM - -; Predef macro. -predef_const: MACRO - const \1PredefID -ENDM - -add_predef: MACRO -\1Predef:: - db BANK(\1) - dw \1 -ENDM - -predef_id: MACRO - ld a, (\1Predef - PredefPointers) / 3 -ENDM - -predef: MACRO - predef_id \1 - call Predef -ENDM - -predef_jump: MACRO - predef_id \1 - jp Predef -ENDM - -tx_pre_const: MACRO - const \1_id -ENDM - -add_tx_pre: MACRO -\1_id:: dw \1 -ENDM - -db_tx_pre: MACRO - db (\1_id - TextPredefs) / 2 + 1 -ENDM - -tx_pre_id: MACRO - ld a, (\1_id - TextPredefs) / 2 + 1 -ENDM - -tx_pre: MACRO - tx_pre_id \1 - call PrintPredefTextID -ENDM - -tx_pre_jump: MACRO - tx_pre_id \1 - jp PrintPredefTextID -ENDM - -ldPal: MACRO - ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5 -ENDM diff --git a/macros/audio_macros.asm b/macros/audio_macros.asm deleted file mode 100755 index 95b9ecbc..00000000 --- a/macros/audio_macros.asm +++ /dev/null @@ -1,214 +0,0 @@ - -StopAllMusic: MACRO - ld a, $ff - call PlaySound -ENDM - -Ch1 EQU 0 -Ch2 EQU 1 -Ch3 EQU 2 -Ch4 EQU 3 -Ch5 EQU 4 -Ch6 EQU 5 -Ch7 EQU 6 -Ch8 EQU 7 - -audio_header: MACRO - db (_NARG - 2) << 6 | \2 - dw \1_\2 - IF _NARG > 2 - db \3 - dw \1_\3 - ENDC - IF _NARG > 3 - db \4 - dw \1_\4 - ENDC - IF _NARG > 4 - db \5 - dw \1_\5 - ENDC -ENDM - -; arguments: length [0, 7], pitch change [-7, 7] -; length: length of time between pitch shifts -; sometimes used with a value >7 in which case the MSB is ignored -; pitch change: positive value means increase in pitch, negative value means decrease in pitch -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -pitch_sweep: MACRO - db $10 - IF \2 < 0 - db (\1 << 4) | (%1000 | (\2 * -1)) - ELSE - db (\1 << 4) | \2 - ENDC -ENDM - -; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -square_note: MACRO - db $20 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC - dw \4 -ENDM - -; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -noise_note: MACRO - db $20 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC - db \4 -ENDM - -C_ EQU $0 -C# EQU $1 -D_ EQU $2 -D# EQU $3 -E_ EQU $4 -F_ EQU $5 -F# EQU $6 -G_ EQU $7 -G# EQU $8 -A_ EQU $9 -A# EQU $A -B_ EQU $B - -; arguments: pitch, length [1, 16] -note: MACRO - db (\1 << 4) | (\2 - 1) -ENDM - -; arguments: instrument [1, 19], length [1, 16] -drum_note: MACRO - db $B0 | (\2 - 1) - db \1 -ENDM - -; arguments: instrument, length [1, 16] -; like drum_note but one 1 byte instead of 2 -; can only be used with instruments 1-10, excluding 2 -; unused -drum_note_short: MACRO - db (\1 << 4) | (\2 - 1) -ENDM - -; arguments: length [1, 16] -rest: MACRO - db $C0 | (\1 - 1) -ENDM - -; arguments: speed [0, 15], volume [0, 15], fade [-7, 7] -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -note_type: MACRO - db $D0 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC -ENDM - -; arguments: speed [0, 15] -drum_speed: MACRO - db $D0 | \1 -ENDM - -; arguments: octave [1, 8] -octave: MACRO - db $E8 - \1 -ENDM - -; when enabled, effective frequency used is incremented by 1 -toggle_perfect_pitch: MACRO - db $E8 -ENDM - -; arguments: delay [0, 255], depth [0, 15], rate [0, 15] -; delay: time delay until vibrato effect begins -; depth: amplitude of vibrato wave -; rate: frequency of vibrato wave -vibrato: MACRO - db $EA - db \1 - db (\2 << 4) | \3 -ENDM - -; arguments: length [1, 256], octave [1, 8], pitch -pitch_slide: MACRO - db $EB - db \1 - 1 - db ((8 - \2) << 4) | \3 -ENDM - -; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) -duty_cycle: MACRO - db $EC - db \1 -ENDM - -; arguments: tempo [0, $ffff] -; used to calculate note delay counters -; so a smaller value means music plays faster -; ideally should be set to $100 or less to guarantee no overflow -; if larger than $100, large note speed or note length values might cause overflow -; stored in big endian -tempo: MACRO - db $ED - db \1 / $100 - db \1 % $100 -ENDM - -; arguments: left output enable mask, right output enable mask -stereo_panning: MACRO - db $EE - db (\1 << 4) | \2 -ENDM - -; arguments: left master volume [0, 7], right master volume [0, 7] -volume: MACRO - db $F0 - db (\1 << 4) | \2 -ENDM - -; when enabled, the sfx data is interpreted as music data -execute_music: MACRO - db $F8 -ENDM - -; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 -duty_cycle_pattern: MACRO - db $FC - db \1 << 6 | \2 << 4 | \3 << 2 | \4 -ENDM - -; arguments: address -sound_call: MACRO - db $FD - dw \1 -ENDM - -; arguments: count, address -sound_loop: MACRO - db $FE - db \1 - dw \2 -ENDM - -sound_ret: MACRO - db $FF -ENDM diff --git a/macros/code.asm b/macros/code.asm new file mode 100755 index 00000000..8b7d6184 --- /dev/null +++ b/macros/code.asm @@ -0,0 +1,9 @@ +; Syntactic sugar macros + +lb: MACRO ; r, hi, lo + ld \1, ((\2) & $ff) << 8 + ((\3) & $ff) +ENDM + +ldPal: MACRO + ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5 +ENDM diff --git a/macros/coords.asm b/macros/coords.asm new file mode 100644 index 00000000..302260d7 --- /dev/null +++ b/macros/coords.asm @@ -0,0 +1,65 @@ +validateCoords: MACRO + IF \1 >= SCREEN_WIDTH + fail "x coord out of range" + ENDC + IF \2 >= SCREEN_HEIGHT + fail "y coord out of range" + ENDC +ENDM + +;\1 = r +;\2 = X +;\3 = Y +;\4 = which tilemap (optional) +coord: MACRO + validateCoords \2, \3 + IF _NARG >= 4 + ld \1, \4 + SCREEN_WIDTH * \3 + \2 + ELSE + ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +aCoord: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + ld a, [\3 + SCREEN_WIDTH * \2 + \1] + ELSE + ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +Coorda: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + ld [\3 + SCREEN_WIDTH * \2 + \1], a + ELSE + ld [wTileMap + SCREEN_WIDTH * \2 + \1], a + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +dwCoord: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + dw \3 + SCREEN_WIDTH * \2 + \1 + ELSE + dw wTileMap + SCREEN_WIDTH * \2 + \1 + ENDC +ENDM + +;\1 = r +;\2 = X +;\3 = Y +;\4 = map width +overworldMapCoord: MACRO + ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2))) +ENDM diff --git a/macros/data.asm b/macros/data.asm new file mode 100755 index 00000000..54d1d561 --- /dev/null +++ b/macros/data.asm @@ -0,0 +1,62 @@ +; Value macros + +percent EQUS "* $ff / 100" + +bcd2: MACRO + dn ((\1) / 1000) % 10, ((\1) / 100) % 10 + dn ((\1) / 10) % 10, (\1) % 10 +ENDM + +bcd3: MACRO + dn ((\1) / 100000) % 10, ((\1) / 10000) % 10 + dn ((\1) / 1000) % 10, ((\1) / 100) % 10 + dn ((\1) / 10) % 10, (\1) % 10 +ENDM + +coins equs "bcd2" +money equs "bcd3" + +RGB: MACRO + dw (\3 << 10 | \2 << 5 | \1) +ENDM + +tmlearn: MACRO +x = 0 + REPT _NARG +IF \1 != 0 +x = x | (1 << ((\1 - 1) % 8)) +ENDC + SHIFT + ENDR + db x +ENDM + + +; Constant data (db, dw, dl) macros + +dn: MACRO ; nybbles + db (\1 << 4 | \2) +ENDM + +dbw: MACRO + db \1 + dw \2 +ENDM + +dba: MACRO + dbw BANK(\1), \1 +ENDM + +dwb: MACRO + dw \1 + db \2 +ENDM + +dab: MACRO + dwb \1, BANK(\1) +ENDM + +dbbw: MACRO + db \1, \2 + dw \3 +ENDM diff --git a/macros/data_macros.asm b/macros/data_macros.asm deleted file mode 100755 index 794b75f7..00000000 --- a/macros/data_macros.asm +++ /dev/null @@ -1,253 +0,0 @@ - -; Constant enumeration is useful for monsters, items, moves, etc. -const_def: MACRO -if _NARG >= 1 -const_value = \1 -else -const_value = 0 -endc -ENDM - -const: MACRO -\1 EQU const_value -const_value = const_value + 1 -ENDM - -; data format macros - -percent EQUS "* $ff / 100" - -bcd2: MACRO - dn ((\1) / 1000) % 10, ((\1) / 100) % 10 - dn ((\1) / 10) % 10, (\1) % 10 -ENDM - -bcd3: MACRO - dn ((\1) / 100000) % 10, ((\1) / 10000) % 10 - dn ((\1) / 1000) % 10, ((\1) / 100) % 10 - dn ((\1) / 10) % 10, (\1) % 10 -ENDM - -coins equs "bcd2" -money equs "bcd3" - -;\1 = Map Width -;\2 = Rows above (Y-blocks) -;\3 = X movement (X-blocks) -EVENT_DISP: MACRO - dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\2) >> 1) + ((\3) >> 1)) ; Ev.Disp - db \2,\3 ;Y,X -ENDM - -FLYWARP_DATA: MACRO - EVENT_DISP \1,\2,\3 - db ((\2) & $01) ;sub-block Y - db ((\3) & $01) ;sub-block X -ENDM - -; external map entry macro -EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer -; the appearance of towns and routes in the town map, indexed by map id - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - dn \2, \1 - dw \3 -ENDM - -; internal map entry macro -IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer -; the appearance of buildings and dungeons in the town map - ; byte : maximum map id subject to this rule - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - db \1 + 1 - dn \3, \2 - dw \4 -ENDM - -; tilesets' headers macro -tileset: MACRO - db BANK(\2) ; BANK(GFX) - dw \1, \2, \3 ; Block, GFX, Coll - db \4, \5, \6 ; counter tiles - db \7 ; grass tile - db \8 ; permission (indoor, cave, outdoor) -ENDM - -INDOOR EQU 0 -CAVE EQU 1 -OUTDOOR EQU 2 - -RGB: MACRO - dw (\3 << 10 | \2 << 5 | \1) -ENDM - -WALK EQU $FE -STAY EQU $FF - -DOWN EQU $D0 -UP EQU $D1 -LEFT EQU $D2 -RIGHT EQU $D3 -NONE EQU $FF - -;\1 sprite id -;\2 x position -;\3 y position -;\4 movement (WALK/STAY) -;\5 range or direction -;\6 text id -;\7 items only: item id -;\7 trainers only: trainer class/pokemon id -;\8 trainers only: trainer number/pokemon level -object: MACRO - db \1 - db \3 + 4 - db \2 + 4 - db \4 - db \5 - IF (_NARG > 7) - db TRAINER | \6 - db \7 - db \8 - ELSE - IF (_NARG > 6) - db ITEM | \6 - db \7 - ELSE - db \6 - ENDC - ENDC -ENDM - -;\1 x position -;\2 y position -;\3 destination warp id -;\4 destination map (-1 = wLastMap) -warp: MACRO - db \2, \1, \3, \4 -ENDM - -;\1 x position -;\2 y position -;\3 sign id -sign: MACRO - db \2, \1, \3 -ENDM - -;\1 x position -;\2 y position -;\3 map width -warp_to: MACRO - EVENT_DISP \3, \2, \1 -ENDM - -map_header: MACRO -;\1: map name -;\2: map id -;\3: tileset -;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none -CURRENT_MAP_WIDTH = \2_WIDTH -CURRENT_MAP_HEIGHT = \2_HEIGHT -CURRENT_MAP_OBJECT EQUS "\1_Object" -\1_h:: - db \3 - db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH - dw \1_Blocks - dw \1_TextPointers - dw \1_Script - db \4 -ENDM - -end_map_header: MACRO - dw CURRENT_MAP_OBJECT -PURGE CURRENT_MAP_WIDTH -PURGE CURRENT_MAP_HEIGHT -PURGE CURRENT_MAP_OBJECT -ENDM - -; Connections go in order: north, south, west, east -connection: MACRO -;\1: direction -;\2: map name -;\3: map id -;\4: offset of the target map relative to the current map -; (x offset for east/west, y offset for north/south) - -; Calculate tile offsets for source (current) and target maps -_src = 0 -_tgt = (\4) + 3 -if _tgt < 2 -_src = -_tgt -_tgt = 0 -endc - -if "\1" == "north" -_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src -_map = _tgt -_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 -_y = \3_HEIGHT * 2 - 1 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc - -elif "\1" == "south" -_blk = _src -_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt -_win = \3_WIDTH + 7 -_y = 0 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc - -elif "\1" == "west" -_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 -_map = (CURRENT_MAP_WIDTH + 6) * _tgt -_win = (\3_WIDTH + 6) * 2 - 6 -_y = (\4) * -2 -_x = \3_WIDTH * 2 - 1 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc - -elif "\1" == "east" -_blk = (\3_WIDTH * _src) -_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 -_win = \3_WIDTH + 7 -_y = (\4) * -2 -_x = 0 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc - -else -fail "Invalid direction for 'connection'." -endc - - db \3 - dw \2_Blocks + _blk - dw wOverworldMap + _map - db _len - _src - db \3_WIDTH - db _y, _x - dw wOverworldMap + _win -ENDM - -tmlearn: MACRO -x = 0 - REPT _NARG -IF \1 != 0 -x = x | (1 << ((\1 - 1) % 8)) -ENDC - SHIFT - ENDR - db x -ENDM diff --git a/macros/enum.asm b/macros/enum.asm new file mode 100644 index 00000000..8fe5b534 --- /dev/null +++ b/macros/enum.asm @@ -0,0 +1,43 @@ +; Enumerate variables + +enum_start: MACRO +if _NARG >= 1 +__enum__ = \1 +else +__enum__ = 0 +endc +if _NARG >= 2 +__enumdir__ = \2 +else +__enumdir__ = 1 +endc +ENDM + +enum: MACRO +\1 EQU __enum__ +__enum__ = __enum__ + __enumdir__ +ENDM + +enum_set: MACRO +__enum__ = \1 +ENDM + +; Enumerate constants + +const_def: MACRO +if _NARG >= 1 +const_value = \1 +else +const_value = 0 +endc +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM + +shift_const: MACRO +\1 EQU (1 << const_value) +const_value = const_value + 1 +ENDM diff --git a/macros/event_macros.asm b/macros/event_macros.asm deleted file mode 100755 index 20027209..00000000 --- a/macros/event_macros.asm +++ /dev/null @@ -1,441 +0,0 @@ -;\1 = event index -;\2 = return result in carry instead of zero flag -CheckEvent: MACRO -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - - IF _NARG > 1 - IF ((\1) % 8) == 7 - add a - ELSE - REPT ((\1) % 8) + 1 - rrca - ENDR - ENDC - ELSE - bit (\1) % 8, a - ENDC - ENDM - -;\1 = event index -CheckEventReuseA: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - ENDC - - bit (\1) % 8, a - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseA: MACRO -event_byte = ((\2) / 8) - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - ENDC - - bit (\1) % 8, a - ENDM - -;\1 = reg -;\2 = event index -;\3 = event index this event is relative to (optional, this is needed when there is a fixed flag address) -EventFlagBit: MACRO - IF _NARG > 2 - ld \1, ((\3) % 8) + ((\2) - (\3)) - ELSE - ld \1, (\2) % 8 - ENDC - ENDM - -;\1 = reg -;\2 = event index -EventFlagAddress: MACRO -event_byte = ((\2) / 8) - ld \1, wEventFlags + event_byte - ENDM - -;\1 = event index -CheckEventHL: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckEventReuseHL: MACRO -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - bit (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -CheckEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndSetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - set (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndResetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - res (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndSetEventA: MACRO - ld a, [wEventFlags + ((\1) / 8)] - bit (\1) % 8, a - set (\1) % 8, a - ld [wEventFlags + ((\1) / 8)], a - ENDM - -;\1 = event index -CheckAndResetEventA: MACRO - ld a, [wEventFlags + ((\1) / 8)] - bit (\1) % 8, a - res (\1) % 8, a - ld [wEventFlags + ((\1) / 8)], a - ENDM - -;\1 = event index -SetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - set (\1) % 8, [hl] - ENDM - -;\1 = event index -SetEventReuseHL: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - set (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -SetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - set (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -SetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - set (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index -;\3, \4, ... = additional (optional) event indices -SetEvents: MACRO - SetEvent \1 - rept (_NARG + -1) - SetEventReuseHL \2 - shift - endr - ENDM - -;\1 = event index -ResetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - res (\1) % 8, [hl] - ENDM - -;\1 = event index -ResetEventReuseHL: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - res (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -ResetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - res (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -ResetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - res (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index -;\3 = event index (optional) -ResetEvents: MACRO - ResetEvent \1 - rept (_NARG + -1) - ResetEventReuseHL \2 - shift - endr - ENDM - -;\1 = event index -;\2 = number of bytes away from the base address (optional, for matching the ROM) -dbEventFlagBit: MACRO - IF _NARG > 1 - db ((\1) % 8) + ((\2) * 8) - ELSE - db ((\1) % 8) - ENDC - ENDM - -;\1 = event index -;\2 = number of bytes away from the base address (optional, for matching the ROM) -dwEventFlagAddress: MACRO - IF _NARG > 1 - dw wEventFlags + ((\1) / 8) - (\2) - ELSE - dw wEventFlags + ((\1) / 8) - ENDC - ENDM - -;\1 = start -;\2 = end -SetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) - - IF event_end_byte < event_start_byte - FAIL "Incorrect argument order in SetEventRange." - ENDC - - IF event_start_byte == event_end_byte - ld a, [wEventFlags + event_start_byte] - or (1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8)) - ld [wEventFlags + event_start_byte], a - ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 - - IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 -event_fill_count = event_fill_count + 1 - ELSE - ld a, [wEventFlags + event_start_byte] - or $ff - ((1 << ((\1) % 8)) - 1) - ld [wEventFlags + event_start_byte], a - ENDC - - IF ((\2) % 8) == 7 -event_fill_count = event_fill_count + 1 - ENDC - - IF event_fill_count == 1 - ld hl, wEventFlags + event_fill_start - ld [hl], $ff - ENDC - - IF event_fill_count > 1 - ld a, $ff - ld hl, wEventFlags + event_fill_start - - REPT event_fill_count + -1 - ld [hli], a - ENDR - - ld [hl], a - ENDC - - IF ((\2) % 8) == 0 - ld hl, wEventFlags + event_end_byte - set 0, [hl] - ELSE - IF ((\2) % 8) != 7 - ld a, [wEventFlags + event_end_byte] - or (1 << (((\2) % 8) + 1)) - 1 - ld [wEventFlags + event_end_byte], a - ENDC - ENDC - ENDC - ENDM - -;\1 = start -;\2 = end -;\3 = assume a is 0 if present -ResetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) - - IF event_end_byte < event_start_byte - FAIL "Incorrect argument order in ResetEventRange." - ENDC - - IF event_start_byte == event_end_byte - ld a, [wEventFlags + event_start_byte] - and ~((1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8))) & $ff - ld [wEventFlags + event_start_byte], a - ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 - - IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 -event_fill_count = event_fill_count + 1 - ELSE - ld a, [wEventFlags + event_start_byte] - and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff - ld [wEventFlags + event_start_byte], a - ENDC - - IF ((\2) % 8) == 7 -event_fill_count = event_fill_count + 1 - ENDC - - IF event_fill_count == 1 - ld hl, wEventFlags + event_fill_start - ld [hl], 0 - ENDC - - IF event_fill_count > 1 - ld hl, wEventFlags + event_fill_start - - ; force xor a if we just to wrote to it above - IF (_NARG < 3) || (((\1) % 8) != 0) - xor a - ENDC - - REPT event_fill_count + -1 - ld [hli], a - ENDR - - ld [hl], a - ENDC - - IF ((\2) % 8) == 0 - ld hl, wEventFlags + event_end_byte - res 0, [hl] - ELSE - IF ((\2) % 8) != 7 - ld a, [wEventFlags + event_end_byte] - and ~((1 << (((\2) % 8) + 1)) - 1) & $ff - ld [wEventFlags + event_end_byte], a - ENDC - ENDC - ENDC - ENDM - -; returns whether both events are set in Z flag -; This is counter-intuitive because the other event checks set the Z flag when -; the event is not set, but this sets the Z flag when the event is set. -;\1 = event index 1 -;\2 = event index 2 -;\3 = try to reuse a (optional) -CheckBothEventsSet: MACRO - IF ((\1) / 8) == ((\2) / 8) - IF (_NARG < 3) || (((\1) / 8) != event_byte) -event_byte = ((\1) / 8) - ld a, [wEventFlags + ((\1) / 8)] - ENDC - and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - ELSE - ; This case doesn't happen in the original ROM. - IF ((\1) % 8) == ((\2) % 8) - push hl - ld a, [wEventFlags + ((\1) / 8)] - ld hl, wEventFlags + ((\2) / 8) - and [hl] - cpl - bit ((\1) % 8), a - pop hl - ELSE - push bc - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) - ld b, a - ld a, [wEventFlags + ((\2) / 8)] - and (1 << ((\2) % 8)) - or b - cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - pop bc - ENDC - ENDC - ENDM - -; returns the complement of whether either event is set in Z flag -;\1 = event index 1 -;\2 = event index 2 -CheckEitherEventSet: MACRO - IF ((\1) / 8) == ((\2) / 8) - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - ELSE - ; This case doesn't happen in the original ROM. - IF ((\1) % 8) == ((\2) % 8) - push hl - ld a, [wEventFlags + ((\1) / 8)] - ld hl, wEventFlags + ((\2) / 8) - or [hl] - bit ((\1) % 8), a - pop hl - ELSE - push bc - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) - ld b, a - ld a, [wEventFlags + ((\2) / 8)] - and (1 << ((\2) % 8)) - or b - pop bc - ENDC - ENDC - ENDM - -; for handling fixed event bits when events are inserted/removed -;\1 = event index -;\2 = fixed flag bit -AdjustEventBit: MACRO - IF ((\1) % 8) != (\2) - add ((\1) % 8) - (\2) - ENDC - ENDM diff --git a/macros/farcall.asm b/macros/farcall.asm new file mode 100644 index 00000000..fc208e3d --- /dev/null +++ b/macros/farcall.asm @@ -0,0 +1,37 @@ +farcall EQUS "callba" + +callba: MACRO + ld b, BANK(\1) + ld hl, \1 + call Bankswitch +ENDM + +callab: MACRO + ld hl, \1 + ld b, BANK(\1) + call Bankswitch +ENDM + +jpba: MACRO + ld b, BANK(\1) + ld hl, \1 + jp Bankswitch +ENDM + +jpab: MACRO + ld hl, \1 + ld b, BANK(\1) + jp Bankswitch +ENDM + +homecall: MACRO + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(\1) + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + call \1 + pop af + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a +ENDM diff --git a/macros/predef.asm b/macros/predef.asm new file mode 100644 index 00000000..fda42004 --- /dev/null +++ b/macros/predef.asm @@ -0,0 +1,49 @@ +predef_const: MACRO + const \1PredefID +ENDM + +add_predef: MACRO +\1Predef:: + db BANK(\1) + dw \1 +ENDM + +predef_id: MACRO + ld a, (\1Predef - PredefPointers) / 3 +ENDM + +predef: MACRO + predef_id \1 + call Predef +ENDM + +predef_jump: MACRO + predef_id \1 + jp Predef +ENDM + +tx_pre_const: MACRO + const \1_id +ENDM + +add_tx_pre: MACRO +\1_id:: dw \1 +ENDM + +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM + +tx_pre_id: MACRO + ld a, (\1_id - TextPredefs) / 2 + 1 +ENDM + +tx_pre: MACRO + tx_pre_id \1 + call PrintPredefTextID +ENDM + +tx_pre_jump: MACRO + tx_pre_id \1 + jp PrintPredefTextID +ENDM diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm new file mode 100755 index 00000000..8a250c63 --- /dev/null +++ b/macros/scripts/audio.asm @@ -0,0 +1,186 @@ +audio_header: MACRO + db (_NARG - 2) << 6 | \2 + dw \1_\2 + IF _NARG > 2 + db \3 + dw \1_\3 + ENDC + IF _NARG > 3 + db \4 + dw \1_\4 + ENDC + IF _NARG > 4 + db \5 + dw \1_\5 + ENDC +ENDM + +; arguments: length [0, 7], pitch change [-7, 7] +; length: length of time between pitch shifts +; sometimes used with a value >7 in which case the MSB is ignored +; pitch change: positive value means increase in pitch, negative value means decrease in pitch +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +pitch_sweep: MACRO + db $10 + IF \2 < 0 + db (\1 << 4) | (%1000 | (\2 * -1)) + ELSE + db (\1 << 4) | \2 + ENDC +ENDM + +; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +square_note: MACRO + db $20 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC + dw \4 +ENDM + +; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +noise_note: MACRO + db $20 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC + db \4 +ENDM + +; arguments: pitch, length [1, 16] +note: MACRO + db (\1 << 4) | (\2 - 1) +ENDM + +; arguments: instrument [1, 19], length [1, 16] +drum_note: MACRO + db $B0 | (\2 - 1) + db \1 +ENDM + +; arguments: instrument, length [1, 16] +; like drum_note but one 1 byte instead of 2 +; can only be used with instruments 1-10, excluding 2 +; unused +drum_note_short: MACRO + db (\1 << 4) | (\2 - 1) +ENDM + +; arguments: length [1, 16] +rest: MACRO + db $C0 | (\1 - 1) +ENDM + +; arguments: speed [0, 15], volume [0, 15], fade [-7, 7] +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +note_type: MACRO + db $D0 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC +ENDM + +; arguments: speed [0, 15] +drum_speed: MACRO + db $D0 | \1 +ENDM + +; arguments: octave [1, 8] +octave: MACRO + db $E8 - \1 +ENDM + +; when enabled, effective frequency used is incremented by 1 +toggle_perfect_pitch: MACRO + db $E8 +ENDM + +; arguments: delay [0, 255], depth [0, 15], rate [0, 15] +; delay: time delay until vibrato effect begins +; depth: amplitude of vibrato wave +; rate: frequency of vibrato wave +vibrato: MACRO + db $EA + db \1 + db (\2 << 4) | \3 +ENDM + +; arguments: length [1, 256], octave [1, 8], pitch +pitch_slide: MACRO + db $EB + db \1 - 1 + db ((8 - \2) << 4) | \3 +ENDM + +; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) +duty_cycle: MACRO + db $EC + db \1 +ENDM + +; arguments: tempo [0, $ffff] +; used to calculate note delay counters +; so a smaller value means music plays faster +; ideally should be set to $100 or less to guarantee no overflow +; if larger than $100, large note speed or note length values might cause overflow +; stored in big endian +tempo: MACRO + db $ED + db \1 / $100 + db \1 % $100 +ENDM + +; arguments: left output enable mask, right output enable mask +stereo_panning: MACRO + db $EE + db (\1 << 4) | \2 +ENDM + +; arguments: left master volume [0, 7], right master volume [0, 7] +volume: MACRO + db $F0 + db (\1 << 4) | \2 +ENDM + +; when enabled, the sfx data is interpreted as music data +execute_music: MACRO + db $F8 +ENDM + +; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 +duty_cycle_pattern: MACRO + db $FC + db \1 << 6 | \2 << 4 | \3 << 2 | \4 +ENDM + +; arguments: address +sound_call: MACRO + db $FD + dw \1 +ENDM + +; arguments: count, address +sound_loop: MACRO + db $FE + db \1 + dw \2 +ENDM + +sound_ret: MACRO + db $FF +ENDM diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm new file mode 100755 index 00000000..9be354e3 --- /dev/null +++ b/macros/scripts/events.asm @@ -0,0 +1,471 @@ +;\1 = event index +;\2 = return result in carry instead of zero flag +CheckEvent: MACRO +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + + IF _NARG > 1 + IF ((\1) % 8) == 7 + add a + ELSE + REPT ((\1) % 8) + 1 + rrca + ENDR + ENDC + ELSE + bit (\1) % 8, a + ENDC +ENDM + + +;\1 = event index +CheckEventReuseA: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDC + + bit (\1) % 8, a +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +CheckEventAfterBranchReuseA: MACRO +event_byte = ((\2) / 8) + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDC + + bit (\1) % 8, a +ENDM + + +;\1 = reg +;\2 = event index +;\3 = event index this event is relative to (optional, this is needed when there is a fixed flag address) +EventFlagBit: MACRO + IF _NARG > 2 + ld \1, ((\3) % 8) + ((\2) - (\3)) + ELSE + ld \1, (\2) % 8 + ENDC +ENDM + + +;\1 = reg +;\2 = event index +EventFlagAddress: MACRO +event_byte = ((\2) / 8) + ld \1, wEventFlags + event_byte +ENDM + + +;\1 = event index +CheckEventHL: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckEventReuseHL: MACRO +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +CheckEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +CheckEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndSetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndResetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndSetEventA: MACRO + ld a, [wEventFlags + ((\1) / 8)] + bit (\1) % 8, a + set (\1) % 8, a + ld [wEventFlags + ((\1) / 8)], a +ENDM + + +;\1 = event index +CheckAndResetEventA: MACRO + ld a, [wEventFlags + ((\1) / 8)] + bit (\1) % 8, a + res (\1) % 8, a + ld [wEventFlags + ((\1) / 8)], a +ENDM + + +;\1 = event index +SetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +SetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +SetEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + set (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +SetEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index +;\3, \4, ... = additional (optional) event indices +SetEvents: MACRO + SetEvent \1 + rept (_NARG + -1) + SetEventReuseHL \2 + shift + endr +ENDM + + +;\1 = event index +ResetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +ResetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +ResetEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + res (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +ResetEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index +;\3 = event index (optional) +ResetEvents: MACRO + ResetEvent \1 + rept (_NARG + -1) + ResetEventReuseHL \2 + shift + endr +ENDM + + +;\1 = event index +;\2 = number of bytes away from the base address (optional, for matching the ROM) +dbEventFlagBit: MACRO + IF _NARG > 1 + db ((\1) % 8) + ((\2) * 8) + ELSE + db ((\1) % 8) + ENDC +ENDM + + +;\1 = event index +;\2 = number of bytes away from the base address (optional, for matching the ROM) +dwEventFlagAddress: MACRO + IF _NARG > 1 + dw wEventFlags + ((\1) / 8) - (\2) + ELSE + dw wEventFlags + ((\1) / 8) + ENDC +ENDM + + +;\1 = start +;\2 = end +SetEventRange: MACRO +event_start_byte = ((\1) / 8) +event_end_byte = ((\2) / 8) + + IF event_end_byte < event_start_byte + FAIL "Incorrect argument order in SetEventRange." + ENDC + + IF event_start_byte == event_end_byte + ld a, [wEventFlags + event_start_byte] + or (1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8)) + ld [wEventFlags + event_start_byte], a + ELSE +event_fill_start = event_start_byte + 1 +event_fill_count = event_end_byte - event_start_byte - 1 + + IF ((\1) % 8) == 0 +event_fill_start = event_fill_start + -1 +event_fill_count = event_fill_count + 1 + ELSE + ld a, [wEventFlags + event_start_byte] + or $ff - ((1 << ((\1) % 8)) - 1) + ld [wEventFlags + event_start_byte], a + ENDC + + IF ((\2) % 8) == 7 +event_fill_count = event_fill_count + 1 + ENDC + + IF event_fill_count == 1 + ld hl, wEventFlags + event_fill_start + ld [hl], $ff + ENDC + + IF event_fill_count > 1 + ld a, $ff + ld hl, wEventFlags + event_fill_start + + REPT event_fill_count + -1 + ld [hli], a + ENDR + + ld [hl], a + ENDC + + IF ((\2) % 8) == 0 + ld hl, wEventFlags + event_end_byte + set 0, [hl] + ELSE + IF ((\2) % 8) != 7 + ld a, [wEventFlags + event_end_byte] + or (1 << (((\2) % 8) + 1)) - 1 + ld [wEventFlags + event_end_byte], a + ENDC + ENDC + ENDC +ENDM + + +;\1 = start +;\2 = end +;\3 = assume a is 0 if present +ResetEventRange: MACRO +event_start_byte = ((\1) / 8) +event_end_byte = ((\2) / 8) + + IF event_end_byte < event_start_byte + FAIL "Incorrect argument order in ResetEventRange." + ENDC + + IF event_start_byte == event_end_byte + ld a, [wEventFlags + event_start_byte] + and ~((1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8))) & $ff + ld [wEventFlags + event_start_byte], a + ELSE +event_fill_start = event_start_byte + 1 +event_fill_count = event_end_byte - event_start_byte - 1 + + IF ((\1) % 8) == 0 +event_fill_start = event_fill_start + -1 +event_fill_count = event_fill_count + 1 + ELSE + ld a, [wEventFlags + event_start_byte] + and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff + ld [wEventFlags + event_start_byte], a + ENDC + + IF ((\2) % 8) == 7 +event_fill_count = event_fill_count + 1 + ENDC + + IF event_fill_count == 1 + ld hl, wEventFlags + event_fill_start + ld [hl], 0 + ENDC + + IF event_fill_count > 1 + ld hl, wEventFlags + event_fill_start + + ; force xor a if we just to wrote to it above + IF (_NARG < 3) || (((\1) % 8) != 0) + xor a + ENDC + + REPT event_fill_count + -1 + ld [hli], a + ENDR + + ld [hl], a + ENDC + + IF ((\2) % 8) == 0 + ld hl, wEventFlags + event_end_byte + res 0, [hl] + ELSE + IF ((\2) % 8) != 7 + ld a, [wEventFlags + event_end_byte] + and ~((1 << (((\2) % 8) + 1)) - 1) & $ff + ld [wEventFlags + event_end_byte], a + ENDC + ENDC + ENDC +ENDM + + +; returns whether both events are set in Z flag +; This is counter-intuitive because the other event checks set the Z flag when +; the event is not set, but this sets the Z flag when the event is set. +;\1 = event index 1 +;\2 = event index 2 +;\3 = try to reuse a (optional) +CheckBothEventsSet: MACRO + IF ((\1) / 8) == ((\2) / 8) + IF (_NARG < 3) || (((\1) / 8) != event_byte) +event_byte = ((\1) / 8) + ld a, [wEventFlags + ((\1) / 8)] + ENDC + and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + ELSE + ; This case doesn't happen in the original ROM. + IF ((\1) % 8) == ((\2) % 8) + push hl + ld a, [wEventFlags + ((\1) / 8)] + ld hl, wEventFlags + ((\2) / 8) + and [hl] + cpl + bit ((\1) % 8), a + pop hl + ELSE + push bc + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) + ld b, a + ld a, [wEventFlags + ((\2) / 8)] + and (1 << ((\2) % 8)) + or b + cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + pop bc + ENDC + ENDC +ENDM + + +; returns the complement of whether either event is set in Z flag +;\1 = event index 1 +;\2 = event index 2 +CheckEitherEventSet: MACRO + IF ((\1) / 8) == ((\2) / 8) + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + ELSE + ; This case doesn't happen in the original ROM. + IF ((\1) % 8) == ((\2) % 8) + push hl + ld a, [wEventFlags + ((\1) / 8)] + ld hl, wEventFlags + ((\2) / 8) + or [hl] + bit ((\1) % 8), a + pop hl + ELSE + push bc + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) + ld b, a + ld a, [wEventFlags + ((\2) / 8)] + and (1 << ((\2) % 8)) + or b + pop bc + ENDC + ENDC +ENDM + + +; for handling fixed event bits when events are inserted/removed +;\1 = event index +;\2 = fixed flag bit +AdjustEventBit: MACRO + IF ((\1) % 8) != (\2) + add ((\1) % 8) - (\2) + ENDC +ENDM + diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm new file mode 100644 index 00000000..a30561b9 --- /dev/null +++ b/macros/scripts/maps.asm @@ -0,0 +1,184 @@ +;\1 map width +;\2 Rows above (Y-blocks) +;\3 X movement (X-blocks) +EVENT_DISP: MACRO + dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\2) >> 1) + ((\3) >> 1)) ; Ev.Disp + db \2,\3 ;Y,X +ENDM + +FLYWARP_DATA: MACRO + EVENT_DISP \1,\2,\3 + db ((\2) & $01) ;sub-block Y + db ((\3) & $01) ;sub-block X +ENDM + +; external map entry macro +EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer +; the appearance of towns and routes in the town map, indexed by map id + ; nybble: y-coordinate + ; nybble: x-coordinate + ; word : pointer to map name + dn \2, \1 + dw \3 +ENDM + +; internal map entry macro +IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer +; the appearance of buildings and dungeons in the town map + ; byte : maximum map id subject to this rule + ; nybble: y-coordinate + ; nybble: x-coordinate + ; word : pointer to map name + db \1 + 1 + dn \3, \2 + dw \4 +ENDM + +;\1 sprite id +;\2 x position +;\3 y position +;\4 movement (WALK/STAY) +;\5 range or direction +;\6 text id +;\7 items only: item id +;\7 trainers only: trainer class/pokemon id +;\8 trainers only: trainer number/pokemon level +object: MACRO + db \1 + db \3 + 4 + db \2 + 4 + db \4 + db \5 + IF (_NARG > 7) + db TRAINER | \6 + db \7 + db \8 + ELSE + IF (_NARG > 6) + db ITEM | \6 + db \7 + ELSE + db \6 + ENDC + ENDC +ENDM + +;\1 x position +;\2 y position +;\3 destination warp id +;\4 destination map (-1 = wLastMap) +warp: MACRO + db \2, \1, \3, \4 +ENDM + +;\1 x position +;\2 y position +;\3 sign id +sign: MACRO + db \2, \1, \3 +ENDM + +;\1 x position +;\2 y position +;\3 map width +warp_to: MACRO + EVENT_DISP \3, \2, \1 +ENDM + +;\1 map name +;\2 map id +;\3 tileset +;\4 connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none +map_header: MACRO +CURRENT_MAP_WIDTH = \2_WIDTH +CURRENT_MAP_HEIGHT = \2_HEIGHT +CURRENT_MAP_OBJECT EQUS "\1_Object" +\1_h:: + db \3 + db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH + dw \1_Blocks + dw \1_TextPointers + dw \1_Script + db \4 +ENDM + +; Comes after map_header and connection macros +end_map_header: MACRO + dw CURRENT_MAP_OBJECT +PURGE CURRENT_MAP_WIDTH +PURGE CURRENT_MAP_HEIGHT +PURGE CURRENT_MAP_OBJECT +ENDM + +; Connections go in order: north, south, west, east +;\1 direction +;\2 map name +;\3 map id +;\4 offset of the target map relative to the current map +; (x offset for east/west, y offset for north/south) +connection: MACRO + +; Calculate tile offsets for source (current) and target maps +_src = 0 +_tgt = (\4) + 3 +if _tgt < 2 +_src = -_tgt +_tgt = 0 +endc + +if "\1" == "north" +_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src +_map = _tgt +_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 +_y = \3_HEIGHT * 2 - 1 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "south" +_blk = _src +_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt +_win = \3_WIDTH + 7 +_y = 0 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "west" +_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 +_map = (CURRENT_MAP_WIDTH + 6) * _tgt +_win = (\3_WIDTH + 6) * 2 - 6 +_y = (\4) * -2 +_x = \3_WIDTH * 2 - 1 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +elif "\1" == "east" +_blk = (\3_WIDTH * _src) +_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 +_win = \3_WIDTH + 7 +_y = (\4) * -2 +_x = 0 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +else +fail "Invalid direction for 'connection'." +endc + + db \3 + dw \2_Blocks + _blk + dw wOverworldMap + _map + db _len - _src + db \3_WIDTH + db _y, _x + dw wOverworldMap + _win +ENDM diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm new file mode 100755 index 00000000..732a22d4 --- /dev/null +++ b/macros/scripts/text.asm @@ -0,0 +1,78 @@ +text EQUS "db $00," ; Start writing text. +next EQUS "db $4e," ; Move a line down. +line EQUS "db $4f," ; Start writing at the bottom line. +para EQUS "db $51," ; Start a new paragraph. +cont EQUS "db $55," ; Scroll to the next line. +done EQUS "db $57" ; End a text box. +prompt EQUS "db $58" ; Prompt the player to end a text box (initiating some other event). + +page EQUS "db $49," ; Start a new Pokedex page. +dex EQUS "db $5f, $50" ; End a Pokedex entry. + +TX_RAM: MACRO +; prints text to screen +; \1: RAM address to read from + db $1 + dw \1 +ENDM + +TX_BCD: MACRO +; \1: RAM address to read from +; \2: number of bytes + print flags + db $2 + dw \1 + db \2 +ENDM + +TX_LINE EQUS "db $05" +TX_BLINK EQUS "db $06" +;TX_SCROLL EQUS "db $07" +TX_ASM EQUS "db $08" + +TX_NUM: MACRO +; print a big-endian decimal number. +; \1: address to read from +; \2: number of bytes to read +; \3: number of digits to display + db $09 + dw \1 + db \2 << 4 | \3 +ENDM + +TX_DELAY EQUS "db $0a" +TX_SFX_ITEM_1 EQUS "db $0b" +TX_SFX_LEVEL_UP EQUS "db $0b" +;TX_ELLIPSES EQUS "db $0c" +TX_WAIT EQUS "db $0d" +;TX_SFX_DEX_RATING EQUS "db $0e" +TX_SFX_ITEM_2 EQUS "db $10" +TX_SFX_KEY_ITEM EQUS "db $11" +TX_SFX_CAUGHT_MON EQUS "db $12" +TX_SFX_DEX_PAGE_ADDED EQUS "db $13" +TX_CRY_NIDORINA EQUS "db $14" +TX_CRY_PIDGEOT EQUS "db $15" +;TX_CRY_DEWGONG EQUS "db $16" + +TX_FAR: MACRO + db $17 + dw \1 + db BANK(\1) +ENDM + +TX_VENDING_MACHINE EQUS "db $f5" +TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" +TX_PRIZE_VENDOR EQUS "db $f7" +TX_POKECENTER_PC EQUS "db $f9" +TX_PLAYERS_PC EQUS "db $fc" +TX_BILLS_PC EQUS "db $fd" + +TX_MART: MACRO + db $FE, _NARG + REPT _NARG + db \1 + SHIFT + ENDR + db $FF +ENDM + +TX_POKECENTER_NURSE EQUS "db $ff" diff --git a/macros/text_macros.asm b/macros/text_macros.asm deleted file mode 100755 index 21e02634..00000000 --- a/macros/text_macros.asm +++ /dev/null @@ -1,80 +0,0 @@ - -; text macros -text EQUS "db $00," ; Start writing text. -next EQUS "db $4e," ; Move a line down. -line EQUS "db $4f," ; Start writing at the bottom line. -para EQUS "db $51," ; Start a new paragraph. -cont EQUS "db $55," ; Scroll to the next line. -done EQUS "db $57" ; End a text box. -prompt EQUS "db $58" ; Prompt the player to end a text box (initiating some other event). - -page EQUS "db $49," ; Start a new Pokedex page. -dex EQUS "db $5f, $50" ; End a Pokedex entry. - -TX_RAM: MACRO -; prints text to screen -; \1: RAM address to read from - db $1 - dw \1 -ENDM - -TX_BCD: MACRO -; \1: RAM address to read from -; \2: number of bytes + print flags - db $2 - dw \1 - db \2 -ENDM - -TX_LINE EQUS "db $05" -TX_BLINK EQUS "db $06" -;TX_SCROLL EQUS "db $07" -TX_ASM EQUS "db $08" - -TX_NUM: MACRO -; print a big-endian decimal number. -; \1: address to read from -; \2: number of bytes to read -; \3: number of digits to display - db $09 - dw \1 - db \2 << 4 | \3 -ENDM - -TX_DELAY EQUS "db $0a" -TX_SFX_ITEM_1 EQUS "db $0b" -TX_SFX_LEVEL_UP EQUS "db $0b" -;TX_ELLIPSES EQUS "db $0c" -TX_WAIT EQUS "db $0d" -;TX_SFX_DEX_RATING EQUS "db $0e" -TX_SFX_ITEM_2 EQUS "db $10" -TX_SFX_KEY_ITEM EQUS "db $11" -TX_SFX_CAUGHT_MON EQUS "db $12" -TX_SFX_DEX_PAGE_ADDED EQUS "db $13" -TX_CRY_NIDORINA EQUS "db $14" -TX_CRY_PIDGEOT EQUS "db $15" -;TX_CRY_DEWGONG EQUS "db $16" - -TX_FAR: MACRO - db $17 - dw \1 - db BANK(\1) -ENDM - -TX_VENDING_MACHINE EQUS "db $f5" -TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" -TX_PRIZE_VENDOR EQUS "db $f7" -TX_POKECENTER_PC EQUS "db $f9" -TX_PLAYERS_PC EQUS "db $fc" -TX_BILLS_PC EQUS "db $fd" - -TX_MART: MACRO - db $FE, _NARG - REPT _NARG - db \1 - SHIFT - ENDR - db $FF -ENDM - -TX_POKECENTER_NURSE EQUS "db $ff" diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 117ec4da..94ec2496 100755 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -64,7 +64,7 @@ CeruleanCityScript0: ld a, [wWalkBikeSurfState] and a jr z, .asm_19512 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .asm_19512 @@ -171,7 +171,7 @@ CeruleanCityScript2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 11abdf65..79de99ff 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -510,7 +510,7 @@ OaksLabScript15: xor a ld [hJoyHeld], a call EnableAutoTextBoxDrawing - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart @@ -611,7 +611,7 @@ OaksLabScript16: xor a ; NPC_MOVEMENT_DOWN call FillMemory ld [hl], $ff - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 5ad7d40f..4c6ab015 100755 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -27,8 +27,8 @@ PalletTownScript0: ld [hJoyHeld], a ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a - ld a, $FF - call PlaySound ; stop music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, BANK(Music_MeetProfOak) ld c, a ld a, MUSIC_MEET_PROF_OAK ; “oak appears” music diff --git a/scripts/PewterPokecenter.asm b/scripts/PewterPokecenter.asm index 22d2fb6b..be933fee 100755 --- a/scripts/PewterPokecenter.asm +++ b/scripts/PewterPokecenter.asm @@ -21,7 +21,8 @@ PewterJigglypuffText: ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, .Text call PrintText - StopAllMusic + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld c, 32 call DelayFrames ld hl, JigglypuffFacingDirections diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 81f4c0b3..94916e37 100755 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -22,7 +22,7 @@ PokemonTower2Script0: ld hl, CoordsData_6055e call ArePlayerCoordsInArray ret nc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -76,7 +76,7 @@ PokemonTower2Script1: ld a, $1 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 7226e509..1fd7e09a 100755 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -88,7 +88,7 @@ Route22Script0: ld a, [wWalkBikeSurfState] and a jr z, .asm_50f4e - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .asm_50f4e @@ -167,7 +167,7 @@ Route22Script2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart @@ -241,11 +241,11 @@ Route22Script_5104e: ld a, [wWalkBikeSurfState] and a jr z, .skipYVisibilityTesta - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .skipYVisibilityTesta - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateTempo @@ -326,7 +326,7 @@ Route22Script5: ld a, $2 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStartAndTempo diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index ba900748..2795d1d1 100755 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -24,7 +24,7 @@ SSAnne2Script0: ld hl, CoordsData_61411 call ArePlayerCoordsInArray ret nc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -145,7 +145,7 @@ SSAnne2Script2: ld a, $2 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index de0272e4..5723c32d 100755 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -48,7 +48,7 @@ SSAnne7RubText: cp BANK(Audio3_UpdateMusic) ld [wAudioSavedROMBank], a jr nz, .asm_61908 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, Bank(Music_PkmnHealed) diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index e7594663..84a94c92 100755 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -130,7 +130,7 @@ SilphCo7Script0: ld [wJoyIgnore], a ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -219,7 +219,7 @@ SilphCo7Script4: ld a, $f ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 65b66c52..cc237f8e 100755 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -38,7 +38,7 @@ VermilionDock_Script: VermilionDock_1db9b: SetEventForceReuseHL EVENT_SS_ANNE_LEFT - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wJoyIgnore], a ld [wNewSoundID], a call PlaySound -- cgit v1.3.1-sl0p From 35deb771130a9012ee4494b1db097761f2fe2919 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 19:59:41 -0400 Subject: H_CONSTANTNAMES -> hConstantNames --- engine/battle/animations.asm | 66 ++-- engine/battle/battle_transitions.asm | 18 +- engine/battle/common_text.asm | 22 +- engine/battle/core.asm | 332 ++++++++-------- engine/battle/effects.asm | 122 +++--- engine/battle/experience.asm | 32 +- engine/battle/ghost_marowak_anim.asm | 6 +- engine/battle/move_effects/conversion.asm | 2 +- engine/battle/move_effects/drain_hp.asm | 6 +- engine/battle/move_effects/focus_energy.asm | 2 +- engine/battle/move_effects/haze.asm | 2 +- engine/battle/move_effects/heal.asm | 6 +- engine/battle/move_effects/leech_seed.asm | 2 +- engine/battle/move_effects/mist.asm | 2 +- engine/battle/move_effects/one_hit_ko.asm | 2 +- engine/battle/move_effects/paralyze.asm | 2 +- engine/battle/move_effects/pay_day.asm | 24 +- engine/battle/move_effects/recoil.asm | 4 +- .../battle/move_effects/reflect_light_screen.asm | 2 +- engine/battle/move_effects/substitute.asm | 2 +- engine/battle/move_effects/transform.asm | 8 +- engine/battle/scale_sprites.asm | 6 +- engine/battle/trainer_ai.asm | 10 +- engine/battle/unused_stats_functions.asm | 4 +- engine/debug/test_battle.asm | 2 +- engine/events/hidden_objects/museum_fossils.asm | 2 +- engine/events/hidden_objects/town_map.asm | 4 +- engine/gfx/hp_bar.asm | 16 +- engine/items/item_effects.asm | 98 ++--- engine/link/cable_club.asm | 8 +- engine/math/multiply_divide.asm | 158 ++++---- engine/menus/display_text_id_init.asm | 2 +- engine/menus/main_menu.asm | 10 +- engine/menus/naming_screen.asm | 4 +- engine/menus/party_menu.asm | 12 +- engine/menus/pokedex.asm | 6 +- engine/menus/save.asm | 12 +- engine/menus/start_sub_menus.asm | 12 +- engine/movie/credits.asm | 10 +- engine/movie/evolution.asm | 10 +- engine/movie/hall_of_fame.asm | 2 +- engine/movie/intro.asm | 4 +- engine/movie/oak_speech/oak_speech.asm | 8 +- engine/movie/oak_speech/oak_speech2.asm | 4 +- engine/movie/title.asm | 6 +- engine/movie/trade.asm | 36 +- engine/overworld/auto_movement.asm | 4 +- engine/overworld/clear_variables.asm | 2 +- engine/overworld/missable_objects.asm | 14 +- engine/overworld/movement.asm | 84 ++-- engine/overworld/push_boulder.asm | 2 +- engine/overworld/sprite_collisions.asm | 12 +- engine/overworld/trainer_sight.asm | 12 +- engine/overworld/turn_sprite.asm | 6 +- engine/overworld/update_map.asm | 6 +- engine/pokemon/add_mon.asm | 4 +- engine/pokemon/bills_pc.asm | 6 +- engine/pokemon/evos_moves.asm | 4 +- engine/pokemon/experience.asm | 50 +-- engine/pokemon/learn_move.asm | 12 +- engine/pokemon/status_screen.asm | 6 +- engine/slots/game_corner_slots.asm | 2 +- home.asm | 432 ++++++++++----------- home/audio.asm | 6 +- home/copy.asm | 6 +- home/copy2.asm | 76 ++-- home/init.asm | 6 +- home/overworld.asm | 22 +- home/pic.asm | 6 +- home/predef.asm | 8 +- home/start_menu.asm | 2 +- home/text.asm | 12 +- home/vblank.asm | 20 +- home/vcopy.asm | 116 +++--- hram.asm | 81 ++-- macros/farcall.asm | 6 +- scripts/BillsHouse.asm | 4 +- scripts/CeladonGym.asm | 2 +- scripts/CeruleanCity.asm | 12 +- scripts/CeruleanGym.asm | 2 +- scripts/ChampionsRoom.asm | 16 +- scripts/CinnabarGym.asm | 2 +- scripts/FightingDojo.asm | 4 +- scripts/FuchsiaGym.asm | 2 +- scripts/GameCorner.asm | 6 +- scripts/HallOfFame.asm | 2 +- scripts/MtMoonB2F.asm | 6 +- scripts/OaksLab.asm | 52 +-- scripts/PalletTown.asm | 6 +- scripts/PewterCity.asm | 12 +- scripts/PewterGym.asm | 2 +- scripts/PokemonTower2F.asm | 4 +- scripts/PokemonTower7F.asm | 2 +- scripts/RocketHideoutB4F.asm | 2 +- scripts/Route22.asm | 16 +- scripts/SSAnne2F.asm | 8 +- scripts/SaffronGym.asm | 2 +- scripts/SilphCo11F.asm | 8 +- scripts/SilphCo7F.asm | 8 +- scripts/TradeCenter.asm | 2 +- scripts/VermilionDock.asm | 4 +- scripts/VermilionGym.asm | 2 +- scripts/ViridianGym.asm | 2 +- scripts/WardensHouse.asm | 2 +- 104 files changed, 1163 insertions(+), 1164 deletions(-) (limited to 'macros') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 4f75aab9..c16fa3ec 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -308,7 +308,7 @@ LoadSubanimation: ; sets the transform to the subanimation type if it's the enemy's turn GetSubanimationTransform1: ld b, a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, b ret nz @@ -319,7 +319,7 @@ GetSubanimationTransform1: ; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn ; sets the transform to 0 (i.e. no transform) if it's the enemy's turn GetSubanimationTransform2: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, 2 << 5 ret z @@ -421,7 +421,7 @@ MoveAnimation: ShareMoveAnimations: ; some moves just reuse animations from status conditions - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ret z @@ -920,16 +920,16 @@ AnimationDelay10: ; calls a function with the turn flipped from player to enemy or vice versa ; input - hl - address of function to call CallWithTurnFlipped: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] push af xor 1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld de, .returnAddress push de jp hl .returnAddress pop af - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ret ; flashes the screen for an extended period (48 frames) @@ -1133,7 +1133,7 @@ _AnimationWaterDroplets: AnimationSlideMonUp: ; Slides the mon's sprite upwards. ld c, 7 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 1, 6 coord de, 1, 5 @@ -1201,7 +1201,7 @@ _AnimationSlideMonUp: jr nz, .slideLoop ; Fill in the bottom row of the mon pic with the next row's tile IDs. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 1, 11 jr z, .next @@ -1370,7 +1370,7 @@ AnimationShowEnemyMonPic: AnimationShakeBackAndForth: ; Shakes the mon's sprite back and forth rapidly. This is used in Double Team. ; The mon's sprite disappears after this animation. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 0, 5 coord de, 2, 5 @@ -1418,7 +1418,7 @@ AnimationMoveMonHorizontally: ; Shifts the mon's sprite horizontally to a fixed location. Used by lots of ; animations like Tackle/Body Slam. call AnimationHideMonPic - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 2, 5 jr z, .next @@ -1434,7 +1434,7 @@ AnimationMoveMonHorizontally: AnimationResetMonPosition: ; Resets the mon's sprites to be located at the normal coordinates. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, 5 * SCREEN_WIDTH + 2 jr z, .next @@ -1446,7 +1446,7 @@ AnimationResetMonPosition: AnimationSpiralBallsInward: ; Creates an effect that looks like energy balls spiralling into the ; player mon's sprite. Used in Focus Energy, for example. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn ld a, -40 @@ -1530,7 +1530,7 @@ AnimationSquishMonPic: ld c, 4 .loop push bc - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn coord hl, 16, 0 @@ -1583,7 +1583,7 @@ _AnimationSquishMonPic: AnimationShootBallsUpward: ; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack ; animations. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn lb bc, 0, 16 * 8 @@ -1651,7 +1651,7 @@ _AnimationShootBallsUpward: AnimationShootManyBallsUpward: ; Shoots several pillars of "energy" balls upward. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, UpwardBallsAnimXCoordinatesPlayerTurn ld a, $50 ; y coordinate for "energy" ball pillar @@ -1743,7 +1743,7 @@ AnimationSlideMonDownAndHide: _AnimationSlideMonOff: ; Slides the mon's sprite off the screen horizontally by e tiles and waits ; [wSlideMonDelay] V-blanks each time the pic is slid by one tile. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn coord hl, 12, 0 @@ -1758,7 +1758,7 @@ _AnimationSlideMonOff: .rowLoop ; iterates once for each row ld c, 8 .tileLoop ; iterates once for each tile in the row - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn2 call .EnemyNextTile @@ -1821,7 +1821,7 @@ AnimationSlideMonHalfOff: jp Delay3 CopyTempPicToMonPic: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, vBackPic ; player turn jr z, .next @@ -1837,7 +1837,7 @@ AnimationWavyScreen: call BattleAnimCopyTileMapToVRAM call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, SCREEN_HEIGHT_PIXELS ld [hWY], a ld d, $80 ; terminator @@ -1865,7 +1865,7 @@ AnimationWavyScreen: call SaveScreenTilesToBuffer2 call ClearScreen ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 call LoadScreenTilesFromBuffer2 ld hl, vBGMap1 @@ -1898,7 +1898,7 @@ AnimationSubstitute: xor a ld bc, $0310 call FillMemory - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn ld hl, SlowbroSprite ; facing down sprite @@ -1937,7 +1937,7 @@ CopySlowbroSpriteData: jp FarCopyData2 HideSubstituteShowMonAnim: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wPlayerMonMinimized ld a, [wPlayerBattleStatus2] @@ -1987,7 +1987,7 @@ AnimationTransformMon: ld [wChangeMonPicEnemyTurnSpecies], a ChangeMonPic: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] @@ -2020,11 +2020,11 @@ ChangeMonPic: AnimationHideEnemyMonPic: ; Hides the enemy mon's sprite xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, AnimationHideMonPic call CallWithTurnFlipped ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jp Delay3 InitMultipleObjectsOAM: @@ -2050,7 +2050,7 @@ InitMultipleObjectsOAM: AnimationHideMonPic: ; Hides the mon's sprite. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn ld a, 12 @@ -2078,7 +2078,7 @@ ClearMonPicFromTileMap: ; in order to show only a portion of the mon sprite. GetMonSpriteTileMapPointerFromRowCount: push de - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .enemyTurn ld a, 20 * 5 + 1 @@ -2166,7 +2166,7 @@ GetMoveSound: ld b, a call IsCryMove jr nc, .NotCryMove - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .next ld a, [wBattleMonSpecies] ; get number of current monster @@ -2211,7 +2211,7 @@ IsCryMove: INCLUDE "data/moves/sfx.asm" CopyPicTiles: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, $31 ; base tile ID of player mon sprite jr z, .next @@ -2235,7 +2235,7 @@ CopyDownscaledMonTiles: CopyTileIDs_NoBGTransfer: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ; fall through ; b = number of rows @@ -2261,7 +2261,7 @@ CopyTileIDs: dec b jr nz, .rowLoop ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a pop hl ret @@ -2624,9 +2624,9 @@ ShakeEnemyHUD_ShakeBG: BattleAnimCopyTileMapToVRAM: ld a, h - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a ld a, l - ld [H_AUTOBGTRANSFERDEST], a + ld [hAutoBGTransferDest], a jp Delay3 TossBallAnimation: diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 06b02aec..98e87dc0 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -1,6 +1,6 @@ BattleTransition: ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 xor a ld [hWY], a @@ -349,7 +349,7 @@ BattleTransition_Shrink: .loop push bc xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 0, 7 coord de, 0, 8 ld bc, -SCREEN_WIDTH * 2 @@ -367,7 +367,7 @@ BattleTransition_Shrink: ld bc, 2 call BattleTransition_CopyTiles2 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld c, 6 call DelayFrames pop bc @@ -381,7 +381,7 @@ BattleTransition_Shrink: BattleTransition_Split: ld c, SCREEN_HEIGHT / 2 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a .loop push bc coord hl, 0, 16 @@ -496,7 +496,7 @@ BattleTransition_VerticalStripes: coord hl, 0, 0 coord de, 1, 17 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a .loop push bc push hl @@ -535,7 +535,7 @@ BattleTransition_HorizontalStripes: coord hl, 0, 0 coord de, 19, 1 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a .loop push bc push hl @@ -582,7 +582,7 @@ BattleTransition_FlashScreen: ld b, $3 call BattleTransition_FlashScreen_ xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret BattleTransition_Circle_Sub1: @@ -601,10 +601,10 @@ BattleTransition_Circle_Sub1: BattleTransition_TransferDelay3: ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret ; used for low level wild non-dungeon battles diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index e541d604..e8998414 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -101,16 +101,16 @@ PrintSendOutMonMessage: ld hl, GoText jr z, .printText xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld hl, wEnemyMonHP ld a, [hli] ld [wLastSwitchInEnemyMonHP], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hl] ld [wLastSwitchInEnemyMonHP + 1], a - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, 25 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld hl, wEnemyMonMaxHP ld a, [hli] @@ -121,9 +121,9 @@ PrintSendOutMonMessage: rr b ld a, b ld b, 4 - ld [H_DIVISOR], a ; enemy mon max HP divided by 4 + ld [hDivisor], a ; enemy mon max HP divided by 4 call Divide - ld a, [H_QUOTIENT + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP + ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP ld hl, GoText ; 70% or greater cp 70 jr nc, .printText @@ -179,14 +179,14 @@ PlayerMon2Text: dec hl ld a, [de] sub b - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a dec de ld b, [hl] ld a, [de] sbc b - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, 25 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld hl, wEnemyMonMaxHP ld a, [hli] @@ -197,11 +197,11 @@ PlayerMon2Text: rr b ld a, b ld b, 4 - ld [H_DIVISOR], a + ld [hDivisor], a call Divide pop bc pop de - ld a, [H_QUOTIENT + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4) + ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4) ; Assuming that the enemy mon hasn't gained HP since the last switch in, ; a approximates the percentage that the enemy mon's total HP has decreased ; since the last switch in. diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 647436ff..e503243d 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -57,7 +57,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ld [wUpdateSpritesEnabled], a call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld b, $70 ld c, $90 ld a, c @@ -83,7 +83,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: dec c jr nz, .slideSilhouettesLoop ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, $31 ld [hStartTileID], a coord hl, 1, 5 @@ -92,7 +92,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ld [hWY], a ld [rWY], a inc a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 ld b, SET_PAL_BATTLE call RunPaletteCommand @@ -266,7 +266,7 @@ EnemyRan: ld a, SFX_RUN call PlaySoundWaitForCurrent xor a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a jpab AnimationSlideEnemyMonOff WildRanText: @@ -412,7 +412,7 @@ MainInBattleLoop: jr .playerMovesFirst .enemyMovesFirst ld a, $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a callab TrainerAI jr c, .AIActionUsedEnemyFirst call ExecuteEnemyMove @@ -450,7 +450,7 @@ MainInBattleLoop: jp z, HandlePlayerMonFainted call DrawHUDsAndHPBars ld a, $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a callab TrainerAI jr c, .AIActionUsedPlayerFirst call ExecuteEnemyMove @@ -470,7 +470,7 @@ MainInBattleLoop: HandlePoisonBurnLeechSeed: ld hl, wBattleMonHP ld de, wBattleMonStatus - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playersTurn ld hl, wEnemyMonHP @@ -495,7 +495,7 @@ HandlePoisonBurnLeechSeed: call HandlePoisonBurnLeechSeed_DecreaseOwnHP .notBurnedOrPoisoned ld de, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playersTurn2 ld de, wEnemyBattleStatus2 @@ -504,16 +504,16 @@ HandlePoisonBurnLeechSeed: add a jr nc, .notLeechSeeded push hl - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] push af xor $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a xor a ld [wAnimationType], a ld a, ABSORB call PlayMoveAnimation ; play leech seed animation (from opposing mon) pop af - ld [H_WHOSETURN], a + ld [hWhoseTurn], a pop hl call HandlePoisonBurnLeechSeed_DecreaseOwnHP call HandlePoisonBurnLeechSeed_IncreaseEnemyHP @@ -571,7 +571,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: .nonZeroDamage ld hl, wPlayerBattleStatus3 ld de, wPlayerToxicCounter - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playersTurn ld hl, wEnemyBattleStatus3 @@ -618,7 +618,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: HandlePoisonBurnLeechSeed_IncreaseEnemyHP: push hl ld hl, wEnemyMonMaxHP - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playersTurn ld hl, wBattleMonMaxHP @@ -655,19 +655,19 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ld [hl], a ld [wHPBarNewHP], a .noOverfullHeal - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a call UpdateCurMonHPBar - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a pop hl ret UpdateCurMonHPBar: coord hl, 10, 9 ; tile pointer to player HP bar - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, $1 jr z, .playersTurn @@ -1177,7 +1177,7 @@ LinkBattleLostText: db "@" ; slides pic of fainted mon downwards until it disappears -; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing +; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideDownFaintedMonPic: ld a, [wd730] push af @@ -1230,7 +1230,7 @@ SevenSpacesText: ; slides the player or enemy trainer off screen ; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer) ; if a is 8, the slide is to the right, else it is to the left -; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing +; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideTrainerPicOffScreen: ld [hSlideAmount], a ld c, a @@ -1508,29 +1508,29 @@ TryRunningFromBattle: inc a ld [wNumRunAttempts], a ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [de] ld [hEnemySpeed], a inc de ld a, [de] ld [hEnemySpeed + 1], a call LoadScreenTilesFromBuffer1 - ld de, H_MULTIPLICAND + 1 + ld de, hMultiplicand + 1 ld hl, hEnemySpeed ld c, 2 call StringCmp jr nc, .canEscape ; jump if player speed greater than enemy speed xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, 32 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; multiply player speed by 32 - ld a, [H_PRODUCT + 2] - ld [H_DIVIDEND], a - ld a, [H_PRODUCT + 3] - ld [H_DIVIDEND + 1], a + ld a, [hProduct + 2] + ld [hDividend], a + ld a, [hProduct + 3] + ld [hDividend + 1], a ld a, [hEnemySpeed] ld b, a ld a, [hEnemySpeed + 1] @@ -1541,10 +1541,10 @@ TryRunningFromBattle: rr a and a jr z, .canEscape ; jump if enemy speed divided by 4, mod 256 is 0 - ld [H_DIVISOR], a ; ((enemy speed / 4) % 256) + ld [hDivisor], a ; ((enemy speed / 4) % 256) ld b, $2 call Divide ; divide (player speed * 32) by ((enemy speed / 4) % 256) - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] and a ; is the quotient greater than 256? jr nz, .canEscape ; if so, the player can escape ld a, [wNumRunAttempts] @@ -1554,15 +1554,15 @@ TryRunningFromBattle: dec c jr z, .compareWithRandomValue ld b, 30 - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] add b - ld [H_QUOTIENT + 3], a + ld [hQuotient + 3], a jr c, .canEscape jr .loop .compareWithRandomValue call BattleRandom ld b, a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] cp b jr nc, .canEscape ; if the random value was less than or equal to the quotient ; plus 30 times the number of attempts, the player can escape @@ -1754,7 +1754,7 @@ SendOutMon: ld hl, wEnemyBattleStatus1 res USING_TRAPPING_MOVE, [hl] ld a, $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld a, POOF_ANIM call PlayMoveAnimation coord hl, 4, 11 @@ -1812,7 +1812,7 @@ DrawHUDsAndHPBars: DrawPlayerHUDAndHPBar: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 9, 7 lb bc, 5, 11 call ClearScreenArea @@ -1845,7 +1845,7 @@ DrawPlayerHUDAndHPBar: coord hl, 10, 9 predef DrawHP ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, wPlayerHPBarColor call GetBattleHealthBarColor ld hl, wBattleMonHP @@ -1873,7 +1873,7 @@ DrawPlayerHUDAndHPBar: DrawEnemyHUDAndHPBar: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 0, 0 lb bc, 4, 12 call ClearScreenArea @@ -1895,9 +1895,9 @@ DrawEnemyHUDAndHPBar: .skipPrintLevel ld hl, wEnemyMonHP ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hld] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a or [hl] ; is current HP zero? jr nz, .hpNonzero ; current HP is 0 @@ -1908,45 +1908,45 @@ DrawEnemyHUDAndHPBar: jp .drawHPBar .hpNonzero xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, 48 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; multiply current HP by 48 ld hl, wEnemyMonMaxHP ld a, [hli] ld b, a ld a, [hl] - ld [H_DIVISOR], a + ld [hDivisor], a ld a, b and a ; is max HP > 255? jr z, .doDivide ; if max HP > 255, scale both (current HP * 48) and max HP by dividing by 4 so that max HP fits in one byte ; (it needs to be one byte so it can be used as the divisor for the Divide function) - ld a, [H_DIVISOR] + ld a, [hDivisor] srl b rr a srl b rr a - ld [H_DIVISOR], a - ld a, [H_PRODUCT + 2] + ld [hDivisor], a + ld a, [hProduct + 2] ld b, a srl b - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] rr a srl b rr a - ld [H_PRODUCT + 3], a + ld [hProduct + 3], a ld a, b - ld [H_PRODUCT + 2], a + ld [hProduct + 2], a .doDivide - ld a, [H_PRODUCT + 2] - ld [H_DIVIDEND], a - ld a, [H_PRODUCT + 3] - ld [H_DIVIDEND + 1], a + ld a, [hProduct + 2] + ld [hDividend], a + ld a, [hProduct + 3] + ld [hDividend + 1], a ld a, $2 ld b, a call Divide ; divide (current HP * 48) by max HP - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ; set variables for DrawHPBar ld e, a ld a, $6 @@ -1958,7 +1958,7 @@ DrawEnemyHUDAndHPBar: coord hl, 2, 2 call DrawHPBar ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, wEnemyHPBarColor GetBattleHealthBarColor: @@ -2469,13 +2469,13 @@ MoveSelectionMenu: .writemoves ld de, wMovesString - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] set 2, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a call PlaceString - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] res 2, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a ret .regularmenu @@ -2595,10 +2595,10 @@ SelectMenuItem: call AddNTimes ld [hl], "▷" .select - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 1, [hl] bit 6, a jp nz, SelectMenuItem_CursorUp ; up @@ -2825,7 +2825,7 @@ SwapMovesInMenu: PrintMenuItem: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 0, 8 ld b, 3 ld c, 9 @@ -2847,7 +2847,7 @@ PrintMenuItem: ld hl, wCurrentMenuItem dec [hl] xor a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld hl, wBattleMonMoves ld a, [wCurrentMenuItem] ld c, a @@ -2891,7 +2891,7 @@ PrintMenuItem: predef PrintMoveType .moveDisabled ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jp Delay3 DisabledText: @@ -3043,7 +3043,7 @@ LinkBattleExchangeData: ExecutePlayerMove: xor a - ld [H_WHOSETURN], a ; set player's turn + ld [hWhoseTurn], a ; set player's turn ld a, [wPlayerSelectedMove] inc a jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn @@ -3252,7 +3252,7 @@ PrintGhostText: ; print the ghost battle messages call IsGhostBattle ret nz - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .Ghost ld a, [wBattleMonStatus] ; player’s turn @@ -3619,7 +3619,7 @@ CantMoveText: PrintMoveIsDisabledText: ld hl, wPlayerSelectedMove ld de, wPlayerBattleStatus1 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .removeChargingUp inc hl @@ -3675,11 +3675,11 @@ HandleSelfConfusionDamage: xor a ld [wAnimationType], a inc a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a call PlayMoveAnimation call DrawPlayerHUDAndHPBar xor a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a jp ApplyDamageToPlayerPokemon PrintMonName1Text: @@ -3694,7 +3694,7 @@ PrintMonName1Text: MonName1Text: TX_FAR _MonName1Text TX_ASM - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveNum] ld hl, wPlayerUsedMove @@ -3818,7 +3818,7 @@ INCLUDE "data/moves/grammar.asm" PrintMoveFailureText: ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playersTurn ld de, wEnemyMoveEffect @@ -3866,7 +3866,7 @@ PrintMoveFailureText: call PrintText ld b, $4 predef PredefShakeScreenHorizontally - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .enemyTurn jp ApplyDamageToPlayerPokemon @@ -4160,9 +4160,9 @@ GetDamageVarsForPlayerAttack: ; in the case of a critical hit, reset the player's attack and the enemy's defense to their base values ld c, 3 ; defense stat call GetEnemyMonStat - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] ld b, a - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] ld c, a push bc ld hl, wPartyMon1Attack @@ -4192,9 +4192,9 @@ GetDamageVarsForPlayerAttack: ; in the case of a critical hit, reset the player's and enemy's specials to their base values ld c, 5 ; special stat call GetEnemyMonStat - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] ld b, a - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] ld c, a push bc ld hl, wPartyMon1Special @@ -4281,7 +4281,7 @@ GetDamageVarsForEnemyAttack: push bc ld c, 2 ; attack stat call GetEnemyMonStat - ld hl, H_PRODUCT + 2 + ld hl, hProduct + 2 pop bc jr .scaleStats .specialAttack @@ -4313,7 +4313,7 @@ GetDamageVarsForEnemyAttack: push bc ld c, 5 ; special stat call GetEnemyMonStat - ld hl, H_PRODUCT + 2 + ld hl, hProduct + 2 pop bc ; if either the offensive or defensive stat is too large to store in a byte, scale both stats by dividing them by 4 ; this allows values with up to 10 bits (values up to 1023) to be handled @@ -4371,9 +4371,9 @@ GetEnemyMonStat: ld bc, wEnemyMon2 - wEnemyMon1 call AddNTimes ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a pop bc pop de ret @@ -4404,7 +4404,7 @@ CalculateDamage: ; d: base power ; e: level - ld a, [H_WHOSETURN] ; whose turn? + ld a, [hWhoseTurn] ; whose turn? and a ld a, [wPlayerMoveEffect] jr z, .effect @@ -4436,7 +4436,7 @@ CalculateDamage: .skipbp xor a - ld hl, H_DIVIDEND + ld hl, hDividend ldi [hl], a ldi [hl], a ld [hl], a @@ -4487,41 +4487,41 @@ CalculateDamage: ld hl, wDamage ld b, [hl] - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] add b - ld [H_QUOTIENT + 3], a + ld [hQuotient + 3], a jr nc, .asm_3dfd0 - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] inc a - ld [H_QUOTIENT + 2], a + ld [hQuotient + 2], a and a jr z, .asm_3e004 .asm_3dfd0 - ld a, [H_QUOTIENT] + ld a, [hQuotient] ld b, a - ld a, [H_QUOTIENT + 1] + ld a, [hQuotient + 1] or a jr nz, .asm_3e004 - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] cp 998 / $100 jr c, .asm_3dfe8 cp 998 / $100 + 1 jr nc, .asm_3e004 - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] cp 998 % $100 jr nc, .asm_3e004 .asm_3dfe8 inc hl - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld b, [hl] add b ld [hld], a - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld b, [hl] adc b ld [hl], a @@ -4573,7 +4573,7 @@ INCLUDE "data/battle/unused_critical_hit_moves.asm" CriticalHitTest: xor a ld [wCriticalHitOrOHKO], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wEnemyMonSpecies] jr nz, .handleEnemy @@ -4584,7 +4584,7 @@ CriticalHitTest: ld a, [wMonHBaseSpeed] ld b, a srl b ; (effective (base speed/2)) - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wPlayerMovePower ld de, wPlayerBattleStatus2 @@ -4646,7 +4646,7 @@ HandleCounterMove: ; the outcome may be affected by the player's actions in the move selection menu prior to switching the Pokemon. ; This might also lead to desync glitches in link battles. - ld a, [H_WHOSETURN] ; whose turn + ld a, [hWhoseTurn] ; whose turn and a ; player's turn ld hl, wEnemySelectedMove @@ -4954,7 +4954,7 @@ AttackSubstitute: ; values for player turn ld de, wEnemySubstituteHP ld bc, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .applyDamageToSubstitute ; values for enemy turn @@ -4979,14 +4979,14 @@ AttackSubstitute: ld hl, SubstituteBrokeText call PrintText ; flip whose turn it is for the next function call - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $01 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a callab HideSubstituteShowMonAnim ; animate the substitute breaking ; flip the turn back to the way it was - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $01 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld hl, wPlayerMoveEffect ; value for player's turn and a jr z, .nullifyEffect @@ -5010,7 +5010,7 @@ HandleBuildingRage: ld hl, wEnemyBattleStatus2 ld de, wEnemyMonStatMods ld bc, wEnemyMoveNum - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .next ; values for the enemy turn @@ -5023,9 +5023,9 @@ HandleBuildingRage: ld a, [de] cp $0d ; maximum stat modifier value ret z ; return if attack modifier is already maxed - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $01 ; flip turn for the stat modifier raising function - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ; temporarily change the target pokemon's move to $00 and the effect to the one ; that causes the attack modifier to go up one stage ld h, b @@ -5042,9 +5042,9 @@ HandleBuildingRage: ldd [hl], a ; null move effect ld a, RAGE ld [hl], a ; restore the target pokemon's move number to Rage - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor $01 ; flip turn back to the way it was - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ret BuildingRageText: @@ -5060,7 +5060,7 @@ MirrorMoveCopyMove: ; wPlayerUsedMove is also set to 0 whenever the player is fast asleep or frozen solid. ; wEnemyUsedMove is also set to 0 whenever the enemy is fast asleep or frozen solid. - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ; values for player turn ld a, [wEnemyUsedMove] @@ -5113,7 +5113,7 @@ MetronomePickMove: ; values for player turn ld de, wPlayerMoveNum ld hl, wPlayerSelectedMove - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .pickMoveLoop ; values for enemy turn @@ -5135,7 +5135,7 @@ MetronomePickMove: ; it's used to prevent moves that run another move within the same turn ; (like Mirror Move and Metronome) from losing 2 PP IncrementMovePP: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ; values for player turn ld hl, wBattleMonPP @@ -5154,7 +5154,7 @@ IncrementMovePP: ld h, d ld l, e add hl, bc - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMonNumber] ; value for player turn jr z, .updatePP @@ -5178,7 +5178,7 @@ AdjustDamageForMoveType: ld e, [hl] ; e = type 2 of defender ld a, [wPlayerMoveType] ld [wMoveType], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .next ; values for enemy turn @@ -5242,25 +5242,25 @@ AdjustDamageForMoveType: and $80 ld b, a ld a, [hl] ; a = damage multiplier - ld [H_MULTIPLIER], a + ld [hMultiplier], a add b ld [wDamageMultipliers], a xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld hl, wDamage ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hld] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a call Multiply ld a, 10 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $04 call Divide - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld [hli], a ld b, a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [hl], a or b ; is damage 0? jr nz, .skipTypeImmunity @@ -5325,7 +5325,7 @@ MoveHitTest: ld hl, wEnemyBattleStatus1 ld de, wPlayerMoveEffect ld bc, wEnemyMonStatus - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .dreamEaterCheck ; enemy's turn @@ -5354,7 +5354,7 @@ MoveHitTest: .checkForDigOrFlyStatus bit INVULNERABLE, [hl] jp nz, .moveMissed - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .enemyTurn .playerTurn @@ -5408,7 +5408,7 @@ MoveHitTest: call CalcHitChance ; scale the move accuracy according to attacker's accuracy and target's evasion ld a, [wPlayerMoveAccuracy] ld b, a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .doAccuracyCheck ld a, [wEnemyMoveAccuracy] @@ -5427,7 +5427,7 @@ MoveHitTest: ld [hl], a inc a ld [wMoveMissed], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn2 .enemyTurn2 @@ -5442,7 +5442,7 @@ MoveHitTest: ; values for player turn CalcHitChance: ld hl, wPlayerMoveAccuracy - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMonAccuracyMod] ld b, a @@ -5462,10 +5462,10 @@ CalcHitChance: ; decreases the hit chance instead of increasing the hit chance) ; zero the high bytes of the multiplicand xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [H_MULTIPLICAND + 2], a ; set multiplicand to move accuracy + ld [hMultiplicand + 2], a ; set multiplicand to move accuracy push hl ld d, $02 ; loop has two iterations ; loop to do the calculations, the first iteration multiplies by the accuracy ratio and @@ -5480,29 +5480,29 @@ CalcHitChance: add hl, bc ; hl = address of stat modifier ratio pop bc ld a, [hli] - ld [H_MULTIPLIER], a ; set multiplier to the numerator of the ratio + ld [hMultiplier], a ; set multiplier to the numerator of the ratio call Multiply ld a, [hl] - ld [H_DIVISOR], a ; set divisor to the the denominator of the ratio + ld [hDivisor], a ; set divisor to the the denominator of the ratio ; (the dividend is the product of the previous multiplication) ld b, $04 ; number of bytes in the dividend call Divide - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld b, a - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] or b jp nz, .nextCalculation ; make sure the result is always at least one - ld [H_QUOTIENT + 2], a + ld [hQuotient + 2], a ld a, $01 - ld [H_QUOTIENT + 3], a + ld [hQuotient + 3], a .nextCalculation ld b, c dec d jr nz, .loop - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] and a ; is the calculated hit chance over 0xFF? - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] jr z, .storeAccuracy ; if calculated hit chance over 0xFF ld a, $ff ; set the hit chance to 0xFF @@ -5522,29 +5522,29 @@ RandomizeDamage: ret c ; return if damage is equal to 0 or 1 .DamageGreaterThanOne xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a dec hl ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ; loop until a random number greater than or equal to 217 is generated .loop call BattleRandom rrca cp 217 jr c, .loop - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; multiply damage by the random number, which is in the range [217, 255] ld a, 255 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide ; divide the result by 255 ; store the modified damage - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld hl, wDamage ld [hli], a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [hl], a ret @@ -5900,11 +5900,11 @@ CheckEnemyStatusConditions: ld [hl], a xor a ld [wAnimationType], a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld a, POUND call PlayMoveAnimation ld a, $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a call ApplyDamageToEnemyPokemon jr .monHurtItselfOrFullyParalysed .checkIfTriedToUseDisabledMove @@ -6051,7 +6051,7 @@ CheckEnemyStatusConditions: ret GetCurrentMove: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jp z, .player ld de, wEnemyMoveNum @@ -6257,13 +6257,13 @@ DoBattleTransitionAndInitBattleVariables: predef BattleTransition callab LoadHudAndHpBarAndStatusTilePatterns ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, $ff ld [wUpdateSpritesEnabled], a call ClearSprites call ClearScreen xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [hWY], a ld [rWY], a ld [hTilesetType], a @@ -6340,7 +6340,7 @@ LoadPlayerBackPic: ld [$4000], a ld hl, vSprites ld de, sSpriteBuffer1 - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld b, a ld c, 7 * 7 call CopyVideoData @@ -6367,12 +6367,12 @@ ApplyBurnAndParalysisPenaltiesToEnemy: xor a ApplyBurnAndParalysisPenalties: - ld [H_WHOSETURN], a + ld [hWhoseTurn], a call QuarterSpeedDueToParalysis jp HalveAttackDueToBurn QuarterSpeedDueToParalysis: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn .enemyTurn ; quarter the player's speed @@ -6415,7 +6415,7 @@ QuarterSpeedDueToParalysis: ret HalveAttackDueToBurn: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn .enemyTurn ; halve the player's attack @@ -6505,35 +6505,35 @@ CalculateModifiedStat: ld b, 0 add hl, bc xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, [de] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a inc de ld a, [de] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, [hl] - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide pop hl - ld a, [H_DIVIDEND + 3] + ld a, [hDividend + 3] sub 999 % $100 - ld a, [H_DIVIDEND + 2] + ld a, [hDividend + 2] sbc 999 / $100 jp c, .storeNewStatValue ; cap the stat at 999 ld a, 999 / $100 - ld [H_DIVIDEND + 2], a + ld [hDividend + 2], a ld a, 999 % $100 - ld [H_DIVIDEND + 3], a + ld [hDividend + 3], a .storeNewStatValue - ld a, [H_DIVIDEND + 2] + ld a, [hDividend + 2] ld [hli], a ld b, a - ld a, [H_DIVIDEND + 3] + ld a, [hDividend + 3] ld [hl], a or b jr nz, .done @@ -6683,7 +6683,7 @@ BattleRandom: HandleExplodingAnimation: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wEnemyMonType1 ld de, wEnemyBattleStatus1 @@ -6826,18 +6826,18 @@ _InitBattleCommon: call RunPaletteCommand call SlidePlayerAndEnemySilhouettesOnScreen xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, .emptyString call PrintText call SaveScreenTilesToBuffer1 call ClearScreen ld a, $98 - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 ld a, $9c - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a call LoadScreenTilesFromBuffer1 coord hl, 9, 7 lb bc, 5, 10 @@ -6998,6 +6998,6 @@ LoadMonBackPic: ld hl, vSprites ld de, vBackPic ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld b, a jp CopyVideoData diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 2c015097..0a1eb61c 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -4,7 +4,7 @@ JumpMoveEffect: ret _JumpMoveEffect: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveEffect] jr z, .next1 @@ -26,7 +26,7 @@ INCLUDE "data/moves/effects_pointers.asm" SleepEffect: ld de, wEnemyMonStatus ld bc, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jp z, .sleepEffect ld de, wBattleMonStatus @@ -78,7 +78,7 @@ AlreadyAsleepText: PoisonEffect: ld hl, wEnemyMonStatus ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .poisonEffect ld hl, wBattleMonStatus @@ -121,7 +121,7 @@ PoisonEffect: set 3, [hl] ; mon is now poisoned push de dec de - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld b, ANIM_C7 ld hl, wPlayerBattleStatus3 @@ -175,7 +175,7 @@ DrainHPEffect: ExplodeEffect: ld hl, wBattleMonHP ld de, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .faintUser ld hl, wEnemyMonHP @@ -196,7 +196,7 @@ FreezeBurnParalyzeEffect: ld [wAnimationType], a call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] ret nz ; return if they have a substitute, can't effect them - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jp nz, opponentAttacker ld a, [wEnemyMonStatus] @@ -308,7 +308,7 @@ CheckDefrost: ; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target and 1 << FRZ ; are they frozen? ret z ; return if so - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .opponent ;player [attacker] @@ -346,7 +346,7 @@ FireDefrostedText: StatModifierUpEffect: ld hl, wPlayerMonStatMods ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .statModifierUpEffect ld hl, wEnemyMonStatMods @@ -382,7 +382,7 @@ StatModifierUpEffect: push hl ld hl, wBattleMonAttack + 1 ld de, wPlayerMonUnmodifiedAttack - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .pointToStats ld hl, wEnemyMonAttack + 1 @@ -417,35 +417,35 @@ StatModifierUpEffect: add hl, bc pop bc xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, [de] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a inc de ld a, [de] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, [hl] - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide pop hl ; cap at 999 - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] sub 999 % $100 - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] sbc 999 / $100 jp c, UpdateStat ld a, 999 / $100 - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, 999 % $100 - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a UpdateStat: - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] ld [hli], a - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] ld [hl], a pop hl UpdateStatDone: @@ -455,7 +455,7 @@ UpdateStatDone: ld hl, wPlayerBattleStatus2 ld de, wPlayerMoveNum ld bc, wPlayerMonMinimized - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .asm_3f4e6 ld hl, wEnemyBattleStatus2 @@ -488,7 +488,7 @@ UpdateStatDone: pop af call nz, Bankswitch .applyBadgeBoostsAndStatusPenalties - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat, ; even to those not affected by the stat-up move (will be boosted further) @@ -511,7 +511,7 @@ MonsStatsRoseText: TX_FAR _MonsStatsRoseText TX_ASM ld hl, GreatlyRoseText - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveEffect] jr z, .playerTurn @@ -534,7 +534,7 @@ StatModifierDownEffect: ld hl, wEnemyMonStatMods ld de, wPlayerMoveEffect ld bc, wEnemyBattleStatus1 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .statModifierDownEffect ld hl, wPlayerMonStatMods @@ -601,7 +601,7 @@ StatModifierDownEffect: push de ld hl, wEnemyMonAttack + 1 ld de, wEnemyMonUnmodifiedAttack - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .pointToStat ld hl, wBattleMonAttack + 1 @@ -637,33 +637,33 @@ StatModifierDownEffect: add hl, bc pop bc xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, [de] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a inc de ld a, [de] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, [hl] - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide pop hl - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] ld b, a - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] or b jp nz, UpdateLoweredStat - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, $1 - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a UpdateLoweredStat: - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] ld [hli], a - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] ld [hl], a pop de pop hl @@ -678,7 +678,7 @@ UpdateLoweredStatDone: jr nc, .ApplyBadgeBoostsAndStatusPenalties call PlayCurrentMoveAnimation2 .ApplyBadgeBoostsAndStatusPenalties - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat, ; even to those not affected by the stat-up move (will be boosted further) @@ -713,7 +713,7 @@ MonsStatsFellText: TX_FAR _MonsStatsFellText TX_ASM ld hl, FellText - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveEffect] jr z, .playerTurn @@ -759,7 +759,7 @@ BideEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerBideAccumulatedDamage ld bc, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .bideEffect ld hl, wEnemyBattleStatus1 @@ -778,14 +778,14 @@ BideEffect: inc a inc a ld [bc], a ; set Bide counter to 2 or 3 at random - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] add XSTATITEM_ANIM jp PlayBattleAnimation2 ThrashPetalDanceEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .thrashPetalDanceEffect ld hl, wEnemyBattleStatus1 @@ -797,12 +797,12 @@ ThrashPetalDanceEffect: inc a inc a ld [de], a ; set thrash/petal dance counter to 2 or 3 at random - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] add ANIM_B0 jp PlayBattleAnimation2 SwitchAndTeleportEffect: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .handleEnemy ld a, [wIsInBattle] @@ -920,7 +920,7 @@ TwoToFiveAttacksEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft ld bc, wPlayerNumHits - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .twoToFiveAttacksEffect ld hl, wEnemyBattleStatus1 @@ -931,7 +931,7 @@ TwoToFiveAttacksEffect: ret nz set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times ld hl, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .setNumberOfHits ld hl, wEnemyMoveEffect @@ -967,7 +967,7 @@ FlinchSideEffect: ret nz ld hl, wEnemyBattleStatus1 ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .flinchSideEffect ld hl, wPlayerBattleStatus1 @@ -992,7 +992,7 @@ OneHitKOEffect: ChargeEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld b, XSTATITEM_ANIM jr z, .chargeEffect @@ -1074,7 +1074,7 @@ DugAHoleText: TrappingEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .trappingEffect ld hl, wEnemyBattleStatus1 @@ -1120,7 +1120,7 @@ ConfusionEffect: jr nz, ConfusionEffectFailed ConfusionSideEffectSuccess: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wEnemyBattleStatus1 ld bc, wEnemyConfusedCounter @@ -1164,7 +1164,7 @@ SubstituteEffect: HyperBeamEffect: ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .hyperBeamEffect ld hl, wEnemyBattleStatus2 @@ -1175,7 +1175,7 @@ HyperBeamEffect: ClearHyperBeam: push hl ld hl, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .playerTurn ld hl, wPlayerBattleStatus2 @@ -1186,7 +1186,7 @@ ClearHyperBeam: RageEffect: ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .player ld hl, wEnemyBattleStatus2 @@ -1201,7 +1201,7 @@ MimicEffect: ld a, [wMoveMissed] and a jr nz, .mimicMissed - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wBattleMonMoves ld a, [wPlayerBattleStatus1] @@ -1226,7 +1226,7 @@ MimicEffect: and a jr z, .getRandomMove ld d, a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wBattleMonMoves ld a, [wPlayerMoveListIndex] @@ -1284,7 +1284,7 @@ DisableEffect: jr nz, .moveMissed ld de, wEnemyDisabledMove ld hl, wEnemyMonMoves - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .disableEffect ld de, wPlayerDisabledMove @@ -1307,7 +1307,7 @@ DisableEffect: jr z, .pickMoveToDisable ; loop until a non-00 move slot is found ld [wd11e], a ; store move number push hl - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld hl, wBattleMonPP jr nz, .enemyTurn @@ -1345,7 +1345,7 @@ DisableEffect: ld [de], a call PlayCurrentMoveAnimation2 ld hl, wPlayerDisabledMoveNumber - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .printDisableText inc hl ; wEnemyDisabledMoveNumber @@ -1430,7 +1430,7 @@ ParalyzedMayNotAttackText: CheckTargetSubstitute: push hl ld hl, wEnemyBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .next1 ld hl, wPlayerBattleStatus2 @@ -1442,7 +1442,7 @@ CheckTargetSubstitute: PlayCurrentMoveAnimation2: ; animation at MOVENUM will be played unless MOVENUM is 0 ; plays wAnimationType 3 or 6 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveNum] jr z, .notEnemyTurn @@ -1454,7 +1454,7 @@ PlayCurrentMoveAnimation2: PlayBattleAnimation2: ; play animation ID at a and animation type 6 or 3 ld [wAnimationID], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, $6 jr z, .storeAnimationType @@ -1468,7 +1468,7 @@ PlayCurrentMoveAnimation: ; resets wAnimationType xor a ld [wAnimationType], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveNum] jr z, .notEnemyTurn diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 24748338..c628ae32 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -55,15 +55,15 @@ GainExperience: jr .gainStatExpLoop .statExpDone xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, [wEnemyMonBaseExp] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [wEnemyMonLevel] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, 7 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 call Divide ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1) @@ -91,12 +91,12 @@ GainExperience: inc hl ; add the gained exp to the party mon's exp ld b, [hl] - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [wExpAmountGained + 1], a add b ld [hld], a ld b, [hl] - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld [wExpAmountGained], a adc b ld [hl], a @@ -311,14 +311,14 @@ DivideExpDataByNumMonsGainingExp: ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats .divideLoop xor a - ld [H_DIVIDEND], a + ld [hDividend], a ld a, [hl] - ld [H_DIVIDEND + 1], a + ld [hDividend + 1], a ld a, [wd11e] - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $2 call Divide ; divide value by number of mons gaining exp - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [hli], a dec c jr nz, .divideLoop @@ -326,17 +326,17 @@ DivideExpDataByNumMonsGainingExp: ; multiplies exp by 1.5 BoostExp: - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld b, a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld c, a srl b rr c add c - ld [H_QUOTIENT + 3], a - ld a, [H_QUOTIENT + 2] + ld [hQuotient + 3], a + ld a, [hQuotient + 2] adc b - ld [H_QUOTIENT + 2], a + ld [hQuotient + 2], a ret GainedText: diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 7adb20d8..28f536ca 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -9,12 +9,12 @@ MarowakAnim: call ClearScreenArea call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon + ld [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon ; replace ghost pic with Marowak in BG ld a, MAROWAK ld [wChangeMonPicEnemyTurnSpecies], a ld a, $1 - ld [H_WHOSETURN], a + ld [hWhoseTurn], a callab ChangeMonPic ; alternate between black and light grey 8 times. ; this makes the ghost's body appear to flash @@ -44,7 +44,7 @@ MarowakAnim: and a jr nz, .fadeInMarowakLoop ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared + ld [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared call Delay3 jp ClearSprites diff --git a/engine/battle/move_effects/conversion.asm b/engine/battle/move_effects/conversion.asm index f23c3d70..8c41f914 100644 --- a/engine/battle/move_effects/conversion.asm +++ b/engine/battle/move_effects/conversion.asm @@ -1,7 +1,7 @@ ConversionEffect_: ld hl, wEnemyMonType1 ld de, wBattleMonType1 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wEnemyBattleStatus1] jr z, .conversionEffect diff --git a/engine/battle/move_effects/drain_hp.asm b/engine/battle/move_effects/drain_hp.asm index e5f4681a..60d23a95 100644 --- a/engine/battle/move_effects/drain_hp.asm +++ b/engine/battle/move_effects/drain_hp.asm @@ -14,7 +14,7 @@ DrainHPEffect_: .getAttackerHP ld hl, wBattleMonHP ld de, wBattleMonMaxHP - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jp z, .addDamageToAttackerHP ld hl, wEnemyMonHP @@ -69,7 +69,7 @@ DrainHPEffect_: ld [wHPBarNewHP+1], a inc de .next - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 10, 9 ld a, $1 @@ -83,7 +83,7 @@ DrainHPEffect_: predef DrawEnemyHUDAndHPBar callab ReadPlayerMonCurHPAndStatus ld hl, SuckedHealthText - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveEffect] jr z, .next3 diff --git a/engine/battle/move_effects/focus_energy.asm b/engine/battle/move_effects/focus_energy.asm index 16dad7bb..af4a6521 100644 --- a/engine/battle/move_effects/focus_energy.asm +++ b/engine/battle/move_effects/focus_energy.asm @@ -1,6 +1,6 @@ FocusEnergyEffect_: ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .notEnemy ld hl, wEnemyBattleStatus2 diff --git a/engine/battle/move_effects/haze.asm b/engine/battle/move_effects/haze.asm index 47723ba2..bd73d249 100644 --- a/engine/battle/move_effects/haze.asm +++ b/engine/battle/move_effects/haze.asm @@ -15,7 +15,7 @@ HazeEffect_: ; cure non-volatile status, but only for the target ld hl, wEnemyMonStatus ld de, wEnemySelectedMove - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .cureStatuses ld hl, wBattleMonStatus diff --git a/engine/battle/move_effects/heal.asm b/engine/battle/move_effects/heal.asm index 2e68acc0..8042bc63 100644 --- a/engine/battle/move_effects/heal.asm +++ b/engine/battle/move_effects/heal.asm @@ -1,5 +1,5 @@ HealEffect_: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld de, wBattleMonHP ld hl, wBattleMonMaxHP @@ -27,7 +27,7 @@ HealEffect_: ld c, 50 call DelayFrames ld hl, wBattleMonStatus - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .restEffect ld hl, wEnemyMonStatus @@ -87,7 +87,7 @@ HealEffect_: .playAnim ld hl, PlayCurrentMoveAnimation call BankswitchEtoF - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a coord hl, 10, 9 ld a, $1 diff --git a/engine/battle/move_effects/leech_seed.asm b/engine/battle/move_effects/leech_seed.asm index f4d3ee9c..981f5da9 100644 --- a/engine/battle/move_effects/leech_seed.asm +++ b/engine/battle/move_effects/leech_seed.asm @@ -5,7 +5,7 @@ LeechSeedEffect_: jr nz, .moveMissed ld hl, wEnemyBattleStatus2 ld de, wEnemyMonType1 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .leechSeedEffect ld hl, wPlayerBattleStatus2 diff --git a/engine/battle/move_effects/mist.asm b/engine/battle/move_effects/mist.asm index 65070a3e..6373770d 100644 --- a/engine/battle/move_effects/mist.asm +++ b/engine/battle/move_effects/mist.asm @@ -1,6 +1,6 @@ MistEffect_: ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .mistEffect ld hl, wEnemyBattleStatus2 diff --git a/engine/battle/move_effects/one_hit_ko.asm b/engine/battle/move_effects/one_hit_ko.asm index 827e2197..347a4c7b 100644 --- a/engine/battle/move_effects/one_hit_ko.asm +++ b/engine/battle/move_effects/one_hit_ko.asm @@ -7,7 +7,7 @@ OneHitKOEffect_: ld [wCriticalHitOrOHKO], a ld hl, wBattleMonSpeed + 1 ld de, wEnemyMonSpeed + 1 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .compareSpeed ld hl, wEnemyMonSpeed + 1 diff --git a/engine/battle/move_effects/paralyze.asm b/engine/battle/move_effects/paralyze.asm index 95979ae6..b01aa5cf 100644 --- a/engine/battle/move_effects/paralyze.asm +++ b/engine/battle/move_effects/paralyze.asm @@ -1,7 +1,7 @@ ParalyzeEffect_: ld hl, wEnemyMonStatus ld de, wPlayerMoveType - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jp z, .next ld hl, wBattleMonStatus diff --git a/engine/battle/move_effects/pay_day.asm b/engine/battle/move_effects/pay_day.asm index e5daf014..5bdb86da 100644 --- a/engine/battle/move_effects/pay_day.asm +++ b/engine/battle/move_effects/pay_day.asm @@ -2,7 +2,7 @@ PayDayEffect_: xor a ld hl, wcd6d ld [hli], a - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wBattleMonLevel] jr z, .payDayEffect @@ -10,28 +10,28 @@ PayDayEffect_: .payDayEffect ; level * 2 add a - ld [H_DIVIDEND + 3], a + ld [hDividend + 3], a xor a - ld [H_DIVIDEND], a - ld [H_DIVIDEND + 1], a - ld [H_DIVIDEND + 2], a + ld [hDividend], a + ld [hDividend + 1], a + ld [hDividend + 2], a ; convert to BCD ld a, 100 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [hli], a - ld a, [H_REMAINDER] - ld [H_DIVIDEND + 3], a + ld a, [hRemainder] + ld [hDividend + 3], a ld a, 10 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] swap a ld b, a - ld a, [H_REMAINDER] + ld a, [hRemainder] add b ld [hl], a ld de, wTotalPayDayMoney + 2 diff --git a/engine/battle/move_effects/recoil.asm b/engine/battle/move_effects/recoil.asm index 0f2f087b..e94f8043 100644 --- a/engine/battle/move_effects/recoil.asm +++ b/engine/battle/move_effects/recoil.asm @@ -1,5 +1,5 @@ RecoilEffect_: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerMoveNum] ld hl, wBattleMonMaxHP @@ -54,7 +54,7 @@ RecoilEffect_: ld [hl], a .getHPBarCoords coord hl, 10, 9 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, $1 jr z, .updateHPBar diff --git a/engine/battle/move_effects/reflect_light_screen.asm b/engine/battle/move_effects/reflect_light_screen.asm index 2805a969..7693a348 100644 --- a/engine/battle/move_effects/reflect_light_screen.asm +++ b/engine/battle/move_effects/reflect_light_screen.asm @@ -1,7 +1,7 @@ ReflectLightScreenEffect_: ld hl, wPlayerBattleStatus3 ld de, wPlayerMoveEffect - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .reflectLightScreenEffect ld hl, wEnemyBattleStatus3 diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index 1bb6c887..a1cd11b2 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -4,7 +4,7 @@ SubstituteEffect_: ld hl, wBattleMonMaxHP ld de, wPlayerSubstituteHP ld bc, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .notEnemy ld hl, wEnemyMonMaxHP diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 9a5de9cc..1b459910 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -3,7 +3,7 @@ TransformEffect_: ld de, wEnemyMonSpecies ld bc, wEnemyBattleStatus3 ld a, [wEnemyBattleStatus1] - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr nz, .hitTest ld hl, wEnemyMonSpecies @@ -18,7 +18,7 @@ TransformEffect_: push de push bc ld hl, wPlayerBattleStatus2 - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .transformEffect ld hl, wEnemyBattleStatus2 @@ -64,7 +64,7 @@ TransformEffect_: inc bc inc bc call CopyData - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .next ; save enemy mon DVs at wTransformedEnemyMonOriginalDVs @@ -128,7 +128,7 @@ TransformEffect_: jp PrintText .copyBasedOnTurn - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a jr z, .gotStatsOrModsToCopy push hl diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 98521528..1774f7c5 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo: ScaleLastSpriteColumnByTwo: ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows - ld [H_SPRITEINTERLACECOUNTER], a + ld [hSpriteInterlaceCounter], a ld bc, -1 .columnInnerLoop ld a, [de] dec de swap a ; only high nybble contains information call ScalePixelsByTwo - ld a, [H_SPRITEINTERLACECOUNTER] + ld a, [hSpriteInterlaceCounter] dec a - ld [H_SPRITEINTERLACECOUNTER], a + ld [hSpriteInterlaceCounter], a jr nz, .columnInnerLoop dec de ; skip last 4 rows of new column dec de diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 91aef0f1..2178be38 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -655,17 +655,17 @@ AIUseDireHit: ; unused AICheckIfHPBelowFraction: ; return carry if enemy trainer's current HP is below 1 / a of the maximum - ld [H_DIVISOR], a + ld [hDivisor], a ld hl, wEnemyMonMaxHP ld a, [hli] - ld [H_DIVIDEND], a + ld [hDividend], a ld a, [hl] - ld [H_DIVIDEND + 1], a + ld [hDividend + 1], a ld b, 2 call Divide - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld c, a - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld b, a ld hl, wEnemyMonHP + 1 ld a, [hld] diff --git a/engine/battle/unused_stats_functions.asm b/engine/battle/unused_stats_functions.asm index 55f78fd3..fb3422c7 100644 --- a/engine/battle/unused_stats_functions.asm +++ b/engine/battle/unused_stats_functions.asm @@ -1,6 +1,6 @@ ; does nothing since no stats are ever selected (barring glitches) DoubleSelectedStats: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerStatsToDouble] ld hl, wBattleMonAttack + 1 @@ -30,7 +30,7 @@ DoubleSelectedStats: ; does nothing since no stats are ever selected (barring glitches) HalveSelectedStats: - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] and a ld a, [wPlayerStatsToHalve] ld hl, wBattleMonAttack diff --git a/engine/debug/test_battle.asm b/engine/debug/test_battle.asm index d9dcf1fa..92d6e4a9 100644 --- a/engine/debug/test_battle.asm +++ b/engine/debug/test_battle.asm @@ -41,5 +41,5 @@ TestBattle: ; do it all again. ld a, 1 ld [wUpdateSpritesEnabled], a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jr .loop diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index be6b13a1..8636418c 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -26,7 +26,7 @@ DisplayMonFrontSpriteInBox: ; Displays a pokemon's front sprite in a pop-up window. ; [wcf91] = pokemon internal id number ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 xor a ld [hWY], a diff --git a/engine/events/hidden_objects/town_map.asm b/engine/events/hidden_objects/town_map.asm index 5ee8329d..31e75d0d 100644 --- a/engine/events/hidden_objects/town_map.asm +++ b/engine/events/hidden_objects/town_map.asm @@ -10,13 +10,13 @@ TownMapText:: xor a ld [hWY], a inc a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call LoadFontTilePatterns callba DisplayTownMap ld hl, wd730 res 6, [hl] ld de, TextScriptEnd push de - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af jp CloseTextDisplay diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index 221bd7a9..4b91da58 100755 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -6,7 +6,7 @@ HPBarLength: GetHPBarLength: push hl xor a - ld hl, H_MULTIPLICAND + ld hl, hMultiplicand ld [hli], a ld a, b ld [hli], a @@ -21,22 +21,22 @@ GetHPBarLength: rr e srl d rr e - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] ld b, a - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] srl b ; divide multiplication result as well rr a srl b rr a - ld [H_MULTIPLICAND+2], a + ld [hMultiplicand+2], a ld a, b - ld [H_MULTIPLICAND+1], a + ld [hMultiplicand+1], a .maxHPSmaller256 ld a, e - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] ld e, a ; e = bc * 48 / de (num of pixels of HP bar) pop hl and a @@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber: ld a, [wHPBarOldHP + 1] ld [wHPBarTempHP], a push hl - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] bit 0, a jr z, .asm_fb15 ld de, $9 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1214a3f8..a793ae00 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -239,14 +239,14 @@ ItemUseBall: ; Calculate MaxHP * 255. xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld hl, wEnemyMonMaxHP ld a, [hli] - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, 255 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; Determine BallFactor. It's 8 for Great Balls and 12 for the others. @@ -260,7 +260,7 @@ ItemUseBall: ; Note that the results of all division operations are floored. ; Calculate (MaxHP * 255) / BallFactor. - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 ; number of bytes in dividend call Divide @@ -281,17 +281,17 @@ ItemUseBall: .skip2 ; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 call Divide -; If W > 255, store 255 in [H_QUOTIENT + 3]. -; Let X = min(W, 255) = [H_QUOTIENT + 3]. - ld a, [H_QUOTIENT + 2] +; If W > 255, store 255 in [hQuotient + 3]. +; Let X = min(W, 255) = [hQuotient + 3]. + ld a, [hQuotient + 2] and a jr z, .skip3 ld a, 255 - ld [H_QUOTIENT + 3], a + ld [hQuotient + 3], a .skip3 pop bc ; b = Rand1 - Status @@ -302,7 +302,7 @@ ItemUseBall: jr c, .failedToCapture ; If W > 255, the ball captures the Pokémon. - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] and a jr nz, .captured @@ -310,7 +310,7 @@ ItemUseBall: ; If Rand2 > X, the ball fails to capture the Pokémon. ld b, a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] cp b jr c, .failedToCapture @@ -318,17 +318,17 @@ ItemUseBall: jr .skipShakeCalculations .failedToCapture - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] ld [wPokeBallCaptureCalcTemp], a ; Save X. ; Calculate CatchRate * 100. xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, [wEnemyMonActualCatchRate] - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, 100 - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; Determine BallFactor2. @@ -349,26 +349,26 @@ ItemUseBall: .skip4 ; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. ld a, b - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 call Divide ; If Y > 255, there are 3 shakes. ; Note that this shouldn't be possible. ; The maximum value of Y is (255 * 100) / 150 = 170. - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] and a ld b, $63 ; 3 shakes jr nz, .setAnimData ; Calculate X * Y. ld a, [wPokeBallCaptureCalcTemp] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; Calculate (X * Y) / 255. ld a, 255 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 call Divide @@ -386,19 +386,19 @@ ItemUseBall: .addAilmentValue ; If the Pokémon has a status ailment, add Status2. - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] add b - ld [H_QUOTIENT + 3], a + ld [hQuotient + 3], a .skip5 ; Finally determine the number of shakes. -; Let Z = ((X * Y) / 255) + Status2 = [H_QUOTIENT + 3]. +; Let Z = ((X * Y) / 255) + Status2 = [hQuotient + 3]. ; The number of shakes depend on the range Z is in. ; 0 ≤ Z < 10: 0 shakes (the ball misses) ; 10 ≤ Z < 30: 1 shake ; 30 ≤ Z < 70: 2 shakes ; 70 ≤ Z: 3 shakes - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] cp 10 ld b, $20 jr c, .setAnimData @@ -422,7 +422,7 @@ ItemUseBall: ld a, TOSS_ANIM ld [wAnimationID], a xor a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld [wAnimationType], a ld [wDamageMultipliers], a ld a, [wWhichPokemon] @@ -1018,18 +1018,18 @@ ItemUseMedicine: call AddNTimes ld a, [hli] ld [wHPBarMaxHP + 1], a - ld [H_DIVIDEND], a + ld [hDividend], a ld a, [hl] ld [wHPBarMaxHP], a - ld [H_DIVIDEND + 1], a + ld [hDividend + 1], a ld a, 5 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 2 ; number of bytes call Divide ; get 1/5 of max HP of pokemon that used Softboiled ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] push af ld b, a ld a, [hl] @@ -1037,7 +1037,7 @@ ItemUseMedicine: sub b ld [hld], a ld [wHPBarNewHP], a - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] ld b, a ld a, [hl] ld [wHPBarOldHP+1], a @@ -1050,15 +1050,15 @@ ItemUseMedicine: call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] set 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] res 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a pop af ld b, a ; store heal amount (1/5 of max HP) ld hl, wHPBarOldHP + 1 @@ -1200,15 +1200,15 @@ ItemUseMedicine: jr z, .playStatusAilmentCuringSound ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] set 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] res 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a ld a, [wcf91] @@ -1224,13 +1224,13 @@ ItemUseMedicine: call PlaySoundWaitForCurrent .showHealingItemMessage xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen dec a ld [wUpdateSpritesEnabled], a call RedrawPartyMenu ; redraws the party menu and displays the message ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld c, 50 call DelayFrames call WaitForTextScrollButtonPress @@ -1459,7 +1459,7 @@ BaitRockCommon: ld [wAnimationID], a xor a ld [wAnimationType], a - ld [H_WHOSETURN], a + ld [hWhoseTurn], a ld [de], a ; zero escape factor (for bait), zero bait factor (for rock) .randomLoop ; loop until a random number less than 5 is generated call Random @@ -1698,7 +1698,7 @@ ItemUseXStat: call LoadScreenTilesFromBuffer1 ; restore saved screen call Delay3 xor a - ld [H_WHOSETURN], a ; set turn to player's turn + ld [hWhoseTurn], a ; set turn to player's turn callba StatModifierUpEffect ; do stat increase move pop hl pop af @@ -2463,13 +2463,13 @@ RestoreBonusPP: AddBonusPP: push bc ld a, [de] ; normal max PP of move - ld [H_DIVIDEND + 3], a + ld [hDividend + 3], a xor a - ld [H_DIVIDEND], a - ld [H_DIVIDEND + 1], a - ld [H_DIVIDEND + 2], a + ld [hDividend], a + ld [hDividend + 1], a + ld [hDividend + 2], a ld a, 5 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 4 call Divide ld a, [hl] ; move PP @@ -2480,7 +2480,7 @@ AddBonusPP: srl a ld c, a ; c = number of PP Ups used .loop - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] cp 8 ; is the amount greater than or equal to 8? jr c, .addAmount ld a, 7 ; cap the amount at 7 diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 8aadf1e5..13b92e71 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -338,10 +338,10 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a .enemyMonMenu_HandleInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 1, [hl] and a jp z, .getNewInput @@ -403,10 +403,10 @@ TradeCenter_SelectMon: lb bc, 6, 1 call ClearScreenArea .playerMonMenu_HandleInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 1, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed diff --git a/engine/math/multiply_divide.asm b/engine/math/multiply_divide.asm index 6cdc6c87..8bbc20a1 100755 --- a/engine/math/multiply_divide.asm +++ b/engine/math/multiply_divide.asm @@ -2,142 +2,142 @@ _Multiply:: ld a, $8 ld b, a xor a - ld [H_PRODUCT], a - ld [H_MULTIPLYBUFFER], a - ld [H_MULTIPLYBUFFER+1], a - ld [H_MULTIPLYBUFFER+2], a - ld [H_MULTIPLYBUFFER+3], a + ld [hProduct], a + ld [hMultiplyBuffer], a + ld [hMultiplyBuffer+1], a + ld [hMultiplyBuffer+2], a + ld [hMultiplyBuffer+3], a .loop - ld a, [H_MULTIPLIER] + ld a, [hMultiplier] srl a - ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld [hMultiplier], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) jr nc, .smallMultiplier - ld a, [H_MULTIPLYBUFFER+3] + ld a, [hMultiplyBuffer+3] ld c, a - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] add c - ld [H_MULTIPLYBUFFER+3], a - ld a, [H_MULTIPLYBUFFER+2] + ld [hMultiplyBuffer+3], a + ld a, [hMultiplyBuffer+2] ld c, a - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] adc c - ld [H_MULTIPLYBUFFER+2], a - ld a, [H_MULTIPLYBUFFER+1] + ld [hMultiplyBuffer+2], a + ld a, [hMultiplyBuffer+1] ld c, a - ld a, [H_MULTIPLICAND] ; (aliases: H_MULTIPLICAND) + ld a, [hMultiplicand] ; (aliases: hMultiplicand) adc c - ld [H_MULTIPLYBUFFER+1], a - ld a, [H_MULTIPLYBUFFER] + ld [hMultiplyBuffer+1], a + ld a, [hMultiplyBuffer] ld c, a - ld a, [H_PRODUCT] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [hProduct] ; (aliases: hProduct, hPastLeadingZeros, hQuotient) adc c - ld [H_MULTIPLYBUFFER], a + ld [hMultiplyBuffer], a .smallMultiplier dec b jr z, .done - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] sla a - ld [H_MULTIPLICAND+2], a - ld a, [H_MULTIPLICAND+1] + ld [hMultiplicand+2], a + ld a, [hMultiplicand+1] rl a - ld [H_MULTIPLICAND+1], a - ld a, [H_MULTIPLICAND] + ld [hMultiplicand+1], a + ld a, [hMultiplicand] rl a - ld [H_MULTIPLICAND], a - ld a, [H_PRODUCT] + ld [hMultiplicand], a + ld a, [hProduct] rl a - ld [H_PRODUCT], a + ld [hProduct], a jr .loop .done - ld a, [H_MULTIPLYBUFFER+3] - ld [H_PRODUCT+3], a - ld a, [H_MULTIPLYBUFFER+2] - ld [H_PRODUCT+2], a - ld a, [H_MULTIPLYBUFFER+1] - ld [H_PRODUCT+1], a - ld a, [H_MULTIPLYBUFFER] - ld [H_PRODUCT], a + ld a, [hMultiplyBuffer+3] + ld [hProduct+3], a + ld a, [hMultiplyBuffer+2] + ld [hProduct+2], a + ld a, [hMultiplyBuffer+1] + ld [hProduct+1], a + ld a, [hMultiplyBuffer] + ld [hProduct], a ret _Divide:: xor a - ld [H_DIVIDEBUFFER], a - ld [H_DIVIDEBUFFER+1], a - ld [H_DIVIDEBUFFER+2], a - ld [H_DIVIDEBUFFER+3], a - ld [H_DIVIDEBUFFER+4], a + ld [hDivideBuffer], a + ld [hDivideBuffer+1], a + ld [hDivideBuffer+2], a + ld [hDivideBuffer+3], a + ld [hDivideBuffer+4], a ld a, $9 ld e, a .asm_37db3 - ld a, [H_DIVIDEBUFFER] + ld a, [hDivideBuffer] ld c, a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) + ld a, [hDividend+1] ; (aliases: hMultiplicand) sub c ld d, a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10) ld c, a - ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient) sbc c jr c, .asm_37dce - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient) ld a, d - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) - ld a, [H_DIVIDEBUFFER+4] + ld [hDividend+1], a ; (aliases: hMultiplicand) + ld a, [hDivideBuffer+4] inc a - ld [H_DIVIDEBUFFER+4], a + ld [hDivideBuffer+4], a jr .asm_37db3 .asm_37dce ld a, b cp $1 jr z, .asm_37e18 - ld a, [H_DIVIDEBUFFER+4] + ld a, [hDivideBuffer+4] sla a - ld [H_DIVIDEBUFFER+4], a - ld a, [H_DIVIDEBUFFER+3] + ld [hDivideBuffer+4], a + ld a, [hDivideBuffer+3] rl a - ld [H_DIVIDEBUFFER+3], a - ld a, [H_DIVIDEBUFFER+2] + ld [hDivideBuffer+3], a + ld a, [hDivideBuffer+2] rl a - ld [H_DIVIDEBUFFER+2], a - ld a, [H_DIVIDEBUFFER+1] + ld [hDivideBuffer+2], a + ld a, [hDivideBuffer+1] rl a - ld [H_DIVIDEBUFFER+1], a + ld [hDivideBuffer+1], a dec e jr nz, .asm_37e04 ld a, $8 ld e, a - ld a, [H_DIVIDEBUFFER] - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [hDivideBuffer] + ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) xor a - ld [H_DIVIDEBUFFER], a - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) - ld a, [H_DIVIDEND+2] - ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND) - ld a, [H_DIVIDEND+3] - ld [H_DIVIDEND+2], a + ld [hDivideBuffer], a + ld a, [hDividend+1] ; (aliases: hMultiplicand) + ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient) + ld a, [hDividend+2] + ld [hDividend+1], a ; (aliases: hMultiplicand) + ld a, [hDividend+3] + ld [hDividend+2], a .asm_37e04 ld a, e cp $1 jr nz, .asm_37e0a dec b .asm_37e0a - ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) + ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10) srl a - ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) - ld a, [H_DIVIDEBUFFER] + ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) + ld a, [hDivideBuffer] rr a - ld [H_DIVIDEBUFFER], a + ld [hDivideBuffer], a jr .asm_37db3 .asm_37e18 - ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND) - ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN) - ld a, [H_DIVIDEBUFFER+4] - ld [H_QUOTIENT+3], a - ld a, [H_DIVIDEBUFFER+3] - ld [H_QUOTIENT+2], a - ld a, [H_DIVIDEBUFFER+2] - ld [H_QUOTIENT+1], a ; (aliases: H_MULTIPLICAND) - ld a, [H_DIVIDEBUFFER+1] - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [hDividend+1] ; (aliases: hMultiplicand) + ld [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) + ld a, [hDivideBuffer+4] + ld [hQuotient+3], a + ld a, [hDivideBuffer+3] + ld [hQuotient+2], a + ld a, [hDivideBuffer+2] + ld [hQuotient+1], a ; (aliases: hMultiplicand) + ld a, [hDivideBuffer+1] + ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient) ret diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index 5043ad22..e1f6c678 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -74,5 +74,5 @@ DisplayTextIDInit:: ld [hWY], a ; put the window on the screen call LoadFontTilePatterns ld a, $01 - ld [H_AUTOBGTRANSFERENABLED], a ; enable continuous WRAM to VRAM transfer each V-blank + ld [hAutoBGTransferEnabled], a ; enable continuous WRAM to VRAM transfer each V-blank ret diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 8eda6744..fe82ec4a 100755 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -342,7 +342,7 @@ CableClubOptionsText: DisplayContinueGameInfo: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 4, 7 ld b, 8 ld c, 14 @@ -360,13 +360,13 @@ DisplayContinueGameInfo: coord hl, 13, 15 call PrintPlayTime ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld c, 30 jp DelayFrames PrintSaveScreenText: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 4, 0 ld b, $8 ld c, $e @@ -386,7 +386,7 @@ PrintSaveScreenText: coord hl, 13, 8 call PrintPlayTime ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld c, 30 jp DelayFrames @@ -463,7 +463,7 @@ DisplayOptionMenu: ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate ld [wTopMenuItemX], a ld a, $01 - ld [H_AUTOBGTRANSFERENABLED], a ; enable auto background transfer + ld [hAutoBGTransferEnabled], a ; enable auto background transfer call Delay3 .loop call PlaceMenuCursor diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 6e78c5c3..efeab4c3 100755 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -337,7 +337,7 @@ ED_TileEnd: PrintAlphabet: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [wAlphabetCase] and a ld de, LowerCaseAlphabet @@ -362,7 +362,7 @@ PrintAlphabet: jr nz, .outerLoop call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jp Delay3 INCLUDE "data/text/alphabets.asm" diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 41b6074b..b64c1af8 100755 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -19,7 +19,7 @@ ; f8: leveled up DrawPartyMenu_:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen call UpdateSprites callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics @@ -88,14 +88,14 @@ RedrawPartyMenu_:: pop hl push hl ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] set 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a add hl, bc predef DrawHP2 ; draw HP bar and prints current / max HP - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] res 0, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl jr .printLevel @@ -213,7 +213,7 @@ RedrawPartyMenu_:: pop af ld [hl], a ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 jp GBPalNormal .printItemUseMessage diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 25c9ad89..0b7fb83c 100755 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -156,7 +156,7 @@ HandlePokedexSideMenu: ; sets carry flag if player presses A, unsets carry flag if player presses B HandlePokedexListMenu: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ; draw the horizontal line separating the seen and owned amounts from the menu coord hl, 15, 8 ld a, "─" @@ -216,7 +216,7 @@ HandlePokedexListMenu: ld [wDexMaxSeenMon], a .loop xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 4, 2 lb bc, 14, 10 call ClearScreenArea @@ -280,7 +280,7 @@ HandlePokedexListMenu: dec d jr nz, .printPokemonLoop ld a, 01 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 call GBPalNormal call HandleMenuInput diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 33a7ba8d..5aec7bd0 100755 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -351,10 +351,10 @@ ChangeBox:: call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 1, [hl] bit 1, a ; pressed b ret nz @@ -420,7 +420,7 @@ CopyBoxToOrFromSRAM: DisplayChangeBoxMenu: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, 11 @@ -445,12 +445,12 @@ DisplayChangeBoxMenu: ld b, 12 ld c, 7 call TextBoxBorder - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 2, [hl] ld de, BoxNames coord hl, 13, 1 call PlaceString - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 2, [hl] ld a, [wCurrentBoxNum] and $7f @@ -486,7 +486,7 @@ DisplayChangeBoxMenu: dec a jr nz, .loop ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret ChooseABoxText: diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index d9501da7..43c767e2 100755 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -239,21 +239,21 @@ StartMenu_Pokemon:: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hli] - ld [H_DIVIDEND], a + ld [hDividend], a ld a, [hl] - ld [H_DIVIDEND + 1], a + ld [hDividend + 1], a ld a, 5 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, 2 ; number of bytes call Divide ld bc, wPartyMon1HP - wPartyMon1MaxHP add hl, bc ld a, [hld] ld b, a - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] sub b ld b, [hl] - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] sbc b jp nc, .notHealthyEnough ld a, [wPartyAndBillsPCSavedMenuItem] @@ -648,7 +648,7 @@ StartMenu_SaveReset:: StartMenu_Option:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen call UpdateSprites callab DisplayOptionMenu diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index dd735df6..4ba50615 100755 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -47,7 +47,7 @@ FadeInCreditsText: DisplayCreditsMon: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call SaveScreenTilesToBuffer1 call FillMiddleOfScreenWithWhite @@ -67,7 +67,7 @@ DisplayCreditsMon: ld hl, vBGMap0 + $c call CreditsCopyTileMapToVRAM xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call LoadScreenTilesFromBuffer1 ld hl, vBGMap0 call CreditsCopyTileMapToVRAM @@ -138,11 +138,11 @@ HoFGBPalettes: CreditsCopyTileMapToVRAM: ld a, l - ld [H_AUTOBGTRANSFERDEST], a + ld [hAutoBGTransferDest], a ld a, h - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jp Delay3 ZeroMemory: diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index af2ed13b..1e3aaad4 100755 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -13,12 +13,12 @@ EvolveMon: ld [wNewSoundID], a call PlaySound ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, SFX_TINK call PlaySound call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [hTilesetType], a ld a, [wEvoOldSpecies] ld [wWholeScreenPaletteMonSpecies], a @@ -37,7 +37,7 @@ EvolveMon: ld [wd0b5], a call Evolution_LoadPic ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [wEvoOldSpecies] call PlayCry call WaitForSoundToFinish @@ -117,7 +117,7 @@ Evolution_BackAndForthAnim: Evolution_ChangeMonPic: push bc xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 7, 2 lb bc, 7, 7 ld de, SCREEN_WIDTH - 7 @@ -134,7 +134,7 @@ Evolution_ChangeMonPic: dec b jr nz, .loop ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 pop bc ret diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 3c9b1723..d874b2fd 100755 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -24,7 +24,7 @@ AnimateHallOfFame: ld [wLetterPrintingDelayFlags], a ; no delay ld [wHoFMonOrPlayer], a ; mon inc a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, wNumHoFTeams ld a, [hl] inc a diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 9a13c96f..a8151ab4 100755 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -14,13 +14,13 @@ PlayIntro: xor a ld [hJoyHeld], a inc a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call PlayShootingStar call PlayIntroScene call GBFadeOutToWhite xor a ld [hSCX], a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearSprites call DelayFrame ret diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index fdcb4778..ea7b84d8 100755 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -104,12 +104,12 @@ OakSpeech: ld hl, OakSpeechText3 call PrintText .next - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, SFX_SHRINK call PlaySound pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld c, 4 call DelayFrames @@ -126,7 +126,7 @@ OakSpeech: lb bc, BANK(ShrinkPic2), $00 call IntroDisplayPicCenteredOrUpperRight call ResetPlayerSpriteData - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(Music_PalletTown) ld [wAudioROMBank], a @@ -137,7 +137,7 @@ OakSpeech: ld [wNewSoundID], a call PlaySound pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld c, 20 call DelayFrames diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm index d7112440..8c4a896b 100755 --- a/engine/movie/oak_speech/oak_speech2.asm +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -107,7 +107,7 @@ OakSpeechSlidePicCommon: ld e, l .loop xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [hSlideDirection] and a jr nz, .slideLeft @@ -134,7 +134,7 @@ OakSpeechSlidePicCommon: ld [hl], a .next3 ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 ld a, [hSlidingRegionSize] ld c, a diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 4bdbb05d..1a2d16a0 100755 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -24,7 +24,7 @@ SetDefaultNamesBeforeTitlescreen:: DisplayTitleScreen: call GBPalWhiteOut ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a xor a ld [hTilesetType], a ld [hSCX], a @@ -239,7 +239,7 @@ ENDC xor a ld [hWY], a inc a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen ld a, vBGMap0 / $100 call TitleScreenCopyTileMapToVRAM @@ -358,7 +358,7 @@ LoadTitleMonSprite: jp LoadFrontSpriteByMonIndex TitleScreenCopyTileMapToVRAM: - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a jp Delay3 LoadCopyrightAndTextBoxTiles: diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index 8bc8e3bc..6af6f2e3 100755 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -137,10 +137,10 @@ Trade_Delay100: Trade_CopyTileMapToVRAM: ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret Trade_Delay80: @@ -184,7 +184,7 @@ LoadTradingGFXAndMonNames: ld [rOBP0], a call EnableLCD xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [wTradedPlayerMonSpecies] ld [wd11e], a call GetMonName @@ -231,7 +231,7 @@ Trade_ShowPlayerMon: ld [rWX], a ld [hSCX], a xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 4, 0 ld b, 6 ld c, 10 @@ -261,7 +261,7 @@ Trade_ShowPlayerMon: ld a, [wTradedPlayerMonSpecies] call PlayCry xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret Trade_DrawOpenEndOfLinkCable: @@ -336,13 +336,13 @@ Trade_AnimateBallEnteringLinkCable: .ballSpriteReachedEdgeOfScreen call ClearSprites ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen ld b, $98 call CopyScreenTileBufferToVRAM call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret Trade_BallInsideLinkCableOAM: @@ -360,13 +360,13 @@ Trade_ShowEnemyMon: call Trade_PrintEnemyMonInfoText call Trade_CopyTileMapToVRAM ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [wTradedEnemyMonSpecies] call Trade_LoadMonSprite ld a, TRADE_BALL_POOF_ANIM call Trade_ShowAnimation ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, [wTradedEnemyMonSpecies] call PlayCry call Trade_Delay100 @@ -397,7 +397,7 @@ Trade_AnimLeftToRight: ld b, $6 call Trade_AnimMonMoveHorizontal ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Trade_DrawCableAcrossScreen ld b, $4 call Trade_AnimMonMoveHorizontal @@ -405,7 +405,7 @@ Trade_AnimLeftToRight: ld b, $6 call Trade_AnimMonMoveHorizontal xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Trade_AnimMonMoveVertical jp ClearSprites @@ -430,7 +430,7 @@ Trade_AnimRightToLeft: ld b, $6 call Trade_AnimMonMoveHorizontal ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Trade_DrawCableAcrossScreen ld b, $4 call Trade_AnimMonMoveHorizontal @@ -438,16 +438,16 @@ Trade_AnimRightToLeft: ld b, $6 call Trade_AnimMonMoveHorizontal xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a jp ClearSprites Trade_InitGameboyTransferGfx: ; Initialises the graphics for showing a mon moving between gameboys. ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Trade_LoadMonPartySpriteGfx call DelayFrame ld a, %10101011 @@ -731,9 +731,9 @@ Trade_LoadMonSprite: ld b, SET_PAL_POKEMON_WHOLE_SCREEN ld c, 0 call RunPaletteCommand - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] xor $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call GetMonHeader coord hl, 7, 2 call LoadFlippedFrontSpriteByMonIndex @@ -743,7 +743,7 @@ Trade_LoadMonSprite: Trade_ShowClearedWindow: ; clears the window and covers the BG entirely with the window ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call ClearScreen ld a, %11100011 ld [rLCDC], a diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index e478c9ad..421e3180 100755 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -66,7 +66,7 @@ PalletMovementScript_OakMoveLeft: call FillMemory ld [hl], $ff ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, wNPCMovementDirections2 call MoveSprite ld a, $1 @@ -282,7 +282,7 @@ FreezeEnemyTrainerSprite:: jr .loop .notRival ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp SetSpriteMovementBytesToFF RivalIDs: diff --git a/engine/overworld/clear_variables.asm b/engine/overworld/clear_variables.asm index 32dc85cd..b5a1f4a0 100644 --- a/engine/overworld/clear_variables.asm +++ b/engine/overworld/clear_variables.asm @@ -3,7 +3,7 @@ ClearVariablesOnEnterMap:: ld [hWY], a ld [rWY], a xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [wStepCounter], a ld [wLoneAttackNo], a ld [hJoyPressed], a diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 7d6de545..6d365715 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -31,19 +31,19 @@ LoadMissableObjects: sub d ld h, a ld a, h - ld [H_DIVIDEND], a + ld [hDividend], a ld a, l - ld [H_DIVIDEND+1], a + ld [hDividend+1], a xor a - ld [H_DIVIDEND+2], a - ld [H_DIVIDEND+3], a + ld [hDividend+2], a + ld [hDividend+3], a ld a, $3 - ld [H_DIVISOR], a + ld [hDivisor], 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, [hDividend+3] ld c, a ; store global offset in c ld de, wMissableObjectList pop hl @@ -99,7 +99,7 @@ InitializeMissableObjectsFlags: ; tests if current sprite is a missable object that is hidden/has been removed IsObjectHidden: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] swap a ld b, a ld hl, wMissableObjectList diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index f272f497..432ae5ca 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -63,7 +63,7 @@ UpdatePlayerSprite: ld a, [wd736] bit 7, a ; is the player sprite spinning due to a spin tile? jr nz, .skipSpriteAnim - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] @@ -103,7 +103,7 @@ UpdatePlayerSprite: UnusedReadSpriteDataFunction: push bc push af - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld c, a pop af add c @@ -112,7 +112,7 @@ UnusedReadSpriteDataFunction: ret UpdateNPCSprite: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] swap a dec a add a @@ -122,7 +122,7 @@ UpdateNPCSprite: ld a, [hl] ; read movement byte 2 ld [wCurSpriteMovement2], a ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc l ld a, [hl] ; c1x1 @@ -131,7 +131,7 @@ UpdateNPCSprite: call CheckSpriteAvailability ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc l ld a, [hl] ; c1x1 @@ -151,7 +151,7 @@ UpdateNPCSprite: ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 @@ -264,11 +264,11 @@ ChangeFacingDirection: TryWalking: push hl ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld [hl], c ; c1x9 (update facing direction) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $3 ld l, a ld [hl], d ; c1x3 (update Y movement delta) @@ -282,7 +282,7 @@ TryWalking: pop de ret c ; cannot walk there (reinitialization of delay values already done) ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hl] ; c2x4: Y position @@ -291,7 +291,7 @@ TryWalking: ld a, [hl] ; c2x5: X position add e ld [hl], a ; update X position - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a ld [hl], $10 ; c2x0=16: walk animation counter dec h @@ -301,7 +301,7 @@ TryWalking: ; update the walking animation parameters for a sprite that is currently walking UpdateSpriteInWalkingAnimation: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] ; c1x7 (counter until next walk animation frame) @@ -317,7 +317,7 @@ UpdateSpriteInWalkingAnimation: and $3 ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) .noNextAnimationFrame - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $3 ld l, a ld a, [hli] ; c1x3 (movement Y delta) @@ -330,7 +330,7 @@ UpdateSpriteInWalkingAnimation: ld a, [hl] ; c1x6 (screen X position) add b ld [hl], a ; update screen X position - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc h ld a, [hl] ; c2x0 (walk animation counter) @@ -343,7 +343,7 @@ UpdateSpriteInWalkingAnimation: ld a, [hl] ; c2x6 (movement byte 1) cp $fe jr nc, .initNextMovementCounter ; values $fe and $ff - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a dec h @@ -351,14 +351,14 @@ UpdateSpriteInWalkingAnimation: ret .initNextMovementCounter call Random - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, [hRandomAdd] and $7f ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] dec h ; note that value 0 actually makes the delay $100 (bug?) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $2 ; c1x1 = 2 (movement status) @@ -375,7 +375,7 @@ UpdateSpriteInWalkingAnimation: ; update delay value (c2x8) for sprites in the delayed state (c1x1) UpdateSpriteMovementDelay: ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 @@ -390,13 +390,13 @@ UpdateSpriteMovementDelay: jr nz, notYetMoving .moving dec h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld [hl], $0 ; c1x8 = 0 (walk animation frame) @@ -429,7 +429,7 @@ MakeNPCFacePlayer: .notFacingRight ld c, SPRITE_FACING_LEFT .facingDirectionDetermined - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld [hl], c ; c1x9: set facing direction @@ -440,7 +440,7 @@ InitializeSpriteStatus: inc l ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen) inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, $8 @@ -451,7 +451,7 @@ InitializeSpriteStatus: ; calculates the sprite's screen position form its map position and the player position InitializeSpriteScreenPosition: ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [wYCoord] @@ -479,13 +479,13 @@ CheckSpriteAvailability: and a jp nz, .spriteInvisible ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 cp $fe jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld b, [hl] ; c2x4: Y pos (+4) @@ -527,7 +527,7 @@ CheckSpriteAvailability: jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile) .spriteInvisible ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld [hl], $ff ; c1x2 @@ -540,7 +540,7 @@ CheckSpriteAvailability: jr nz, .done ; if player is currently walking, we're done call UpdateSpriteImage inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [wGrassTile] @@ -556,7 +556,7 @@ CheckSpriteAvailability: UpdateSpriteImage: ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, [hli] ; c1x8: walk animation frame @@ -567,7 +567,7 @@ UpdateSpriteImage: ld a, [$ff93] ; current sprite offset add b ld b, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld [hl], b ; c1x2: sprite to display @@ -581,7 +581,7 @@ UpdateSpriteImage: ; set carry on failure, clears carry on success CanWalkOntoTile: ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6 (movement byte 1) @@ -602,14 +602,14 @@ CanWalkOntoTile: cp c jr nz, .tilePassableLoop ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hli] ; c1x4 (screen Y pos) @@ -628,14 +628,14 @@ CanWalkOntoTile: pop bc pop de ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go) @@ -666,7 +666,7 @@ CanWalkOntoTile: ret .impassable ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $2 ; c1x1 = 2 (set movement status to delayed) @@ -677,7 +677,7 @@ CanWalkOntoTile: inc l ld [hl], a ; c1x5 = 0 (clear X movement delta) inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a call Random @@ -692,7 +692,7 @@ CanWalkOntoTile: ; hl: output pointer GetTileSpriteStandsOn: ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hli] ; c1x4: screen Y position @@ -784,7 +784,7 @@ DoScriptedNPCMovement: ld a, [hl] add b ld [hl], a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, c @@ -817,7 +817,7 @@ GetSpriteScreenXPointer: GetSpriteScreenXYPointerCommon: ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add l add b ld l, a @@ -825,7 +825,7 @@ GetSpriteScreenXYPointerCommon: AnimScriptedNPCMovement: ld hl, wSpriteStateData2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $e ld l, a ld a, [hl] ; VRAM slot @@ -833,7 +833,7 @@ AnimScriptedNPCMovement: swap a ld b, a ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, [hl] ; facing direction @@ -852,7 +852,7 @@ AnimScriptedNPCMovement: ld [hSpriteVRAMSlotAndFacing], a call AdvanceScriptedNPCAnimFrameCounter ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hSpriteVRAMSlotAndFacing] @@ -863,7 +863,7 @@ AnimScriptedNPCMovement: ret AdvanceScriptedNPCAnimFrameCounter: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] ; intra-animation frame counter diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index c45554f1..e4dd91cf 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -92,7 +92,7 @@ DoBoulderDustAnimation:: call ResetBoulderPushFlags set 7, [hl] ld a, [wBoulderSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteMovementByte2Pointer ld [hl], $10 ld a, SFX_CUT diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 0e6b2d06..43d1759c 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -6,7 +6,7 @@ _UpdateSprites:: ld l, a sub $e ld c, a - ld [H_CURRENTSPRITEOFFSET], a + ld [hCurrentSpriteOffset], a ld a, [hl] and a jr z, .skipSprite ; tests $c2Xe @@ -34,14 +34,14 @@ UpdateNonPlayerSprite: ld [$ff93], a ; $10 * sprite# ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? ld b, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] cp b jr nz, .unequal jp DoScriptedNPCMovement .unequal jp UpdateNPCSprite -; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET) +; This detects if the current sprite (whose offset is at hCurrentSpriteOffset) ; is going to collide with another sprite by looping over the other sprites. ; The current sprite's offset will be labelled with i (e.g. $c1i0). ; The loop sprite's offset will labelled with j (e.g. $c1j0). @@ -54,7 +54,7 @@ DetectCollisionBetweenSprites: nop ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add wSpriteStateData1 % $100 ld l, a @@ -113,7 +113,7 @@ DetectCollisionBetweenSprites: ld [$ff8f], a ; store loop counter swap a ld e, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] cp e ; does the loop sprite match the current sprite? jp z, .next ; go to the next sprite if they match @@ -128,7 +128,7 @@ DetectCollisionBetweenSprites: inc a jp z, .next ; go the next sprite if offscreen - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add 10 ld l, a diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index 5a68b627..f0ea7266 100755 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -2,7 +2,7 @@ _GetSpritePosition1:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) ld [$ffeb], a @@ -21,7 +21,7 @@ _GetSpritePosition2:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) ld [wSavedSpriteScreenY], a @@ -40,7 +40,7 @@ _SetSpritePosition1:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [$ffeb] ; c1x4 (screen Y pos) ld [hli], a @@ -59,7 +59,7 @@ _SetSpritePosition2:: ld hl, wSpriteStateData1 ld de, 4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [wSavedSpriteScreenY] ld [hli], a ; c1x4 (screen Y pos) @@ -144,7 +144,7 @@ TrainerWalkUpToPlayer:: call FillMemory ; write the necessary steps to reach player ld [hl], $ff ; write end of list sentinel ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp MoveSprite_ ; input: de = offset within sprite entry @@ -152,7 +152,7 @@ TrainerWalkUpToPlayer:: GetSpriteDataPointer: push de add hl, de - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] swap a ld d, $0 ld e, a diff --git a/engine/overworld/turn_sprite.asm b/engine/overworld/turn_sprite.asm index c7f7712b..bef26537 100755 --- a/engine/overworld/turn_sprite.asm +++ b/engine/overworld/turn_sprite.asm @@ -1,12 +1,12 @@ UpdateSpriteFacingOffsetAndDelayMovement:: ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, $7f ; maximum movement delay ld [hl], a ; c2x8 (movement delay) dec h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, [hld] ; c1x9 (facing direction) @@ -14,7 +14,7 @@ UpdateSpriteFacingOffsetAndDelayMovement:: xor a ld [hld], a ld [hl], a ; c1x8 (walk animation frame) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hl] ; c1x2 (facing and animation table offset) diff --git a/engine/overworld/update_map.asm b/engine/overworld/update_map.asm index 8577b9e7..c494065c 100644 --- a/engine/overworld/update_map.asm +++ b/engine/overworld/update_map.asm @@ -50,12 +50,12 @@ RedrawMapView: ld a, [wIsInBattle] inc a ret z - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] push af ld a, [hTilesetType] push af xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [hTilesetType], a ; no flower/water BG tile animations call LoadCurrentMapView call RunDefaultPaletteCommand @@ -114,7 +114,7 @@ RedrawMapView: pop af ld [hTilesetType], a pop af - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret CompareHLWithBC: diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 7627136b..8d0a6495 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -129,10 +129,10 @@ _AddPartyMon:: xor a ld b, a call CalcStat ; calc HP stat (set cur Hp to max HP) - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] ld [de], a inc de - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] ld [de], a inc de xor a diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 7d599404..1a97caf0 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1,6 +1,6 @@ DisplayPCMainMenu:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call SaveScreenTilesToBuffer2 ld a, [wNumHoFTeams] and a @@ -82,7 +82,7 @@ DisplayPCMainMenu:: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret SomeonesPCText: db "SOMEONE's PC@" @@ -168,7 +168,7 @@ BillsPCMenu: ld de, BoxNoPCText call PlaceString ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 call HandleMenuInput bit 1, a diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index d25b71ec..36f135cc 100755 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -120,12 +120,12 @@ Evolution_PartyMonLoop: ; loop over party mons ld c, 50 call DelayFrames xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a coord hl, 0, 0 lb bc, 12, 20 call ClearScreenArea ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld a, $ff ld [wUpdateSpritesEnabled], a call ClearSprites diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 3ee4b2a8..76e6b88b 100755 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -38,58 +38,58 @@ CalcExperience:: add hl, bc call CalcDSquared ld a, d - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, [hl] and $f0 swap a - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld a, [hli] and $f - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [H_QUOTIENT + 1] + ld a, [hQuotient + 1] push af - ld a, [H_QUOTIENT + 2] + ld a, [hQuotient + 2] push af - ld a, [H_QUOTIENT + 3] + ld a, [hQuotient + 3] push af call CalcDSquared ld a, [hl] and $7f - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply - ld a, [H_PRODUCT + 1] + ld a, [hProduct + 1] push af - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] push af - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] push af ld a, [hli] push af xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, d - ld [H_MULTIPLICAND + 2], a + ld [hMultiplicand + 2], a ld a, [hli] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ld b, [hl] - ld a, [H_PRODUCT + 3] + ld a, [hProduct + 3] sub b - ld [H_PRODUCT + 3], a + ld [hProduct + 3], a ld b, $0 - ld a, [H_PRODUCT + 2] + ld a, [hProduct + 2] sbc b - ld [H_PRODUCT + 2], a - ld a, [H_PRODUCT + 1] + ld [hProduct + 2], a + ld a, [hProduct + 1] sbc b - ld [H_PRODUCT + 1], a + ld [hProduct + 1], a ; The difference of the linear term and the constant term consists of 3 bytes -; starting at H_PRODUCT + 1. Below, hExperience (an alias of that address) will +; starting at hProduct + 1. Below, hExperience (an alias of that address) will ; be used instead for the further work of adding or subtracting the squared ; term and adding the cubed term. pop af @@ -139,11 +139,11 @@ CalcExperience:: ; calculates d*d CalcDSquared: xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, d - ld [H_MULTIPLICAND + 2], a - ld [H_MULTIPLIER], a + ld [hMultiplicand + 2], a + ld [hMultiplier], a jp Multiply INCLUDE "data/growth_rates.asm" diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 53c7f87e..09413c9b 100755 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -126,13 +126,13 @@ TryingToLearn: call TextBoxBorder coord hl, 6, 8 ld de, wMovesString - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] set 2, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a call PlaceString - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] res 2, a - ld [hFlags_0xFFF6], a + ld [hFlagsFFF6], a ld hl, wTopMenuItemY ld a, 8 ld [hli], a ; wTopMenuItemY @@ -146,10 +146,10 @@ TryingToLearn: ld a, A_BUTTON | B_BUTTON ld [hli], a ; wMenuWatchedKeys ld [hl], 0 ; wLastMenuItem - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 set 1, [hl] call HandleMenuInput - ld hl, hFlags_0xFFF6 + ld hl, hFlagsFFF6 res 1, [hl] push af call LoadScreenTilesFromBuffer1 diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 20bee0ee..f66cdf5a 100755 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -40,7 +40,7 @@ DrawHP_: push hl call DrawHPBar pop hl - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] bit 0, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar @@ -299,7 +299,7 @@ StatusScreen2: push af xor a ld [hTilesetType], a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld bc, NUM_MOVES + 1 ld hl, wMoves call FillMemory @@ -424,7 +424,7 @@ StatusScreen2: coord hl, 9, 1 call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 call WaitForTextScrollButtonPress ; wait for button pop af diff --git a/engine/slots/game_corner_slots.asm b/engine/slots/game_corner_slots.asm index 2108695f..d95d20a3 100755 --- a/engine/slots/game_corner_slots.asm +++ b/engine/slots/game_corner_slots.asm @@ -22,7 +22,7 @@ StartSlotMachine: ld a, 250 .next ld [wSlotMachineSevenAndBarModeChance], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wSlotMachineSavedROMBank], a call PromptUserToPlaySlots ret diff --git a/home.asm b/home.asm index 07cb6c0e..e9cd3ecf 100644 --- a/home.asm +++ b/home.asm @@ -53,10 +53,10 @@ CheckForUserInterruption:: ; a = ID of destination warp within destination map LoadDestinationWarpPosition:: ld b, a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wPredefParentBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, b add a @@ -68,7 +68,7 @@ LoadDestinationWarpPosition:: ld de, wCurrentTileBlockMapViewPointer call CopyData pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -197,10 +197,10 @@ LoadFrontSpriteByMonIndex:: ld de, vFrontPic call LoadMonFrontSprite pop hl - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, Bank(CopyUncompressedPicToHL) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a xor a ld [hStartTileID], a @@ -208,7 +208,7 @@ LoadFrontSpriteByMonIndex:: xor a ld [wSpriteFlipped], a pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -400,15 +400,15 @@ PrintStatusCondition:: ret PrintStatusConditionNotFainted:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(PrintStatusAilment) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call PrintStatusAilment ; print status condition pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -457,10 +457,10 @@ GetwMoves:: ; INPUT: ; [wd0b5] = pokemon ID GetMonHeader:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(BaseStats) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a push bc push de @@ -515,7 +515,7 @@ GetMonHeader:: pop de pop bc pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -681,7 +681,7 @@ LoadMonFrontSprite:: LoadUncompressedSpriteData:: push de and $f - ld [H_SPRITEWIDTH], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width + ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width ld b, a ld a, $7 sub b ; 7-w @@ -692,7 +692,7 @@ LoadUncompressedSpriteData:: add a add a sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles) - ld [H_SPRITEOFFSET], a + ld [hSpriteOffset], a ld a, c swap a and $f @@ -700,16 +700,16 @@ LoadUncompressedSpriteData:: add a add a add a ; 8*tiles is height in bytes - ld [H_SPRITEHEIGHT], a + ld [hSpriteHeight], a ld a, $7 sub b ; 7-h ; skip for vertical center (in tiles, relative to current column) ld b, a - ld a, [H_SPRITEOFFSET] + ld a, [hSpriteOffset] add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles) add a add a add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) - ld [H_SPRITEOFFSET], a + ld [hSpriteOffset], a xor a ld [$4000], a ld hl, sSpriteBuffer0 @@ -728,15 +728,15 @@ LoadUncompressedSpriteData:: ; copies and aligns the sprite data properly inside the sprite buffer ; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area AlignSpriteDataCentered:: - ld a, [H_SPRITEOFFSET] + ld a, [hSpriteOffset] ld b, $0 ld c, a add hl, bc - ld a, [H_SPRITEWIDTH] + ld a, [hSpriteWidth] .columnLoop push af push hl - ld a, [H_SPRITEHEIGHT] + ld a, [hSpriteHeight] ld c, a .columnInnerLoop ld a, [de] @@ -775,7 +775,7 @@ InterlaceMergeSpriteBuffers:: ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 ld a, SPRITEBUFFERSIZE/2 ; $c4 - ld [H_SPRITEINTERLACECOUNTER], a + ld [hSpriteInterlaceCounter], a .interlaceLoop ld a, [de] dec de @@ -789,9 +789,9 @@ InterlaceMergeSpriteBuffers:: ld a, [bc] dec bc ld [hld], a ; write byte of source 1 - ld a, [H_SPRITEINTERLACECOUNTER] + ld a, [hSpriteInterlaceCounter] dec a - ld [H_SPRITEINTERLACECOUNTER], a + ld [hSpriteInterlaceCounter], a jr nz, .interlaceLoop ld a, [wSpriteFlipped] and a @@ -809,7 +809,7 @@ InterlaceMergeSpriteBuffers:: pop hl ld de, sSpriteBuffer1 ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld b, a jp CopyVideoData @@ -830,14 +830,14 @@ UpdateSprites:: ld a, [wUpdateSpritesEnabled] dec a ret nz - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, Bank(_UpdateSprites) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call _UpdateSprites pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -951,7 +951,7 @@ FadeOutAudio:: ; this function is used to display sign messages, sprite dialog, etc. ; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID DisplayTextID:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af callba DisplayTextIDInit ; initialization ld hl, wTextPredefFlag @@ -962,7 +962,7 @@ DisplayTextID:: call SwitchToMapRomBank .skipSwitchToMapBank ld a, 30 ; half a second - ld [H_FRAMECOUNTER], a ; used as joypad poll timer + ld [hFrameCounter], a ; used as joypad poll timer ld hl, wMapTextPtr ld a, [hli] ld h, [hl] @@ -1065,7 +1065,7 @@ CloseTextDisplay:: call DelayFrame call LoadGBPal xor a - ld [H_AUTOBGTRANSFERENABLED], a ; disable continuous WRAM to VRAM transfer each V-blank + ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank ; loop to make sprites face the directions they originally faced before the dialogue ld hl, wSpriteStateData2 + $19 ld c, $0f @@ -1079,7 +1079,7 @@ CloseTextDisplay:: dec c jr nz, .restoreSpriteFacingDirectionLoop ld a, BANK(InitMapSprites) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded @@ -1089,7 +1089,7 @@ CloseTextDisplay:: call z, LoadPlayerSpriteGraphics call LoadCurrentMapView pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a jp UpdateSprites @@ -1102,14 +1102,14 @@ DisplayPokemartDialogue:: call LoadItemList ld a, PRICEDITEMLISTMENU ld [wListMenuID], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, Bank(DisplayPokemartDialogue_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call DisplayPokemartDialogue_ pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a jp AfterDisplayingTextID @@ -1141,14 +1141,14 @@ DisplayPokemonCenterDialogue:: ld [$ff8d], a inc hl - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, Bank(DisplayPokemonCenterDialogue_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call DisplayPokemonCenterDialogue_ pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a jp AfterDisplayingTextID @@ -1237,14 +1237,14 @@ AddAmountSoldToMoney:: ; [wWhichPokemon] = index (within the inventory) of the item to remove ; [wItemQuantity] = quantity to remove RemoveItemFromInventory:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(RemoveItemFromInventory_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call RemoveItemFromInventory_ pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -1256,15 +1256,15 @@ RemoveItemFromInventory:: ; sets carry flag if successful, unsets carry flag if unsuccessful AddItemToInventory:: push bc - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(AddItemToInventory_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call AddItemToInventory_ pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop bc ret @@ -1274,7 +1274,7 @@ AddItemToInventory:: ; [wListPointer] = address of the list (2 bytes) DisplayListMenuID:: xor a - ld [H_AUTOBGTRANSFERENABLED], a ; disable auto-transfer + ld [hAutoBGTransferEnabled], a ; disable auto-transfer ld a, 1 ld [hJoy7], a ; joypad state update flag ld a, [wBattleType] @@ -1328,10 +1328,10 @@ DisplayListMenuID:: DisplayListMenuIDLoop:: xor a - ld [H_AUTOBGTRANSFERENABLED], a ; disable transfer + ld [hAutoBGTransferEnabled], a ; disable transfer call PrintListMenuEntries ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a ; enable transfer + ld [hAutoBGTransferEnabled], a ; enable transfer call Delay3 ld a, [wBattleType] and a ; is it the Old Man battle? @@ -1798,10 +1798,10 @@ ListMenuCancelText:: GetMonName:: push hl - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(MonsterNames) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, [wd11e] dec a @@ -1817,7 +1817,7 @@ GetMonName:: ld [hl], "@" pop de pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop hl ret @@ -1941,7 +1941,7 @@ GetMoveName:: ; reloads text box tile patterns, current map view, and tileset tile patterns ReloadMapData:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wCurMap] call SwitchToMapRomBank @@ -1951,13 +1951,13 @@ ReloadMapData:: call LoadTilesetTilePatternData call EnableLCD pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret ; reloads tileset tile patterns ReloadTilesetTilePatterns:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wCurMap] call SwitchToMapRomBank @@ -1965,7 +1965,7 @@ ReloadTilesetTilePatterns:: call LoadTilesetTilePatternData call EnableLCD pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2002,15 +2002,15 @@ UseItem:: ; OUTPUT: ; clears carry flag if the item is tossed, sets carry flag if not TossItem:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(TossItem_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call TossItem_ pop de ld a, d - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2036,15 +2036,15 @@ IsKeyItem:: ; [wTextBoxID] = text box ID ; b, c = y, x cursor position (TWO_OPTION_MENU only) DisplayTextBoxID:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(DisplayTextBoxID_) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call DisplayTextBoxID_ pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2078,15 +2078,15 @@ RunNPCMovementScript:: ld a, [hli] ld h, [hl] ld l, a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wNPCMovementScriptBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, [wNPCMovementScriptFunctionNum] call CallFunctionInTable pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2407,7 +2407,7 @@ CheckForEngagingTrainers:: ; hl = text if the player wins ; de = text if the player loses SaveEndBattleTextPointers:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wEndBattleTextRomBank], a ld a, h ld [wEndBattleWinTextPointer], a @@ -2442,10 +2442,10 @@ PrintEndBattleText:: res 7, [hl] pop hl ret z - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wEndBattleTextRomBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a push hl callba SaveTrainerName @@ -2453,7 +2453,7 @@ PrintEndBattleText:: call PrintText pop hl pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a callba FreezeEnemyTrainerSprite jp WaitForSoundToFinish @@ -2623,7 +2623,7 @@ SetSpriteFacingDirectionAndDelay:: SetSpriteFacingDirection:: ld a, $9 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld a, [hSpriteFacingDirection] ld [hl], a @@ -2678,14 +2678,14 @@ CheckCoords:: ; tests if a boulder's coordinates are in a specified array ; INPUT: ; hl = address of array -; [H_SPRITEINDEX] = index of boulder sprite +; [hSpriteIndex] = index of boulder sprite ; OUTPUT: ; [wCoordIndex] = if there is match, the matching array index ; sets carry if the coordinates are in the array, clears carry if not CheckBoulderCoords:: push hl ld hl, wSpriteStateData2 + $04 - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] swap a ld d, $0 ld e, a @@ -2707,9 +2707,9 @@ GetPointerWithinSpriteStateData2:: ld h, $c2 _GetPointerWithinSpriteStateData: - ld a, [H_SPRITEDATAOFFSET] + ld a, [hSpriteDataOffset] ld b, a - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] swap a add b ld l, a @@ -2746,7 +2746,7 @@ DecodeRLEList:: inc a ; include sentinel in counting ret -; sets movement byte 1 for sprite [H_SPRITEINDEX] to $FE and byte 2 to [hSpriteMovementByte2] +; sets movement byte 1 for sprite [hSpriteIndex] to $FE and byte 2 to [hSpriteMovementByte2] SetSpriteMovementBytesToFE:: push hl call GetSpriteMovementByte1Pointer @@ -2757,7 +2757,7 @@ SetSpriteMovementBytesToFE:: pop hl ret -; sets both movement bytes for sprite [H_SPRITEINDEX] to $FF +; sets both movement bytes for sprite [hSpriteIndex] to $FF SetSpriteMovementBytesToFF:: push hl call GetSpriteMovementByte1Pointer @@ -2767,20 +2767,20 @@ SetSpriteMovementBytesToFF:: pop hl ret -; returns the sprite movement byte 1 pointer for sprite [H_SPRITEINDEX] in hl +; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl GetSpriteMovementByte1Pointer:: ld h, $C2 - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] swap a add 6 ld l, a ret -; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl +; returns the sprite movement byte 2 pointer for sprite [hSpriteIndex] in hl GetSpriteMovementByte2Pointer:: push de ld hl, wMapSpriteData - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] dec a add a ld d, 0 @@ -2846,27 +2846,27 @@ BankswitchHome:: ; switches to bank # in a ; Only use this when in the home bank! ld [wBankswitchHomeTemp], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wBankswitchHomeSavedROMBank], a ld a, [wBankswitchHomeTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret BankswitchBack:: ; returns from BankswitchHome ld a, [wBankswitchHomeSavedROMBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret Bankswitch:: ; self-contained bankswitch, use this when not in the home bank ; switches to the bank in b - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld bc, .Return push bc @@ -2874,7 +2874,7 @@ Bankswitch:: .Return pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2929,7 +2929,7 @@ CalcDifference:: ret MoveSprite:: -; move the sprite [H_SPRITEINDEX] with the movement pointed to by de +; move the sprite [hSpriteIndex] with the movement pointed to by de ; actually only copies the movement data to wNPCMovementDirections for later call SetSpriteMovementBytesToFF MoveSprite_:: @@ -3068,13 +3068,13 @@ SaveScreenTilesToBuffer2:: LoadScreenTilesFromBuffer2:: call LoadScreenTilesFromBuffer2DisableBGTransfer ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret -; loads screen tiles stored in wTileMapBackup2 but leaves H_AUTOBGTRANSFERENABLED disabled +; loads screen tiles stored in wTileMapBackup2 but leaves hAutoBGTransferEnabled disabled LoadScreenTilesFromBuffer2DisableBGTransfer:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, wTileMapBackup2 coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -3089,13 +3089,13 @@ SaveScreenTilesToBuffer1:: LoadScreenTilesFromBuffer1:: xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld hl, wTileMapBackup coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret DelayFrames:: @@ -3154,7 +3154,7 @@ GetName:: cp HM_01 jp nc, GetMachineName - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af push hl push bc @@ -3172,7 +3172,7 @@ GetName:: .otherEntries ;2-7 = OTHER ENTRIES ld a, [wPredefBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, [wNameListType] ;VariousNames' entryID dec a @@ -3220,14 +3220,14 @@ GetName:: pop bc pop hl pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret GetItemPrice:: ; Stores item's price as BCD at hItemPrice (3 bytes) ; Input: [wcf91] = item id - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wListMenuID] cp MOVESLISTMENU @@ -3235,7 +3235,7 @@ GetItemPrice:: jr nz, .ok ld a, $f ; hardcoded Bank .ok - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld hl, wItemPrices ld a, [hli] @@ -3259,13 +3259,13 @@ GetItemPrice:: jr .done .getTMPrice ld a, Bank(GetMachinePrice) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call GetMachinePrice .done ld de, hItemPrice pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -3312,10 +3312,10 @@ JoypadLowSensitivity:: jr z, .noNewlyPressedButtons .newlyPressedButtons ld a, 30 ; half a second delay - ld [H_FRAMECOUNTER], a + ld [hFrameCounter], a ret .noNewlyPressedButtons - ld a, [H_FRAMECOUNTER] + ld a, [hFrameCounter] and a ; is the delay over? jr z, .delayOver .delayNotOver @@ -3334,18 +3334,18 @@ JoypadLowSensitivity:: ld [hJoy5], a .setShortDelay ld a, 5 ; 1/12 of a second delay - ld [H_FRAMECOUNTER], a + ld [hFrameCounter], a ret WaitForTextScrollButtonPress:: - ld a, [H_DOWNARROWBLINKCNT1] + ld a, [hDownArrowBlinkCount1] push af - ld a, [H_DOWNARROWBLINKCNT2] + ld a, [hDownArrowBlinkCount2] push af xor a - ld [H_DOWNARROWBLINKCNT1], a + ld [hDownArrowBlinkCount1], a ld a, $6 - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a .loop push hl ld a, [wTownMapSpriteBlinkingEnabled] @@ -3362,9 +3362,9 @@ WaitForTextScrollButtonPress:: and A_BUTTON | B_BUTTON jr z, .loop pop af - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a pop af - ld [H_DOWNARROWBLINKCNT1], a + ld [hDownArrowBlinkCount1], a ret ; (unless in link battle) waits for A or B being pressed and outputs the scrolling sound effect @@ -3407,14 +3407,14 @@ Divide:: push hl push de push bc - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, Bank(_Divide) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call _Divide pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop bc pop de @@ -3439,11 +3439,11 @@ PrintLetterDelay:: jr z, .waitOneFrame ld a, [wOptions] and $f - ld [H_FRAMECOUNTER], a + ld [hFrameCounter], a jr .checkButtons .waitOneFrame ld a, 1 - ld [H_FRAMECOUNTER], a + ld [hFrameCounter], a .checkButtons call Joypad ld a, [hJoyHeld] @@ -3458,7 +3458,7 @@ PrintLetterDelay:: call DelayFrame jr .done .buttonsNotPressed ; if neither A nor B is pressed - ld a, [H_FRAMECOUNTER] + ld a, [hFrameCounter] and a jr nz, .checkButtons .done @@ -3505,10 +3505,10 @@ CalcStats:: .statsLoop inc c call CalcStat - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] ld [de], a inc de - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] ld [de], a inc de ld a, c @@ -3541,14 +3541,14 @@ CalcStat:: add hl, bc ; skip to corresponding stat exp value .statExpLoop ; calculates ceil(Sqrt(stat exp)) in b xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND+1], a + ld [hMultiplicand], a + ld [hMultiplicand+1], a inc b ; increment current stat exp bonus ld a, b cp $ff jr z, .statExpDone - ld [H_MULTIPLICAND+2], a - ld [H_MULTIPLIER], a + ld [hMultiplicand+2], a + ld [hMultiplier], a call Multiply ld a, [hld] ld d, a @@ -3636,22 +3636,22 @@ CalcStat:: jr nc, .noCarry2 inc d ; de = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4 .noCarry2 - ld [H_MULTIPLICAND+2], a + ld [hMultiplicand+2], a ld a, d - ld [H_MULTIPLICAND+1], a + ld [hMultiplicand+1], a xor a - ld [H_MULTIPLICAND], a + ld [hMultiplicand], a ld a, [wCurEnemyLVL] - ld [H_MULTIPLIER], a + ld [hMultiplier], a call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level - ld a, [H_MULTIPLICAND] - ld [H_DIVIDEND], a - ld a, [H_MULTIPLICAND+1] - ld [H_DIVIDEND+1], a - ld a, [H_MULTIPLICAND+2] - ld [H_DIVIDEND+2], a + ld a, [hMultiplicand] + ld [hDividend], a + ld a, [hMultiplicand+1] + ld [hDividend+1], a + ld a, [hMultiplicand+2] + ld [hDividend+2], a ld a, $64 - ld [H_DIVISOR], a + ld [hDivisor], a ld a, $3 ld b, a call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 @@ -3661,38 +3661,38 @@ CalcStat:: jr nz, .notHPStat ld a, [wCurEnemyLVL] ld b, a - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] add b - ld [H_MULTIPLICAND+2], a + ld [hMultiplicand+2], a jr nc, .noCarry3 - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] inc a - ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level .noCarry3 ld a, 10 ; +10 for HP stat .notHPStat ld b, a - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] add b - ld [H_MULTIPLICAND+2], a + ld [hMultiplicand+2], a jr nc, .noCarry4 - ld a, [H_MULTIPLICAND+1] + ld a, [hMultiplicand+1] inc a ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5 - ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 .noCarry4 - ld a, [H_MULTIPLICAND+1] ; check for overflow (>999) + ld a, [hMultiplicand+1] ; check for overflow (>999) cp 999 / $100 + 1 jr nc, .overflow cp 999 / $100 jr c, .noOverflow - ld a, [H_MULTIPLICAND+2] + ld a, [hMultiplicand+2] cp 999 % $100 + 1 jr c, .noOverflow .overflow ld a, 999 / $100 ; overflow: cap at 999 - ld [H_MULTIPLICAND+1], a + ld [hMultiplicand+1], a ld a, 999 % $100 - ld [H_MULTIPLICAND+2], a + ld [hMultiplicand+2], a .noOverflow pop bc pop de @@ -3700,28 +3700,28 @@ CalcStat:: ret AddEnemyMonToPlayerParty:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(_AddEnemyMonToPlayerParty) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call _AddEnemyMonToPlayerParty pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret MoveMon:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(_MoveMon) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call _MoveMon pop bc ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -3801,14 +3801,14 @@ HandleMenuInput:: ld [wPartyMenuAnimMonEnabled], a HandleMenuInput_:: - ld a, [H_DOWNARROWBLINKCNT1] + ld a, [hDownArrowBlinkCount1] push af - ld a, [H_DOWNARROWBLINKCNT2] + ld a, [hDownArrowBlinkCount2] push af ; save existing values on stack xor a - ld [H_DOWNARROWBLINKCNT1], a ; blinking down arrow timing value 1 + ld [hDownArrowBlinkCount1], a ; blinking down arrow timing value 1 ld a, 6 - ld [H_DOWNARROWBLINKCNT2], a ; blinking down arrow timing value 2 + ld [hDownArrowBlinkCount2], a ; blinking down arrow timing value 2 .loop1 xor a ld [wAnimCounter], a ; counter for pokemon shaking animation @@ -3837,9 +3837,9 @@ HandleMenuInput_:: .giveUpWaiting ; if a key wasn't pressed within the specified number of checks pop af - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a pop af - ld [H_DOWNARROWBLINKCNT1], a ; restore previous values + ld [hDownArrowBlinkCount1], a ; restore previous values xor a ld [wMenuWrappingEnabled], a ; disable menu wrapping ret @@ -3901,9 +3901,9 @@ HandleMenuInput_:: call PlaySound .skipPlayingSound pop af - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a pop af - ld [H_DOWNARROWBLINKCNT1], a ; restore previous values + ld [hDownArrowBlinkCount1], a ; restore previous values xor a ld [wMenuWrappingEnabled], a ; disable menu wrapping ld a, [hJoy5] @@ -3934,7 +3934,7 @@ PlaceMenuCursor:: and a ; was the previous menu id 0? jr z, .checkForArrow1 push af - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] bit 1, a ; is the menu double spaced? jr z, .doubleSpaced1 ld bc, 20 @@ -3960,7 +3960,7 @@ PlaceMenuCursor:: and a jr z, .checkForArrow2 push af - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] bit 1, a ; is the menu double spaced? jr z, .doubleSpaced2 ld bc, 20 @@ -4014,7 +4014,7 @@ EraseMenuCursor:: ; This toggles a blinking down arrow at hl on and off after a delay has passed. ; This is often called even when no blinking is occurring. -; The reason is that most functions that call this initialize H_DOWNARROWBLINKCNT1 to 0. +; The reason is that most functions that call this initialize hDownArrowBlinkCount1 to 0. ; The effect is that if the tile at hl is initialized with a down arrow, ; this function will toggle that down arrow on and off, but if the tile isn't ; initialized with a down arrow, this function does nothing. @@ -4027,36 +4027,36 @@ HandleDownArrowBlinkTiming:: cp b jr nz, .downArrowOff .downArrowOn - ld a, [H_DOWNARROWBLINKCNT1] + ld a, [hDownArrowBlinkCount1] dec a - ld [H_DOWNARROWBLINKCNT1], a + ld [hDownArrowBlinkCount1], a ret nz - ld a, [H_DOWNARROWBLINKCNT2] + ld a, [hDownArrowBlinkCount2] dec a - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a ret nz ld a, " " ld [hl], a ld a, $ff - ld [H_DOWNARROWBLINKCNT1], a + ld [hDownArrowBlinkCount1], a ld a, $06 - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a ret .downArrowOff - ld a, [H_DOWNARROWBLINKCNT1] + ld a, [hDownArrowBlinkCount1] and a ret z dec a - ld [H_DOWNARROWBLINKCNT1], a + ld [hDownArrowBlinkCount1], a ret nz dec a - ld [H_DOWNARROWBLINKCNT1], a - ld a, [H_DOWNARROWBLINKCNT2] + ld [hDownArrowBlinkCount1], a + ld a, [hDownArrowBlinkCount2] dec a - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a ret nz ld a, $06 - ld [H_DOWNARROWBLINKCNT2], a + ld [hDownArrowBlinkCount2], a ld a, "▼" ld [hl], a ret @@ -4100,9 +4100,9 @@ PrintNumber:: ; in bits 7 and 6 of b respectively. push bc xor a - ld [H_PASTLEADINGZEROES], a - ld [H_NUMTOPRINT], a - ld [H_NUMTOPRINT + 1], a + ld [hPastLeadingZeros], a + ld [hNumToPrint], a + ld [hNumToPrint + 1], a ld a, b and $f cp 1 @@ -4111,26 +4111,26 @@ PrintNumber:: jr z, .word .long ld a, [de] - ld [H_NUMTOPRINT], a + ld [hNumToPrint], a inc de ld a, [de] - ld [H_NUMTOPRINT + 1], a + ld [hNumToPrint + 1], a inc de ld a, [de] - ld [H_NUMTOPRINT + 2], a + ld [hNumToPrint + 2], a jr .start .word ld a, [de] - ld [H_NUMTOPRINT + 1], a + ld [hNumToPrint + 1], a inc de ld a, [de] - ld [H_NUMTOPRINT + 2], a + ld [hNumToPrint + 2], a jr .start .byte ld a, [de] - ld [H_NUMTOPRINT + 2], a + ld [hNumToPrint + 2], a .start push de @@ -4159,16 +4159,16 @@ if (\1) / $10000 ld a, \1 / $10000 % $100 else xor a endc - ld [H_POWEROFTEN + 0], a + ld [hPowerOf10 + 0], a if (\1) / $100 ld a, \1 / $100 % $100 else xor a endc - ld [H_POWEROFTEN + 1], a + ld [hPowerOf10 + 1], a ld a, \1 / $1 % $100 - ld [H_POWEROFTEN + 2], a + ld [hPowerOf10 + 2], a call .PrintDigit call .NextDigit @@ -4182,7 +4182,7 @@ endm .tens ld c, 0 - ld a, [H_NUMTOPRINT + 2] + ld a, [hNumToPrint + 2] .mod cp 10 jr c, .ok @@ -4192,9 +4192,9 @@ endm .ok ld b, a - ld a, [H_PASTLEADINGZEROES] + ld a, [hPastLeadingZeros] or c - ld [H_PASTLEADINGZEROES], a + ld [hPastLeadingZeros], a jr nz, .past call .PrintLeadingZero jr .next @@ -4219,74 +4219,74 @@ endm ; Print the quotient, and keep the modulus. ld c, 0 .loop - ld a, [H_POWEROFTEN] + ld a, [hPowerOf10] ld b, a - ld a, [H_NUMTOPRINT] - ld [H_SAVEDNUMTOPRINT], a + ld a, [hNumToPrint] + ld [hSavedNumToPrint], a cp b jr c, .underflow0 sub b - ld [H_NUMTOPRINT], a - ld a, [H_POWEROFTEN + 1] + ld [hNumToPrint], a + ld a, [hPowerOf10 + 1] ld b, a - ld a, [H_NUMTOPRINT + 1] - ld [H_SAVEDNUMTOPRINT + 1], a + ld a, [hNumToPrint + 1] + ld [hSavedNumToPrint + 1], a cp b jr nc, .noborrow1 - ld a, [H_NUMTOPRINT] + ld a, [hNumToPrint] or 0 jr z, .underflow1 dec a - ld [H_NUMTOPRINT], a - ld a, [H_NUMTOPRINT + 1] + ld [hNumToPrint], a + ld a, [hNumToPrint + 1] .noborrow1 sub b - ld [H_NUMTOPRINT + 1], a - ld a, [H_POWEROFTEN + 2] + ld [hNumToPrint + 1], a + ld a, [hPowerOf10 + 2] ld b, a - ld a, [H_NUMTOPRINT + 2] - ld [H_SAVEDNUMTOPRINT + 2], a + ld a, [hNumToPrint + 2] + ld [hSavedNumToPrint + 2], a cp b jr nc, .noborrow2 - ld a, [H_NUMTOPRINT + 1] + ld a, [hNumToPrint + 1] and a jr nz, .borrowed - ld a, [H_NUMTOPRINT] + ld a, [hNumToPrint] and a jr z, .underflow2 dec a - ld [H_NUMTOPRINT], a + ld [hNumToPrint], a xor a .borrowed dec a - ld [H_NUMTOPRINT + 1], a - ld a, [H_NUMTOPRINT + 2] + ld [hNumToPrint + 1], a + ld a, [hNumToPrint + 2] .noborrow2 sub b - ld [H_NUMTOPRINT + 2], a + ld [hNumToPrint + 2], a inc c jr .loop .underflow2 - ld a, [H_SAVEDNUMTOPRINT + 1] - ld [H_NUMTOPRINT + 1], a + ld a, [hSavedNumToPrint + 1] + ld [hNumToPrint + 1], a .underflow1 - ld a, [H_SAVEDNUMTOPRINT] - ld [H_NUMTOPRINT], a + ld a, [hSavedNumToPrint] + ld [hNumToPrint], a .underflow0 - ld a, [H_PASTLEADINGZEROES] + ld a, [hPastLeadingZeros] or c jr z, .PrintLeadingZero ld a, "0" add c ld [hl], a - ld [H_PASTLEADINGZEROES], a + ld [hPastLeadingZeros], a ret .PrintLeadingZero: @@ -4303,7 +4303,7 @@ endm jr nz, .inc bit BIT_LEFT_ALIGN, d jr z, .inc - ld a, [H_PASTLEADINGZEROES] + ld a, [hPastLeadingZeros] and a ret z .inc @@ -4491,7 +4491,7 @@ UpdateCinnabarGymGateTileBlocks:: jpba UpdateCinnabarGymGateTileBlocks_ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [hJoyHeld] bit 0, a ; A button @@ -4499,14 +4499,14 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ; A button is pressed ld a, Bank(CheckForHiddenObject) ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a call CheckForHiddenObject ld a, [$ffee] and a jr nz, .hiddenObjectNotFound ld a, [wHiddenObjectFunctionRomBank] ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld de, .returnAddress push de jp hl @@ -4524,7 +4524,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ld [$ffeb], a pop af ld [MBC1RomBank], a - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ret PrintPredefTextID:: diff --git a/home/audio.asm b/home/audio.asm index 242f038b..04f0276d 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -170,10 +170,10 @@ PlaySound:: .noFadeOut xor a ld [wNewSoundID], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [hSavedROMBank], a ld a, [wAudioROMBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a cp BANK(Audio1_PlaySound) jr nz, .checkForAudio2 @@ -198,7 +198,7 @@ PlaySound:: .next2 ld a, [hSavedROMBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a jr .done diff --git a/home/copy.asm b/home/copy.asm index be9c8c0c..910f508b 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -1,14 +1,14 @@ FarCopyData:: ; Copy bc bytes from a:hl to de. ld [wBuffer], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wBuffer] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call CopyData pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret diff --git a/home/copy2.asm b/home/copy2.asm index d4f35668..521223b6 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -2,24 +2,24 @@ FarCopyData2:: ; Identical to FarCopyData, but uses hROMBankTemp ; as temp space instead of wBuffer. ld [hROMBankTemp], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call CopyData pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret FarCopyData3:: ; Copy bc bytes from a:de to hl. ld [hROMBankTemp], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a push hl push de @@ -31,7 +31,7 @@ FarCopyData3:: pop de pop hl pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -39,10 +39,10 @@ FarCopyDataDouble:: ; Expand bc bytes of 1bpp image data ; from a:hl to 2bpp data at de. ld [hROMBankTemp], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a .loop ld a, [hli] @@ -55,7 +55,7 @@ FarCopyDataDouble:: or b jr nz, .loop pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -64,27 +64,27 @@ CopyVideoData:: ; tiles from b:de to hl, 8 tiles at a time. ; This takes c/8 frames. - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] push af xor a ; disable auto-transfer while copying - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [hROMBankTemp], a ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, e - ld [H_VBCOPYSRC], a + ld [hVBlankCopySource], a ld a, d - ld [H_VBCOPYSRC + 1], a + ld [hVBlankCopySource + 1], a ld a, l - ld [H_VBCOPYDEST], a + ld [hVBlankCopyDest], a ld a, h - ld [H_VBCOPYDEST + 1], a + ld [hVBlankCopyDest + 1], a .loop ld a, c @@ -92,18 +92,18 @@ CopyVideoData:: jr nc, .keepgoing .done - ld [H_VBCOPYSIZE], a + ld [hVBlankCopySize], a call DelayFrame ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop af - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret .keepgoing ld a, 8 - ld [H_VBCOPYSIZE], a + ld [hVBlankCopySize], a call DelayFrame ld a, c sub 8 @@ -114,26 +114,26 @@ CopyVideoDataDouble:: ; Wait for the next VBlank, then copy c 1bpp ; tiles from b:de to hl, 8 tiles at a time. ; This takes c/8 frames. - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] push af xor a ; disable auto-transfer while copying - ld [H_AUTOBGTRANSFERENABLED], a - ld a, [H_LOADEDROMBANK] + ld [hAutoBGTransferEnabled], a + ld a, [hLoadedROMBank] ld [hROMBankTemp], a ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, e - ld [H_VBCOPYDOUBLESRC], a + ld [hVBlankCopyDoubleSource], a ld a, d - ld [H_VBCOPYDOUBLESRC + 1], a + ld [hVBlankCopyDoubleSource + 1], a ld a, l - ld [H_VBCOPYDOUBLEDEST], a + ld [hVBlankCopyDoubleDest], a ld a, h - ld [H_VBCOPYDOUBLEDEST + 1], a + ld [hVBlankCopyDoubleDest + 1], a .loop ld a, c @@ -141,18 +141,18 @@ CopyVideoDataDouble:: jr nc, .keepgoing .done - ld [H_VBCOPYDOUBLESIZE], a + ld [hVBlankCopyDoubleSize], a call DelayFrame ld a, [hROMBankTemp] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop af - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret .keepgoing ld a, 8 - ld [H_VBCOPYDOUBLESIZE], a + ld [hVBlankCopyDoubleSize], a call DelayFrame ld a, c sub 8 @@ -200,16 +200,16 @@ CopyScreenTileBufferToVRAM:: .setup ld a, d - ld [H_VBCOPYBGSRC+1], a + ld [hVBlankCopyBGSource+1], a call GetRowColAddressBgMap ld a, l - ld [H_VBCOPYBGDEST], a + ld [hVBlankCopyBGDest], a ld a, h - ld [H_VBCOPYBGDEST+1], a + ld [hVBlankCopyBGDest+1], a ld a, c - ld [H_VBCOPYBGNUMROWS], a + ld [hVBlankCopyBGNumRows], a ld a, e - ld [H_VBCOPYBGSRC], a + ld [hVBlankCopyBGSource], a ret ClearScreen:: diff --git a/home/init.asm b/home/init.asm index 9e3e2c82..efc886e0 100644 --- a/home/init.asm +++ b/home/init.asm @@ -60,7 +60,7 @@ rLCDC_DEFAULT EQU %11100011 call ClearSprites ld a, Bank(WriteDMACodeToHRAM) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call WriteDMACodeToHRAM @@ -101,9 +101,9 @@ rLCDC_DEFAULT EQU %11100011 ld [wAudioROMBank], a ld [wAudioSavedROMBank], a ld a, $9c - ld [H_AUTOBGTRANSFERDEST + 1], a + ld [hAutoBGTransferDest + 1], a xor a - ld [H_AUTOBGTRANSFERDEST], a + ld [hAutoBGTransferDest], a dec a ld [wUpdateSpritesEnabled], a diff --git a/home/overworld.asm b/home/overworld.asm index cc8c498c..9fb269dc 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -763,7 +763,7 @@ HandleBlackOut:: ld hl, wd72e res 5, [hl] ld a, Bank(ResetStatusAndHalveMoneyOnBlackout) ; also Bank(SpecialWarpIn) and Bank(SpecialEnterMap) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call ResetStatusAndHalveMoneyOnBlackout call SpecialWarpIn @@ -794,7 +794,7 @@ HandleFlyWarpOrDungeonWarp:: res 5, [hl] ; forced to ride bike call LeaveMapAnim ld a, Bank(SpecialWarpIn) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call SpecialWarpIn jp SpecialEnterMap @@ -1372,10 +1372,10 @@ TilePairCollisionsWater:: ; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character LoadCurrentMapView:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [wTilesetBank] ; tile data ROM bank - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ; switch to ROM bank that contains tile data ld a, [wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view ld e, a @@ -1457,7 +1457,7 @@ LoadCurrentMapView:: dec b jr nz, .rowLoop2 pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ; restore previous ROM bank ret @@ -2291,10 +2291,10 @@ LoadMapHeader:: ld a, [wCurMap] ld c, a ld b, $00 - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(MapSongBanks) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld hl, MapSongBanks add hl, bc @@ -2304,7 +2304,7 @@ LoadMapHeader:: ld a, [hl] ld [wMapMusicROMBank], a ; music 2 pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2322,7 +2322,7 @@ CopyMapConnectionHeader:: ; function to load map data LoadMapData:: - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af call DisableLCD ld a, $98 @@ -2377,7 +2377,7 @@ LoadMapData:: call PlayDefaultMusicFadeOutCurrent .restoreRomBank pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret @@ -2396,7 +2396,7 @@ SwitchToMapRomBank:: ld [$ffe8], a ; save map ROM bank call BankswitchBack ld a, [$ffe8] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ; switch to map ROM bank pop bc pop hl diff --git a/home/pic.asm b/home/pic.asm index a1c18e8a..cfc39f0f 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -2,10 +2,10 @@ ; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr UncompressSpriteData:: ld b, a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, b - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, SRAM_ENABLE ld [MBC1SRamEnable], a @@ -13,7 +13,7 @@ UncompressSpriteData:: ld [MBC1SRamBank], a call _UncompressSpriteData pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret diff --git a/home/predef.asm b/home/predef.asm index 9bb9be74..4f0c37d9 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -8,18 +8,18 @@ Predef:: ; A hack for LoadDestinationWarpPosition. ; See LoadTilesetHeader (predef $19). - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wPredefParentBank], a push af ld a, BANK(GetPredefPointer) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call GetPredefPointer ld a, [wPredefBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld de, .done @@ -28,7 +28,7 @@ Predef:: .done pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ret diff --git a/home/start_menu.asm b/home/start_menu.asm index eb4b4f2d..38333644 100755 --- a/home/start_menu.asm +++ b/home/start_menu.asm @@ -1,6 +1,6 @@ DisplayStartMenu:: ld a, BANK(StartMenu_Pokedex) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ld a, [wWalkBikeSurfState] ; walking/biking/surfing ld [wWalkBikeSurfStateCopy], a diff --git a/home/text.asm b/home/text.asm index 9db81530..89c93dd0 100644 --- a/home/text.asm +++ b/home/text.asm @@ -62,7 +62,7 @@ Char4ETest:: cp $4E ; next jr nz, .char4FTest ld bc, 2 * SCREEN_WIDTH - ld a, [hFlags_0xFFF6] + ld a, [hFlagsFFF6] bit 2, a jr z, .ok ld bc, SCREEN_WIDTH @@ -180,7 +180,7 @@ Char59:: ; or ; player active monster’s name ; (like Char5A but flipped) - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] xor 1 jr MonsterNameCharsCommon @@ -189,7 +189,7 @@ Char5A:: ; player active monster’s name ; or ; enemy active monster’s name, prefixed with “Enemy ” - ld a, [H_WHOSETURN] + ld a, [hWhoseTurn] MonsterNameCharsCommon:: push de and a @@ -675,14 +675,14 @@ TextCommand0D:: ; BB = bank TextCommand17:: pop hl - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, [hli] ld e, a ld a, [hli] ld d, a ld a, [hli] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a push hl ld l, e @@ -690,7 +690,7 @@ TextCommand17:: call TextCommandProcessor pop hl pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a jp NextTextCommand diff --git a/home/vblank.asm b/home/vblank.asm index e80fba75..e8232ea3 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -5,7 +5,7 @@ VBlank:: push de push hl - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wVBlankSavedROMBank], a ld a, [hSCX] @@ -28,7 +28,7 @@ VBlank:: call UpdateMovingBgTiles call $ff80 ; hOAMDMA ld a, BANK(PrepareOAMData) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call PrepareOAMData @@ -36,24 +36,24 @@ VBlank:: call Random - ld a, [H_VBLANKOCCURRED] + ld a, [hVBlankOccurred] and a jr z, .skipZeroing xor a - ld [H_VBLANKOCCURRED], a + ld [hVBlankOccurred], a .skipZeroing - ld a, [H_FRAMECOUNTER] + ld a, [hFrameCounter] and a jr z, .skipDec dec a - ld [H_FRAMECOUNTER], a + ld [hFrameCounter], a .skipDec call FadeOutAudio ld a, [wAudioROMBank] ; music ROM bank - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a cp BANK(Audio1_UpdateMusic) @@ -79,7 +79,7 @@ VBlank:: call z, ReadJoypad ld a, [wVBlankSavedROMBank] - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a pop hl @@ -96,10 +96,10 @@ DelayFrame:: NOT_VBLANKED EQU 1 ld a, NOT_VBLANKED - ld [H_VBLANKOCCURRED], a + ld [hVBlankOccurred], a .halt halt - ld a, [H_VBLANKOCCURRED] + ld a, [hVBlankOccurred] and a jr nz, .halt ret diff --git a/home/vcopy.asm b/home/vcopy.asm index 3f49ad3e..a6213b32 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -120,15 +120,15 @@ RedrawRowOrColumn:: ; the above function, RedrawRowOrColumn, is used when walking to ; improve efficiency. AutoBgMapTransfer:: - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] and a ret z ld hl, sp + 0 ld a, h - ld [H_SPTEMP], a + ld [hSPTemp], a ld a, l - ld [H_SPTEMP + 1], a ; save stack pinter - ld a, [H_AUTOBGTRANSFERPORTION] + ld [hSPTemp + 1], a ; save stack pinter + ld a, [hAutoBGTransferPortion] and a jr z, .transferTopThird dec a @@ -136,9 +136,9 @@ AutoBgMapTransfer:: .transferBottomThird coord hl, 0, 12 ld sp, hl - ld a, [H_AUTOBGTRANSFERDEST + 1] + ld a, [hAutoBGTransferDest + 1] ld h, a - ld a, [H_AUTOBGTRANSFERDEST] + ld a, [hAutoBGTransferDest] ld l, a ld de, (12 * 32) add hl, de @@ -147,24 +147,24 @@ AutoBgMapTransfer:: .transferTopThird coord hl, 0, 0 ld sp, hl - ld a, [H_AUTOBGTRANSFERDEST + 1] + ld a, [hAutoBGTransferDest + 1] ld h, a - ld a, [H_AUTOBGTRANSFERDEST] + ld a, [hAutoBGTransferDest] ld l, a ld a, TRANSFERMIDDLE jr .doTransfer .transferMiddleThird coord hl, 0, 6 ld sp, hl - ld a, [H_AUTOBGTRANSFERDEST + 1] + ld a, [hAutoBGTransferDest + 1] ld h, a - ld a, [H_AUTOBGTRANSFERDEST] + ld a, [hAutoBGTransferDest] ld l, a ld de, (6 * 32) add hl, de ld a, TRANSFERBOTTOM .doTransfer - ld [H_AUTOBGTRANSFERPORTION], a ; store next portion + ld [hAutoBGTransferPortion], a ; store next portion ld b, 6 TransferBgRows:: @@ -192,73 +192,73 @@ TransferBgRows:: dec b jr nz, TransferBgRows - ld a, [H_SPTEMP] + ld a, [hSPTemp] ld h, a - ld a, [H_SPTEMP + 1] + ld a, [hSPTemp + 1] ld l, a ld sp, hl ret -; Copies [H_VBCOPYBGNUMROWS] rows from H_VBCOPYBGSRC to H_VBCOPYBGDEST. -; If H_VBCOPYBGSRC is XX00, the transfer is disabled. +; Copies [hVBlankCopyBGNumRows] rows from hVBlankCopyBGSource to hVBlankCopyBGDest. +; If hVBlankCopyBGSource is XX00, the transfer is disabled. VBlankCopyBgMap:: - ld a, [H_VBCOPYBGSRC] ; doubles as enabling byte + ld a, [hVBlankCopyBGSource] ; doubles as enabling byte and a ret z ld hl, sp + 0 ld a, h - ld [H_SPTEMP], a + ld [hSPTemp], a ld a, l - ld [H_SPTEMP + 1], a ; save stack pointer - ld a, [H_VBCOPYBGSRC] + ld [hSPTemp + 1], a ; save stack pointer + ld a, [hVBlankCopyBGSource] ld l, a - ld a, [H_VBCOPYBGSRC + 1] + ld a, [hVBlankCopyBGSource + 1] ld h, a ld sp, hl - ld a, [H_VBCOPYBGDEST] + ld a, [hVBlankCopyBGDest] ld l, a - ld a, [H_VBCOPYBGDEST + 1] + ld a, [hVBlankCopyBGDest + 1] ld h, a - ld a, [H_VBCOPYBGNUMROWS] + ld a, [hVBlankCopyBGNumRows] ld b, a xor a - ld [H_VBCOPYBGSRC], a ; disable transfer so it doesn't continue next V-blank + ld [hVBlankCopyBGSource], a ; disable transfer so it doesn't continue next V-blank jr TransferBgRows VBlankCopyDouble:: -; Copy [H_VBCOPYDOUBLESIZE] 1bpp tiles -; from H_VBCOPYDOUBLESRC to H_VBCOPYDOUBLEDEST. +; Copy [hVBlankCopyDoubleSize] 1bpp tiles +; from hVBlankCopyDoubleSource to hVBlankCopyDoubleDest. ; While we're here, convert to 2bpp. ; The process is straightforward: ; copy each byte twice. - ld a, [H_VBCOPYDOUBLESIZE] + ld a, [hVBlankCopyDoubleSize] and a ret z ld hl, sp + 0 ld a, h - ld [H_SPTEMP], a + ld [hSPTemp], a ld a, l - ld [H_SPTEMP + 1], a + ld [hSPTemp + 1], a - ld a, [H_VBCOPYDOUBLESRC] + ld a, [hVBlankCopyDoubleSource] ld l, a - ld a, [H_VBCOPYDOUBLESRC + 1] + ld a, [hVBlankCopyDoubleSource + 1] ld h, a ld sp, hl - ld a, [H_VBCOPYDOUBLEDEST] + ld a, [hVBlankCopyDoubleDest] ld l, a - ld a, [H_VBCOPYDOUBLEDEST + 1] + ld a, [hVBlankCopyDoubleDest + 1] ld h, a - ld a, [H_VBCOPYDOUBLESIZE] + ld a, [hVBlankCopyDoubleSize] ld b, a xor a ; transferred - ld [H_VBCOPYDOUBLESIZE], a + ld [hVBlankCopyDoubleSize], a .loop rept 3 @@ -286,19 +286,19 @@ VBlankCopyDouble:: jr nz, .loop ld a, l - ld [H_VBCOPYDOUBLEDEST], a + ld [hVBlankCopyDoubleDest], a ld a, h - ld [H_VBCOPYDOUBLEDEST + 1], a + ld [hVBlankCopyDoubleDest + 1], a ld hl, sp + 0 ld a, l - ld [H_VBCOPYDOUBLESRC], a + ld [hVBlankCopyDoubleSource], a ld a, h - ld [H_VBCOPYDOUBLESRC + 1], a + ld [hVBlankCopyDoubleSource + 1], a - ld a, [H_SPTEMP] + ld a, [hSPTemp] ld h, a - ld a, [H_SPTEMP + 1] + ld a, [hSPTemp + 1] ld l, a ld sp, hl @@ -306,37 +306,37 @@ VBlankCopyDouble:: VBlankCopy:: -; Copy [H_VBCOPYSIZE] 2bpp tiles (or 16 * [H_VBCOPYSIZE] tile map entries) -; from H_VBCOPYSRC to H_VBCOPYDEST. +; Copy [hVBlankCopySize] 2bpp tiles (or 16 * [hVBlankCopySize] tile map entries) +; from hVBlankCopySource to hVBlankCopyDest. ; Source and destination addresses are updated, ; so transfer can continue in subsequent calls. - ld a, [H_VBCOPYSIZE] + ld a, [hVBlankCopySize] and a ret z ld hl, sp + 0 ld a, h - ld [H_SPTEMP], a + ld [hSPTemp], a ld a, l - ld [H_SPTEMP + 1], a + ld [hSPTemp + 1], a - ld a, [H_VBCOPYSRC] + ld a, [hVBlankCopySource] ld l, a - ld a, [H_VBCOPYSRC + 1] + ld a, [hVBlankCopySource + 1] ld h, a ld sp, hl - ld a, [H_VBCOPYDEST] + ld a, [hVBlankCopyDest] ld l, a - ld a, [H_VBCOPYDEST + 1] + ld a, [hVBlankCopyDest + 1] ld h, a - ld a, [H_VBCOPYSIZE] + ld a, [hVBlankCopySize] ld b, a xor a ; transferred - ld [H_VBCOPYSIZE], a + ld [hVBlankCopySize], a .loop rept 7 @@ -356,19 +356,19 @@ VBlankCopy:: jr nz, .loop ld a, l - ld [H_VBCOPYDEST], a + ld [hVBlankCopyDest], a ld a, h - ld [H_VBCOPYDEST + 1], a + ld [hVBlankCopyDest + 1], a ld hl, sp + 0 ld a, l - ld [H_VBCOPYSRC], a + ld [hVBlankCopySource], a ld a, h - ld [H_VBCOPYSRC + 1], a + ld [hVBlankCopySource + 1], a - ld a, [H_SPTEMP] + ld a, [hSPTemp] ld h, a - ld a, [H_SPTEMP + 1] + ld a, [hSPTemp + 1] ld l, a ld sp, hl diff --git a/hram.asm b/hram.asm index 4beca9c4..69abb717 100644 --- a/hram.asm +++ b/hram.asm @@ -26,17 +26,17 @@ hSlideAmount EQU $FF8B hRLEByteValue EQU $FF8B -H_SPRITEWIDTH EQU $FF8B ; in tiles -H_SPRITEINTERLACECOUNTER EQU $FF8B -H_SPRITEHEIGHT EQU $FF8C ; in tiles -H_SPRITEOFFSET EQU $FF8D +hSpriteWidth EQU $FF8B ; in tiles +hSpriteInterlaceCounter EQU $FF8B +hSpriteHeight EQU $FF8C ; in tiles +hSpriteOffset EQU $FF8D ; counters for blinking down arrow -H_DOWNARROWBLINKCNT1 EQU $FF8B -H_DOWNARROWBLINKCNT2 EQU $FF8C +hDownArrowBlinkCount1 EQU $FF8B +hDownArrowBlinkCount2 EQU $FF8C -H_SPRITEDATAOFFSET EQU $FF8B -H_SPRITEINDEX EQU $FF8C +hSpriteDataOffset EQU $FF8B +hSpriteIndex EQU $FF8C hMapStride EQU $FF8B hMapWidth EQU $FF8C @@ -101,24 +101,24 @@ hExperience EQU $FF96 ; 3 bytes, big endian ; Multiplication and division variables are meant ; to overlap for back-to-back usage. Big endian. -H_MULTIPLICAND EQU $FF96 ; 3 bytes -H_MULTIPLIER EQU $FF99 ; 1 byte -H_PRODUCT EQU $FF95 ; 4 bytes +hMultiplicand EQU $FF96 ; 3 bytes +hMultiplier EQU $FF99 ; 1 byte +hProduct EQU $FF95 ; 4 bytes -H_DIVIDEND EQU $FF95 ; 4 bytes -H_DIVISOR EQU $FF99 ; 1 byte -H_QUOTIENT EQU $FF95 ; 4 bytes -H_REMAINDER EQU $FF99 ; 1 byte +hDividend EQU $FF95 ; 4 bytes +hDivisor EQU $FF99 ; 1 byte +hQuotient EQU $FF95 ; 4 bytes +hRemainder EQU $FF99 ; 1 byte -H_DIVIDEBUFFER EQU $FF9A +hDivideBuffer EQU $FF9A -H_MULTIPLYBUFFER EQU $FF9B +hMultiplyBuffer EQU $FF9B ; PrintNumber (big endian). -H_PASTLEADINGZEROES EQU $FF95 ; last char printed -H_NUMTOPRINT EQU $FF96 ; 3 bytes -H_POWEROFTEN EQU $FF99 ; 3 bytes -H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes +hPastLeadingZeros EQU $FF95 ; last char printed +hNumToPrint EQU $FF96 ; 3 bytes +hPowerOf10 EQU $FF99 ; 3 bytes +hSavedNumToPrint EQU $FF9C ; 3 bytes ; distance in steps between NPC and player hNPCPlayerYDistance EQU $FF95 @@ -183,14 +183,14 @@ hJoy5 EQU $FFB5 hJoy6 EQU $FFB6 hJoy7 EQU $FFB7 -H_LOADEDROMBANK EQU $FFB8 +hLoadedROMBank EQU $FFB8 hSavedROMBank EQU $FFB9 ; is automatic background transfer during V-blank enabled? ; if nonzero, yes ; if zero, no -H_AUTOBGTRANSFERENABLED EQU $FFBA +hAutoBGTransferEnabled EQU $FFBA TRANSFERTOP EQU 0 TRANSFERMIDDLE EQU 1 @@ -199,45 +199,45 @@ TRANSFERBOTTOM EQU 2 ; 00 = top third of background ; 01 = middle third of background ; 02 = bottom third of background -H_AUTOBGTRANSFERPORTION EQU $FFBB +hAutoBGTransferPortion EQU $FFBB ; the destination address of the automatic background transfer -H_AUTOBGTRANSFERDEST EQU $FFBC ; 2 bytes +hAutoBGTransferDest EQU $FFBC ; 2 bytes ; temporary storage for stack pointer during memory transfers that use pop ; to increase speed -H_SPTEMP EQU $FFBF ; 2 bytes +hSPTemp EQU $FFBF ; 2 bytes ; source address for VBlankCopyBgMap function ; the first byte doubles as the byte that enabled the transfer. ; if it is 0, the transfer is disabled ; if it is not 0, the transfer is enabled ; this means that XX00 is not a valid source address -H_VBCOPYBGSRC EQU $FFC1 ; 2 bytes +hVBlankCopyBGSource EQU $FFC1 ; 2 bytes ; destination address for VBlankCopyBgMap function -H_VBCOPYBGDEST EQU $FFC3 ; 2 bytes +hVBlankCopyBGDest EQU $FFC3 ; 2 bytes ; number of rows for VBlankCopyBgMap to copy -H_VBCOPYBGNUMROWS EQU $FFC5 +hVBlankCopyBGNumRows EQU $FFC5 ; size of VBlankCopy transfer in 16-byte units -H_VBCOPYSIZE EQU $FFC6 +hVBlankCopySize EQU $FFC6 ; source address for VBlankCopy function -H_VBCOPYSRC EQU $FFC7 +hVBlankCopySource EQU $FFC7 ; destination address for VBlankCopy function -H_VBCOPYDEST EQU $FFC9 +hVBlankCopyDest EQU $FFC9 ; size of source data for VBlankCopyDouble in 8-byte units -H_VBCOPYDOUBLESIZE EQU $FFCB +hVBlankCopyDoubleSize EQU $FFCB ; source address for VBlankCopyDouble function -H_VBCOPYDOUBLESRC EQU $FFCC +hVBlankCopyDoubleSource EQU $FFCC ; destination address for VBlankCopyDouble function -H_VBCOPYDOUBLEDEST EQU $FFCE +hVBlankCopyDoubleDest EQU $FFCE ; controls whether a row or column of 2x2 tile blocks is redrawn in V-blank ; 00 = no redraw @@ -253,12 +253,12 @@ hRedrawRowOrColumnDest EQU $FFD1 hRandomAdd EQU $FFD3 hRandomSub EQU $FFD4 -H_FRAMECOUNTER EQU $FFD5 ; decremented every V-blank (used for delays) +hFrameCounter EQU $FFD5 ; decremented every V-blank (used for delays) ; V-blank sets this to 0 each time it runs. ; So, by setting it to a nonzero value and waiting for it to become 0 again, ; you can detect that the V-blank handler has run since then. -H_VBLANKOCCURRED EQU $FFD6 +hVBlankOccurred EQU $FFD6 ; 00 = indoor ; 01 = cave @@ -268,7 +268,7 @@ hTilesetType EQU $FFD7 hMovingBGTilesCounter1 EQU $FFD8 -H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 +hCurrentSpriteOffset EQU $FFDA ; multiple of $10 hItemCounter EQU $FFDB @@ -310,15 +310,14 @@ hCoordsInFrontOfPlayerMatch EQU $FFEA hSpriteAnimFrameCounter EQU $FFEA -H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn +hWhoseTurn EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced -hFlags_0xFFF6 EQU $FFF6 +hFlagsFFF6 EQU $FFF6 hFieldMoveMonMenuTopMenuItemX EQU $FFF7 hDisableJoypadPolling EQU $FFF9 hJoyInput EQU $FFF8 - diff --git a/macros/farcall.asm b/macros/farcall.asm index fc208e3d..885f8c66 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -25,13 +25,13 @@ jpab: MACRO ENDM homecall: MACRO - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] push af ld a, BANK(\1) - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a call \1 pop af - ld [H_LOADEDROMBANK], a + ld [hLoadedROMBank], a ld [MBC1RomBank], a ENDM diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index 74efc960..0c8ca4de 100755 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -23,7 +23,7 @@ BillsHouseScript1: ld de, MovementData_1e7a0 .notDown ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $2 ld [wBillsHouseCurScript], a @@ -80,7 +80,7 @@ BillsHouseScript3: ld c, 8 call DelayFrames ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, MovementData_1e807 call MoveSprite ld a, $4 diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index 50c02196..e2665555 100755 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -170,7 +170,7 @@ CeladonGymText1: ld hl, CeladonGymText_48a63 ld de, CeladonGymText_48a63 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 94ec2496..61dd03f6 100755 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -79,9 +79,9 @@ CeruleanCityScript0: cp $14 jr z, .asm_19535 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, $5 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData2 ld [hl], $19 .asm_19535 @@ -90,7 +90,7 @@ CeruleanCityScript0: predef ShowObject ld de, CeruleanCityMovement1 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $1 ld [wCeruleanCityCurScript], a @@ -114,7 +114,7 @@ CeruleanCityMovement1: CeruleanCityScript_1955d: ld a, 1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a jp SetSpriteFacingDirectionAndDelay ; face object @@ -176,7 +176,7 @@ CeruleanCityScript2: call PlaySound callba Music_RivalAlternateStart ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld a, [wXCoord] cp $14 @@ -187,7 +187,7 @@ CeruleanCityScript2: ld de, CeruleanCityMovement3 .asm_195f3 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $3 ld [wCeruleanCityCurScript], a diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index c4aaf7de..a3a8f18d 100755 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -121,7 +121,7 @@ CeruleanGymText1: ld hl, CeruleanGymText_5c7d8 ld de, CeruleanGymText_5c7d8 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index e3cdc6d2..506dc525 100755 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -101,7 +101,7 @@ GaryScript3: ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld a, $4 ld [wChampionsRoomCurScript], a @@ -113,11 +113,11 @@ GaryScript4: ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld de, OakEntranceAfterVictoryMovement ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, HS_CHAMPIONS_ROOM_OAK ld [wMissableObjectIndex], a @@ -141,12 +141,12 @@ GaryScript5: ld a, PLAYER_DIR_LEFT ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -159,7 +159,7 @@ GaryScript5: GaryScript6: ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_RIGHT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -172,7 +172,7 @@ GaryScript6: GaryScript7: ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -181,7 +181,7 @@ GaryScript7: call GaryScript_760c8 ld de, OakExitGaryRoomMovement ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $8 ld [wChampionsRoomCurScript], a diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index f8be5823..1e92505a 100755 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -50,7 +50,7 @@ CinnabarGymScript0: ld a, [wOpponentAfterWrongAnswer] and a ret z - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a cp $4 jr nz, .asm_757c3 ld a, PLAYER_DIR_DOWN diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index fc691dba..acedbbfe 100755 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -43,7 +43,7 @@ FightingDojoScript1: ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -62,7 +62,7 @@ FightingDojoScript3: ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 15f016af..d0917106 100755 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -161,7 +161,7 @@ FuchsiaGymText1: ld hl, KogaAfterBattleText ld de, KogaAfterBattleText call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 265508e0..57f18ac7 100755 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -60,7 +60,7 @@ CeladonGameCornerScript1: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $b - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld de, MovementData_48c5a ld a, [wYCoord] @@ -75,7 +75,7 @@ CeladonGameCornerScript1: ld de, MovementData_48c63 .asm_48c4d ld a, $b - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $2 ld [wGameCornerCurScript], a @@ -418,7 +418,7 @@ CeladonGameCornerText11: ld hl, CeladonGameCornerText_48ed3 ld de, CeladonGameCornerText_48ed3 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index af424089..14b4f15e 100755 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -79,7 +79,7 @@ HallofFameRoomScript1: ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 863d9d22..3a9ec99f 100755 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -88,7 +88,7 @@ MtMoon3Script3: MtMoon3Script4: ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld hl, CoordsData_49dea call ArePlayerCoordsInArray @@ -102,7 +102,7 @@ MtMoon3Script4: ld de, MovementData_49df8 .asm_49dda ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $5 ld [wMtMoonB2FCurScript], a @@ -222,7 +222,7 @@ MtMoon3Text1: ld hl, MtMoon3Text_49f8a ld de, MtMoon3Text_49f8a call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 79de99ff..a0383246 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -48,7 +48,7 @@ OaksLabScript0: OaksLabScript1: ld a, $8 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, OakEntryMovement call MoveSprite @@ -86,12 +86,12 @@ OaksLabScript3: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -111,7 +111,7 @@ OaksLabScript4: SetEvent EVENT_FOLLOWED_OAK_INTO_LAB SetEvent EVENT_FOLLOWED_OAK_INTO_LAB_2 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -155,12 +155,12 @@ OaksLabScript6: cp $6 ret nz ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -254,9 +254,9 @@ OaksLabScript8: jr nz, .moveBlue push hl ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, $4 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 push hl ld [hl], $4c @@ -281,7 +281,7 @@ OaksLabScript8: .moveBlue ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $9 @@ -295,7 +295,7 @@ OaksLabScript9: ld a, $fc ld [wJoyIgnore], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -324,7 +324,7 @@ OaksLabScript9: ld [wd11e], a call GetMonName ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -344,7 +344,7 @@ OaksLabScript10: cp $6 ret nz ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -368,7 +368,7 @@ OaksLabScript10: predef FindPathToPlayer ld de, wNPCMovementDirections2 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $b @@ -424,7 +424,7 @@ OaksLabScript12: ld [wSpriteIndex], a call SetSpritePosition1 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -443,7 +443,7 @@ OaksLabScript13: call DisplayTextID callba Music_RivalAlternateStart ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, .RivalExitMovement call MoveSprite ld a, [wXCoord] @@ -530,7 +530,7 @@ OaksLabScript15: call FillMemory ld [hl], $ff ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, wNPCMovementDirections2 call MoveSprite @@ -540,12 +540,12 @@ OaksLabScript15: OaksLabScript_1cefd: ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, $8 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN ld [hSpriteFacingDirection], a jp SetSpriteFacingDirectionAndDelay @@ -588,7 +588,7 @@ OaksLabScript16: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_RIGHT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -616,7 +616,7 @@ OaksLabScript16: call PlaySound callba Music_RivalAlternateStart ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, wNPCMovementDirections2 call MoveSprite @@ -840,15 +840,15 @@ OaksLabText39: OaksLabScript_1d157: ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, $9 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld [hl], SPRITE_FACING_DOWN ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, $9 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld [hl], SPRITE_FACING_RIGHT ld hl, wd730 @@ -947,9 +947,9 @@ OaksLabReceivedMonText: OaksLabScript_1d22d: ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, $9 - ld [H_SPRITEDATAOFFSET], a + ld [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld [hl], $0 ld hl, OaksLabLastMonText diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 4c6ab015..ff500ca0 100755 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -61,7 +61,7 @@ PalletTownScript1: PalletTownScript2: ld a, 1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -79,7 +79,7 @@ PalletTownScript2: predef FindPathToPlayer ; load Oak’s movement into wNPCMovementDirections2 ld de, wNPCMovementDirections2 ld a, 1 ; oak - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $FF ld [wJoyIgnore], a @@ -111,7 +111,7 @@ PalletTownScript3: ld [wNPCMovementScriptFunctionNum], a ld a, 1 ld [wNPCMovementScriptPointerTableNum], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wNPCMovementScriptBank], a ; trigger the next script diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index 18296675..1b658242 100755 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -44,7 +44,7 @@ PewterCityScript1: and a ret nz ld a, $3 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -69,7 +69,7 @@ PewterCityScript1: ld [wSpriteIndex], a call SetSpritePosition1 ld a, $3 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, MovementData_PewterMuseumGuyExit call MoveSprite ld a, $2 @@ -112,7 +112,7 @@ PewterCityScript4: and a ret nz ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_LEFT ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -137,7 +137,7 @@ PewterCityScript4: ld [wSpriteIndex], a call SetSpritePosition1 ld a, $5 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, MovementData_PewterGymGuyExit call MoveSprite ld a, $5 @@ -220,7 +220,7 @@ PewterCityText3: ld [wNPCMovementScriptFunctionNum], a ld a, $2 ld [wNPCMovementScriptPointerTableNum], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wNPCMovementScriptBank], a ld a, $3 ld [wSpriteIndex], a @@ -284,7 +284,7 @@ PewterCityText5: ld [wNPCMovementScriptFunctionNum], a ld a, $3 ld [wNPCMovementScriptPointerTableNum], a - ld a, [H_LOADEDROMBANK] + ld a, [hLoadedROMBank] ld [wNPCMovementScriptBank], a ld a, $5 ld [wSpriteIndex], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index cf02b141..643fe41c 100755 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -120,7 +120,7 @@ PewterGymText1: ld hl, PewterGymText_5c4bc ld de, PewterGymText_5c4bc call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 94916e37..cc00d938 100755 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -41,7 +41,7 @@ PokemonTower2Script0: .asm_60544 ld [wPlayerMovingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, b ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -74,7 +74,7 @@ PokemonTower2Script1: ld de, MovementData_605a9 .asm_60589 ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index 4b2a1827..fa2ca9bc 100755 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -107,7 +107,7 @@ PokemonTower7Script_60db6: ld d, [hl] ld e, a ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp MoveSprite .asm_60dde inc hl diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index b2ce21f4..71fe7d1c 100755 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -125,7 +125,7 @@ RocketHideout4Text1: ld hl, RocketHideout4Text_4557f ld de, RocketHideout4Text_4557f call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 1fd7e09a..8fde2d42 100755 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -96,7 +96,7 @@ Route22Script0: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call Route22MoveRivalSprite ld a, $1 ld [wRoute22CurScript], a @@ -118,7 +118,7 @@ Route22Script1: .asm_50f7a ld [hSpriteFacingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteFacingDirectionAndDelay xor a ld [wJoyIgnore], a @@ -159,7 +159,7 @@ Route22Script2: .done ld [hSpriteFacingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteFacingDirectionAndDelay ld a, $f0 ld [wJoyIgnore], a @@ -191,7 +191,7 @@ Route22Script_5100d: ld de, Route22RivalExitMovementData2 Route22MoveRival1: ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp MoveSprite Route22RivalExitMovementData1: @@ -250,7 +250,7 @@ Route22Script_5104e: call PlaySound callba Music_RivalAlternateTempo ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call Route22MoveRivalSprite ld a, $4 ld [wRoute22CurScript], a @@ -261,7 +261,7 @@ Route22Script4: bit 0, a ret nz ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, [wcf0d] cp $1 jr nz, .asm_510a1 @@ -305,7 +305,7 @@ Route22Script5: cp $ff jp z, Route22Script_50ece ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, [wcf0d] cp $1 jr nz, .asm_510fb @@ -350,7 +350,7 @@ Route22Script_51142: ld de, MovementData_5114d Route22MoveRival2: ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp MoveSprite MovementData_5114c: diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 2795d1d1..203e9711 100755 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -37,7 +37,7 @@ SSAnne2Script0: predef ShowObject call Delay3 ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF xor a ld [hJoyHeld], a @@ -83,7 +83,7 @@ SSAnne2Script_61416: .asm_61427 ld [hSpriteFacingDirection], a ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp SetSpriteFacingDirectionAndDelay SSAnne2Script1: @@ -132,7 +132,7 @@ SSAnne2Script2: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld a, [wXCoord] cp $25 @@ -143,7 +143,7 @@ SSAnne2Script2: ld de, MovementData_614b7 .asm_6149a ld a, $2 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 0539d613..8842472c 100755 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -171,7 +171,7 @@ SaffronGymText1: ld hl, SaffronGymText_5d167 ld de, SaffronGymText_5d167 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 483082a1..2f9d7924 100755 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -178,7 +178,7 @@ SilphCo11Script0: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $3 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld de, MovementData_62216 call MoveSprite @@ -199,7 +199,7 @@ MovementData_62216: SilphCo11Script_6221a: ld [wPlayerMovingDirection], a ld a, $3 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, b ld [hSpriteFacingDirection], a jp SetSpriteFacingDirectionAndDelay @@ -239,7 +239,7 @@ SilphCo11Script3: bit 0, a ret nz ld a, $3 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld a, [wcf0d] cp $1 @@ -263,7 +263,7 @@ SilphCo11Script4: ld hl, SilphCo10Text_62330 ld de, SilphCo10Text_62330 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index 84a94c92..97dd09ea 100755 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -140,7 +140,7 @@ SilphCo7Script0: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $9 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteMovementBytesToFF ld de, MovementData_51c7d ld a, [wCoordIndex] @@ -150,7 +150,7 @@ SilphCo7Script0: inc de .asm_51c6c ld a, $9 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $3 jp SilphCo7Text_51c10 @@ -212,7 +212,7 @@ SilphCo7Script4: ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a ld a, $9 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld a, SPRITE_FACING_UP ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay @@ -230,7 +230,7 @@ SilphCo7Script4: ld de, MovementData_51d1a .asm_51d0e ld a, $9 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call MoveSprite ld a, $5 jp SilphCo7Text_51c10 diff --git a/scripts/TradeCenter.asm b/scripts/TradeCenter.asm index ddb3061e..3201c8cd 100755 --- a/scripts/TradeCenter.asm +++ b/scripts/TradeCenter.asm @@ -8,7 +8,7 @@ TradeCenter_Script: .next ld [hSpriteFacingDirection], a ld a, $1 - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call SetSpriteFacingDirection ld hl, wd72d bit 0, [hl] diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index cc237f8e..4b0cf439 100755 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -57,10 +57,10 @@ VermilionDock_1db9b: ld a, $14 ; water tile call FillMemory ld a, 1 - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [wSSAnneSmokeDriftAmount], a ld [rOBP1], a ld a, 88 diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index 0af37945..1569fb55 100755 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -150,7 +150,7 @@ LTSurgeText: ld hl, ReceivedThunderbadgeText ld de, ReceivedThunderbadgeText call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index b0f94b9d..40e6a57f 100755 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -289,7 +289,7 @@ ViridianGymText1: ld hl, ViridianGymText_74ad3 ld de, ViridianGymText_74ad3 call SaveEndBattleTextPointers - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/WardensHouse.asm b/scripts/WardensHouse.asm index 69e199c9..e6ca47b2 100755 --- a/scripts/WardensHouse.asm +++ b/scripts/WardensHouse.asm @@ -95,7 +95,7 @@ HM04NoRoomText: FuchsiaHouse2Text5: FuchsiaHouse2Text4: TX_ASM - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] cp $4 ld hl, FuchsiaHouse2Text_7517b jr nz, .asm_4c9a2 -- cgit v1.3.1-sl0p From 053afc46349952688c0ce2116cc76f8d4733895e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 22:57:43 -0400 Subject: Move more code from home.asm to home/ --- data/moves/hm_moves.asm | 7 +- data/predef_pointers.asm | 6 + data/text_predef_pointers.asm | 71 + engine/pokemon/bills_pc.asm | 1 + home.asm | 3091 ++--------------------------------------- home/bankswitch.asm | 35 + home/list_menu.asm | 526 +++++++ home/move_mon.asm | 242 ++++ home/names.asm | 141 ++ home/names2.asm | 93 ++ home/overworld_text.asm | 31 + home/pokemon.asm | 464 +++++++ home/predef_text.asm | 237 ++++ home/print_bcd.asm | 77 + home/print_num.asm | 217 +++ home/trainers.asm | 436 ++++++ home/uncompress.asm | 196 +++ home/yes_no.asm | 40 + macros/predef.asm | 25 +- 19 files changed, 2959 insertions(+), 2977 deletions(-) create mode 100644 data/text_predef_pointers.asm create mode 100644 home/bankswitch.asm create mode 100644 home/list_menu.asm create mode 100644 home/move_mon.asm create mode 100644 home/names.asm create mode 100644 home/names2.asm create mode 100644 home/overworld_text.asm create mode 100644 home/pokemon.asm create mode 100644 home/predef_text.asm create mode 100644 home/print_bcd.asm create mode 100644 home/print_num.asm create mode 100644 home/trainers.asm create mode 100644 home/uncompress.asm create mode 100644 home/yes_no.asm (limited to 'macros') diff --git a/data/moves/hm_moves.asm b/data/moves/hm_moves.asm index d72eddfe..4f14b8df 100644 --- a/data/moves/hm_moves.asm +++ b/data/moves/hm_moves.asm @@ -1,7 +1,10 @@ -HMMoveArray: +; This file is INCLUDEd twice: +; - for HMMoves in home/names.asm +; - for HMMoveArray in engine/pokemon/bills_pc.asm + db CUT db FLY db SURF db STRENGTH db FLASH - db -1 + db -1 ; end diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index 5ce797e0..9d206a48 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -1,3 +1,9 @@ +add_predef: MACRO +\1Predef:: + db BANK(\1) + dw \1 +ENDM + PredefPointers:: ; these are pointers to ASM routines. ; they appear to be used in overworld map scripts. diff --git a/data/text_predef_pointers.asm b/data/text_predef_pointers.asm new file mode 100644 index 00000000..bbe9c8d8 --- /dev/null +++ b/data/text_predef_pointers.asm @@ -0,0 +1,71 @@ +add_tx_pre: MACRO +\1_id:: dw \1 +ENDM + +TextPredefs:: + add_tx_pre CardKeySuccessText ; 01 + add_tx_pre CardKeyFailText ; 02 + add_tx_pre RedBedroomPCText ; 03 + add_tx_pre RedBedroomSNESText ; 04 + add_tx_pre PushStartText ; 05 + add_tx_pre SaveOptionText ; 06 + add_tx_pre StrengthsAndWeaknessesText ; 07 + add_tx_pre OakLabEmailText ; 08 + add_tx_pre AerodactylFossilText ; 09 + add_tx_pre Route15UpstairsBinocularsText ; 0A + add_tx_pre KabutopsFossilText ; 0B + add_tx_pre GymStatueText1 ; 0C + add_tx_pre GymStatueText2 ; 0D + add_tx_pre BookcaseText ; 0E + add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F + add_tx_pre PewterCityPokecenterBenchGuyText ; 10 + add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 + add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 + add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 + add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 + add_tx_pre CeladonCityHotelText ; 15 + add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 + add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 + add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 + add_tx_pre MtMoonPokecenterBenchGuyText ; 19 + add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A + add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused + add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused + add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused + add_tx_pre UnusedPredefText ; 1E XXX unused + add_tx_pre PokemonCenterPCText ; 1F + add_tx_pre ViridianSchoolNotebook ; 20 + add_tx_pre ViridianSchoolBlackboard ; 21 + add_tx_pre JustAMomentText ; 22 + add_tx_pre OpenBillsPCText ; 23 + add_tx_pre FoundHiddenItemText ; 24 + add_tx_pre HiddenItemBagFullText ; 25 XXX unused + add_tx_pre VermilionGymTrashText ; 26 + add_tx_pre IndigoPlateauHQText ; 27 + add_tx_pre GameCornerOutOfOrderText ; 28 + add_tx_pre GameCornerOutToLunchText ; 29 + add_tx_pre GameCornerSomeonesKeysText ; 2A + add_tx_pre FoundHiddenCoinsText ; 2B + add_tx_pre DroppedHiddenCoinsText ; 2C + add_tx_pre BillsHouseMonitorText ; 2D + add_tx_pre BillsHouseInitiatedText ; 2E + add_tx_pre BillsHousePokemonList ; 2F + add_tx_pre MagazinesText ; 30 + add_tx_pre CinnabarGymQuiz ; 31 + add_tx_pre GameCornerNoCoinsText ; 32 + add_tx_pre GameCornerCoinCaseText ; 33 + add_tx_pre LinkCableHelp ; 34 + add_tx_pre TMNotebook ; 35 + add_tx_pre FightingDojoText ; 36 + add_tx_pre EnemiesOnEverySideText ; 37 + add_tx_pre WhatGoesAroundComesAroundText ; 38 + add_tx_pre NewBicycleText ; 39 + add_tx_pre IndigoPlateauStatues ; 3A + add_tx_pre VermilionGymTrashSuccessText1 ; 3B + add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused + add_tx_pre VermilionGymTrashSuccessText3 ; 3D + add_tx_pre VermilionGymTrashFailText ; 3E + add_tx_pre TownMapText ; 3F + add_tx_pre BookOrSculptureText ; 40 + add_tx_pre ElevatorText ; 41 + add_tx_pre PokemonStuffText ; 42 diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 1a97caf0..d9a329f5 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -376,6 +376,7 @@ KnowsHMMove:: and a ret +HMMoveArray: INCLUDE "data/moves/hm_moves.asm" DisplayDepositWithdrawMenu: diff --git a/home.asm b/home.asm index 2c58d0e6..7f743312 100644 --- a/home.asm +++ b/home.asm @@ -72,1123 +72,113 @@ LoadDestinationWarpPosition:: ld [MBC1RomBank], a ret +INCLUDE "home/pokemon.asm" +INCLUDE "home/print_bcd.asm" +INCLUDE "home/uncompress.asm" +INCLUDE "data/tilesets/collision_tile_ids.asm" +INCLUDE "home/copy2.asm" +INCLUDE "home/text.asm" +INCLUDE "home/vcopy.asm" +INCLUDE "home/init.asm" +INCLUDE "home/vblank.asm" +INCLUDE "home/fade.asm" +INCLUDE "home/serial.asm" +INCLUDE "home/timer.asm" +INCLUDE "home/audio.asm" -DrawHPBar:: -; Draw an HP bar d tiles long, and fill it to e pixels. -; If c is nonzero, show at least a sliver regardless. -; The right end of the bar changes with [wHPBarType]. - - push hl - push de - push bc - - ; Left - ld a, $71 ; "HP:" - ld [hli], a - ld a, $62 - ld [hli], a - - push hl - - ; Middle - ld a, $63 ; empty -.draw - ld [hli], a - dec d - jr nz, .draw - - ; Right - ld a, [wHPBarType] +UpdateSprites:: + ld a, [wUpdateSpritesEnabled] dec a - ld a, $6d ; status screen and battle - jr z, .ok - dec a ; pokemon menu -.ok - ld [hl], a - - pop hl - - ld a, e - and a - jr nz, .fill - - ; If c is nonzero, draw a pixel anyway. - ld a, c - and a - jr z, .done - ld e, 1 - -.fill - ld a, e - sub 8 - jr c, .partial - ld e, a - ld a, $6b ; full - ld [hli], a - ld a, e - and a - jr z, .done - jr .fill - -.partial - ; Fill remaining pixels at the end if necessary. - ld a, $63 ; empty - add e - ld [hl], a -.done - pop bc - pop de - pop hl - ret - - -; loads pokemon data from one of multiple sources to wLoadedMon -; loads base stats to wMonHeader -; INPUT: -; [wWhichPokemon] = index of pokemon within party/box -; [wMonDataLocation] = source -; 00: player's party -; 01: enemy's party -; 02: current box -; 03: daycare -; OUTPUT: -; [wcf91] = pokemon ID -; wLoadedMon = base address of pokemon data -; wMonHeader = base address of base stats -LoadMonData:: - jpab LoadMonData_ - -OverwritewMoves:: -; Write c to [wMoves + b]. Unused. - ld hl, wMoves - ld e, b - ld d, 0 - add hl, de - ld a, c - ld [hl], a - ret - -LoadFlippedFrontSpriteByMonIndex:: - ld a, 1 - ld [wSpriteFlipped], a - -LoadFrontSpriteByMonIndex:: - push hl - ld a, [wd11e] - push af - ld a, [wcf91] - ld [wd11e], a - predef IndexToPokedex - ld hl, wd11e - ld a, [hl] - pop bc - ld [hl], b - and a - pop hl - jr z, .invalidDexNumber ; dex #0 invalid - cp NUM_POKEMON + 1 - jr c, .validDexNumber ; dex >#151 invalid -.invalidDexNumber - ld a, RHYDON ; $1 - ld [wcf91], a - ret -.validDexNumber - push hl - ld de, vFrontPic - call LoadMonFrontSprite - pop hl + ret nz ld a, [hLoadedROMBank] push af - ld a, BANK(CopyUncompressedPicToHL) + ld a, BANK(_UpdateSprites) ld [hLoadedROMBank], a ld [MBC1RomBank], a - xor a - ld [hStartTileID], a - call CopyUncompressedPicToHL - xor a - ld [wSpriteFlipped], a + call _UpdateSprites pop af ld [hLoadedROMBank], a ld [MBC1RomBank], a ret +INCLUDE "data/items/marts.asm" +INCLUDE "home/overworld_text.asm" +INCLUDE "home/pic.asm" -PlayCry:: -; Play monster a's cry. - call GetCryData - call PlaySound - jp WaitForSoundToFinish - -GetCryData:: -; Load cry data for monster a. - dec a - ld c, a - ld b, 0 - ld hl, CryData - add hl, bc - add hl, bc - add hl, bc - - ld a, BANK(CryData) - call BankswitchHome - ld a, [hli] - ld b, a ; cry id - ld a, [hli] - ld [wFrequencyModifier], a - ld a, [hl] - ld [wTempoModifier], a - call BankswitchBack - - ; Cry headers have 3 channels, - ; and start from index CRY_SFX_START, - ; so add 3 times the cry id. - ld a, b - ld c, CRY_SFX_START - rlca ; * 2 - add b - add c +ResetPlayerSpriteData:: + ld hl, wSpriteStateData1 + call ResetPlayerSpriteData_ClearSpriteData + ld hl, wSpriteStateData2 + call ResetPlayerSpriteData_ClearSpriteData + ld a, $1 + ld [wSpriteStateData1], a + ld [wSpriteStateData2 + $0e], a + ld hl, wSpriteStateData1 + 4 + ld [hl], $3c ; set Y screen pos + inc hl + inc hl + ld [hl], $40 ; set X screen pos ret -DisplayPartyMenu:: - ld a, [hTilesetType] - push af - xor a - ld [hTilesetType], a - call GBPalWhiteOutWithDelay3 - call ClearSprites - call PartyMenuInit - call DrawPartyMenu - jp HandlePartyMenuInput - -GoBackToPartyMenu:: - ld a, [hTilesetType] - push af +; overwrites sprite data with zeroes +ResetPlayerSpriteData_ClearSpriteData:: + ld bc, $10 xor a - ld [hTilesetType], a - call PartyMenuInit - call RedrawPartyMenu - jp HandlePartyMenuInput + jp FillMemory -PartyMenuInit:: - ld a, 1 ; hardcoded bank - call BankswitchHome - call LoadHpBarAndStatusTilePatterns - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay - xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation], a - ld [wMenuWatchMovingOutOfBounds], a - ld hl, wTopMenuItemY - inc a - ld [hli], a ; top menu item Y - xor a - ld [hli], a ; top menu item X - ld a, [wPartyAndBillsPCSavedMenuItem] - push af - ld [hli], a ; current menu item ID - inc hl - ld a, [wPartyCount] - and a ; are there more than 0 pokemon in the party? - jr z, .storeMaxMenuItemID - dec a -; if party is not empty, the max menu item ID is ([wPartyCount] - 1) -; otherwise, it is 0 -.storeMaxMenuItemID - ld [hli], a ; max menu item ID - ld a, [wForcePlayerToChooseMon] +FadeOutAudio:: + ld a, [wAudioFadeOutControl] + and a ; currently fading out audio? + jr nz, .fadingOut + ld a, [wd72c] + bit 1, a + ret nz + ld a, $77 + ld [rNR50], a + ret +.fadingOut + ld a, [wAudioFadeOutCounter] and a - ld a, A_BUTTON | B_BUTTON - jr z, .next - xor a - ld [wForcePlayerToChooseMon], a - inc a ; a = A_BUTTON -.next - ld [hli], a ; menu watched keys - pop af - ld [hl], a ; old menu item ID + jr z, .counterReachedZero + dec a + ld [wAudioFadeOutCounter], a ret - -HandlePartyMenuInput:: - ld a, 1 - ld [wMenuWrappingEnabled], a - ld a, $40 - ld [wPartyMenuAnimMonEnabled], a - call HandleMenuInput_ - call PlaceUnfilledArrowMenuCursor +.counterReachedZero + ld a, [wAudioFadeOutCounterReloadValue] + ld [wAudioFadeOutCounter], a + ld a, [rNR50] + and a ; has the volume reached 0? + jr z, .fadeOutComplete ld b, a - xor a - ld [wPartyMenuAnimMonEnabled], a - ld a, [wCurrentMenuItem] - ld [wPartyAndBillsPCSavedMenuItem], a - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay - ld a, [wMenuItemToSwap] - and a - jp nz, .swappingPokemon - pop af - ld [hTilesetType], a - bit 1, b - jr nz, .noPokemonChosen - ld a, [wPartyCount] - and a - jr z, .noPokemonChosen - ld a, [wCurrentMenuItem] - ld [wWhichPokemon], a - ld hl, wPartySpecies - ld b, 0 + and $f + dec a ld c, a - add hl, bc - ld a, [hl] - ld [wcf91], a - ld [wBattleMonSpecies2], a - call BankswitchBack - and a - ret -.noPokemonChosen - call BankswitchBack - scf + ld a, b + and $f0 + swap a + dec a + swap a + or c + ld [rNR50], a ret -.swappingPokemon - bit 1, b ; was the B button pressed? - jr z, .handleSwap ; if not, handle swapping the pokemon -.cancelSwap ; if the B button was pressed - callba ErasePartyMenuCursors - xor a - ld [wMenuItemToSwap], a - ld [wPartyMenuTypeOrMessageID], a - call RedrawPartyMenu - jr HandlePartyMenuInput -.handleSwap - ld a, [wCurrentMenuItem] - ld [wWhichPokemon], a - callba SwitchPartyMon - jr HandlePartyMenuInput - -DrawPartyMenu:: - ld hl, DrawPartyMenu_ - jr DrawPartyMenuCommon - -RedrawPartyMenu:: - ld hl, RedrawPartyMenu_ - -DrawPartyMenuCommon:: - ld b, BANK(RedrawPartyMenu_) - jp Bankswitch - -; prints a pokemon's status condition -; INPUT: -; de = address of status condition -; hl = destination address -PrintStatusCondition:: - push de - dec de - dec de ; de = address of current HP - ld a, [de] +.fadeOutComplete + ld a, [wAudioFadeOutControl] ld b, a - dec de - ld a, [de] - or b ; is the pokemon's HP zero? - pop de - jr nz, PrintStatusConditionNotFainted -; if the pokemon's HP is 0, print "FNT" - ld a, "F" - ld [hli], a - ld a, "N" - ld [hli], a - ld [hl], "T" - and a - ret - -PrintStatusConditionNotFainted:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(PrintStatusAilment) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call PrintStatusAilment ; print status condition - pop bc + xor a + ld [wAudioFadeOutControl], a + ld a, SFX_STOP_ALL_MUSIC + ld [wNewSoundID], a + call PlaySound + ld a, [wAudioSavedROMBank] + ld [wAudioROMBank], a ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; function to print pokemon level, leaving off the ":L" if the level is at least 100 -; INPUT: -; hl = destination address -; [wLoadedMonLevel] = level -PrintLevel:: - ld a, $6e ; ":L" tile ID - ld [hli], a - ld c, 2 ; number of digits - ld a, [wLoadedMonLevel] ; level - cp 100 - jr c, PrintLevelCommon -; if level at least 100, write over the ":L" tile - dec hl - inc c ; increment number of digits to 3 - jr PrintLevelCommon - -; prints the level without leaving off ":L" regardless of level -; INPUT: -; hl = destination address -; [wLoadedMonLevel] = level -PrintLevelFull:: - ld a, $6e ; ":L" tile ID - ld [hli], a - ld c, 3 ; number of digits - ld a, [wLoadedMonLevel] ; level - -PrintLevelCommon:: - ld [wd11e], a - ld de, wd11e - ld b, LEFT_ALIGN | 1 ; 1 byte - jp PrintNumber + ld [wNewSoundID], a + jp PlaySound -GetwMoves:: -; Unused. Returns the move at index a from wMoves in a - ld hl, wMoves - ld c, a - ld b, 0 - add hl, bc - ld a, [hl] - ret +INCLUDE "home/predef_text.asm" +INCLUDE "home/start_menu.asm" -; copies the base stat data of a pokemon to wMonHeader -; INPUT: -; [wd0b5] = pokemon ID -GetMonHeader:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(BaseStats) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - push bc - push de - push hl - ld a, [wd11e] - push af - ld a, [wd0b5] - ld [wd11e], a - ld de, FossilKabutopsPic - ld b, $66 ; size of Kabutops fossil and Ghost sprites - cp FOSSIL_KABUTOPS ; Kabutops fossil - jr z, .specialID - ld de, GhostPic - cp MON_GHOST ; Ghost - jr z, .specialID - ld de, FossilAerodactylPic - ld b, $77 ; size of Aerodactyl fossil sprite - cp FOSSIL_AERODACTYL ; Aerodactyl fossil - jr z, .specialID - cp MEW - jr z, .mew - predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a, [wd11e] - dec a - ld bc, MonBaseStatsEnd - MonBaseStats - ld hl, BaseStats - call AddNTimes - ld de, wMonHeader - ld bc, MonBaseStatsEnd - MonBaseStats - call CopyData - jr .done -.specialID - ld hl, wMonHSpriteDim - ld [hl], b ; write sprite dimensions - inc hl - ld [hl], e ; write front sprite pointer - inc hl - ld [hl], d - jr .done -.mew - ld hl, MewBaseStats - ld de, wMonHeader - ld bc, MonBaseStatsEnd - MonBaseStats - ld a, BANK(MewBaseStats) - call FarCopyData -.done - ld a, [wd0b5] - ld [wMonHIndex], a - pop af - ld [wd11e], a - pop hl - pop de - pop bc - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; copy party pokemon's name to wcd6d -GetPartyMonName2:: - ld a, [wWhichPokemon] ; index within party - ld hl, wPartyMonNicks - -; this is called more often -GetPartyMonName:: - push hl - push bc - call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times - ld de, wcd6d - push de - ld bc, NAME_LENGTH - call CopyData - pop de - pop bc - pop hl - ret - -; function to print a BCD (Binary-coded decimal) number -; de = address of BCD number -; hl = destination address -; c = flags and length -; bit 7: if set, do not print leading zeroes -; if unset, print leading zeroes -; bit 6: if set, left-align the string (do not pad empty digits with spaces) -; if unset, right-align the string -; bit 5: if set, print currency symbol at the beginning of the string -; if unset, do not print the currency symbol -; bits 0-4: length of BCD number in bytes -; Note that bits 5 and 7 are modified during execution. The above reflects -; their meaning at the beginning of the functions's execution. -PrintBCDNumber:: - ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b - jr z, .loop - bit 7, b - jr nz, .loop - ld [hl], "¥" - inc hl -.loop - ld a, [de] - swap a - call PrintBCDDigit ; print upper digit - ld a, [de] - call PrintBCDDigit ; print lower digit - inc de - dec c - jr nz, .loop - bit 7, b ; were any non-zero digits printed? - jr z, .done ; if so, we are done -.numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? - jr nz, .skipRightAlignmentAdjustment - dec hl ; if the string is right-aligned, it needs to be moved back one space -.skipRightAlignmentAdjustment - bit 5, b - jr z, .skipCurrencySymbol - ld [hl], "¥" - inc hl -.skipCurrencySymbol - ld [hl], "0" - call PrintLetterDelay - inc hl -.done - ret - -PrintBCDDigit:: - and $f - and a - jr z, .zeroDigit -.nonzeroDigit - bit 7, b ; have any non-space characters been printed? - jr z, .outputDigit -; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? - jr z, .skipCurrencySymbol - ld [hl], "¥" - inc hl - res 5, b -.skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached -.outputDigit - add "0" - ld [hli], a - jp PrintLetterDelay -.zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? - jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? - ret nz - inc hl ; if right-aligned, "print" a space by advancing the pointer - ret - -; uncompresses the front or back sprite of the specified mon -; assumes the corresponding mon header is already loaded -; hl contains offset to sprite pointer ($b for front or $d for back) -UncompressMonSprite:: - ld bc, wMonHeader - add hl, bc - ld a, [hli] - ld [wSpriteInputPtr], a ; fetch sprite input pointer - ld a, [hl] - ld [wSpriteInputPtr+1], a -; define (by index number) the bank that a pokemon's image is in -; index = Mew, bank 1 -; index = Kabutops fossil, bank $B -; index < $1F, bank 9 -; $1F ≤ index < $4A, bank $A -; $4A ≤ index < $74, bank $B -; $74 ≤ index < $99, bank $C -; $99 ≤ index, bank $D - ld a, [wcf91] ; XXX name for this ram location - ld b, a - cp MEW - ld a, BANK(MewPicFront) - jr z, .GotBank - ld a, b - cp FOSSIL_KABUTOPS - ld a, BANK(FossilKabutopsPic) - jr z, .GotBank - ld a, b - cp TANGELA + 1 - ld a, BANK(TangelaPicFront) - jr c, .GotBank - ld a, b - cp MOLTRES + 1 - ld a, BANK(MoltresPicFront) - jr c, .GotBank - ld a, b - cp BEEDRILL + 2 - ld a, BANK(BeedrillPicFront) - jr c, .GotBank - ld a, b - cp STARMIE + 1 - ld a, BANK(StarmiePicFront) - jr c, .GotBank - ld a, BANK(VictreebelPicFront) -.GotBank - jp UncompressSpriteData - -; de: destination location -LoadMonFrontSprite:: - push de - ld hl, wMonHFrontSprite - wMonHeader - call UncompressMonSprite - ld hl, wMonHSpriteDim - ld a, [hli] - ld c, a - pop de - ; fall through - -; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram -; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers -; de: destination location -; a,c: sprite dimensions (in tiles of 8x8 each) -LoadUncompressedSpriteData:: - push de - and $f - ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width - ld b, a - ld a, $7 - sub b ; 7-w - inc a ; 8-w - srl a ; (8-w)/2 ; horizontal center (in tiles, rounded up) - ld b, a - add a - add a - add a - sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles) - ld [hSpriteOffset], a - ld a, c - swap a - and $f - ld b, a - add a - add a - add a ; 8*tiles is height in bytes - ld [hSpriteHeight], a - ld a, $7 - sub b ; 7-h ; skip for vertical center (in tiles, relative to current column) - ld b, a - ld a, [hSpriteOffset] - add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles) - add a - add a - add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) - ld [hSpriteOffset], a - xor a - ld [$4000], a - ld hl, sSpriteBuffer0 - call ZeroSpriteBuffer ; zero buffer 0 - ld de, sSpriteBuffer1 - ld hl, sSpriteBuffer0 - call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite) - ld hl, sSpriteBuffer1 - call ZeroSpriteBuffer ; zero buffer 1 - ld de, sSpriteBuffer2 - ld hl, sSpriteBuffer1 - call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) - pop de - jp InterlaceMergeSpriteBuffers - -; copies and aligns the sprite data properly inside the sprite buffer -; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area -AlignSpriteDataCentered:: - ld a, [hSpriteOffset] - ld b, $0 - ld c, a - add hl, bc - ld a, [hSpriteWidth] -.columnLoop - push af - push hl - ld a, [hSpriteHeight] - ld c, a -.columnInnerLoop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .columnInnerLoop - pop hl - ld bc, 7*8 ; 7 tiles - add hl, bc ; advance one full column - pop af - dec a - jr nz, .columnLoop - ret - -; fills the sprite buffer (pointed to in hl) with zeros -ZeroSpriteBuffer:: - ld bc, SPRITEBUFFERSIZE -.nextByteLoop - xor a - ld [hli], a - dec bc - ld a, b - or c - jr nz, .nextByteLoop - ret - -; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2 -; in the resulting sprite, the rows of the two source sprites are interlaced -; de: output address -InterlaceMergeSpriteBuffers:: - xor a - ld [$4000], a - push de - ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 - ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 - ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 - ld a, SPRITEBUFFERSIZE/2 ; $c4 - ld [hSpriteInterlaceCounter], a -.interlaceLoop - ld a, [de] - dec de - ld [hld], a ; write byte of source 2 - ld a, [bc] - dec bc - ld [hld], a ; write byte of source 1 - ld a, [de] - dec de - ld [hld], a ; write byte of source 2 - ld a, [bc] - dec bc - ld [hld], a ; write byte of source 1 - ld a, [hSpriteInterlaceCounter] - dec a - ld [hSpriteInterlaceCounter], a - jr nz, .interlaceLoop - ld a, [wSpriteFlipped] - and a - jr z, .notFlipped - ld bc, 2*SPRITEBUFFERSIZE - ld hl, sSpriteBuffer1 -.swapLoop - swap [hl] ; if flipped swap nybbles in all bytes - inc hl - dec bc - ld a, b - or c - jr nz, .swapLoop -.notFlipped - pop hl - ld de, sSpriteBuffer1 - ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied - ld a, [hLoadedROMBank] - ld b, a - jp CopyVideoData - - -INCLUDE "data/tilesets/collision_tile_ids.asm" -INCLUDE "home/copy2.asm" -INCLUDE "home/text.asm" -INCLUDE "home/vcopy.asm" -INCLUDE "home/init.asm" -INCLUDE "home/vblank.asm" -INCLUDE "home/fade.asm" -INCLUDE "home/serial.asm" -INCLUDE "home/timer.asm" -INCLUDE "home/audio.asm" - - -UpdateSprites:: - ld a, [wUpdateSpritesEnabled] - dec a - ret nz - ld a, [hLoadedROMBank] - push af - ld a, BANK(_UpdateSprites) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _UpdateSprites - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -INCLUDE "data/items/marts.asm" - -TextScriptEndingChar:: - db "@" -TextScriptEnd:: - ld hl, TextScriptEndingChar - ret - -ExclamationText:: - TX_FAR _ExclamationText - db "@" - -GroundRoseText:: - TX_FAR _GroundRoseText - db "@" - -BoulderText:: - TX_FAR _BoulderText - db "@" - -MartSignText:: - TX_FAR _MartSignText - db "@" - -PokeCenterSignText:: - TX_FAR _PokeCenterSignText - db "@" - -PickUpItemText:: - TX_ASM - predef PickUpItem - jp TextScriptEnd - - -INCLUDE "home/pic.asm" - - -ResetPlayerSpriteData:: - ld hl, wSpriteStateData1 - call ResetPlayerSpriteData_ClearSpriteData - ld hl, wSpriteStateData2 - call ResetPlayerSpriteData_ClearSpriteData - ld a, $1 - ld [wSpriteStateData1], a - ld [wSpriteStateData2 + $0e], a - ld hl, wSpriteStateData1 + 4 - ld [hl], $3c ; set Y screen pos - inc hl - inc hl - ld [hl], $40 ; set X screen pos - ret - -; overwrites sprite data with zeroes -ResetPlayerSpriteData_ClearSpriteData:: - ld bc, $10 - xor a - jp FillMemory - -FadeOutAudio:: - ld a, [wAudioFadeOutControl] - and a ; currently fading out audio? - jr nz, .fadingOut - ld a, [wd72c] - bit 1, a - ret nz - ld a, $77 - ld [rNR50], a - ret -.fadingOut - ld a, [wAudioFadeOutCounter] - and a - jr z, .counterReachedZero - dec a - ld [wAudioFadeOutCounter], a - ret -.counterReachedZero - ld a, [wAudioFadeOutCounterReloadValue] - ld [wAudioFadeOutCounter], a - ld a, [rNR50] - and a ; has the volume reached 0? - jr z, .fadeOutComplete - ld b, a - and $f - dec a - ld c, a - ld a, b - and $f0 - swap a - dec a - swap a - or c - ld [rNR50], a - ret -.fadeOutComplete - ld a, [wAudioFadeOutControl] - ld b, a - xor a - ld [wAudioFadeOutControl], a - ld a, SFX_STOP_ALL_MUSIC - ld [wNewSoundID], a - call PlaySound - ld a, [wAudioSavedROMBank] - ld [wAudioROMBank], a - ld a, b - ld [wNewSoundID], a - jp PlaySound - -; this function is used to display sign messages, sprite dialog, etc. -; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID -DisplayTextID:: - ld a, [hLoadedROMBank] - push af - callba DisplayTextIDInit ; initialization - ld hl, wTextPredefFlag - bit 0, [hl] - res 0, [hl] - jr nz, .skipSwitchToMapBank - ld a, [wCurMap] - call SwitchToMapRomBank -.skipSwitchToMapBank - ld a, 30 ; half a second - ld [hFrameCounter], a ; used as joypad poll timer - ld hl, wMapTextPtr - ld a, [hli] - ld h, [hl] - ld l, a ; hl = map text pointer - ld d, $00 - ld a, [hSpriteIndexOrTextID] ; text ID - ld [wSpriteIndex], a - and a - jp z, DisplayStartMenu - cp TEXT_SAFARI_GAME_OVER - jp z, DisplaySafariGameOverText - cp TEXT_MON_FAINTED - jp z, DisplayPokemonFaintedText - cp TEXT_BLACKED_OUT - jp z, DisplayPlayerBlackedOutText - cp TEXT_REPEL_WORE_OFF - jp z, DisplayRepelWoreOffText - ld a, [wNumSprites] - ld e, a - ld a, [hSpriteIndexOrTextID] ; sprite ID - cp e - jr z, .spriteHandling - jr nc, .skipSpriteHandling -.spriteHandling -; get the text ID of the sprite - push hl - push de - push bc - callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) - pop bc - pop de - ld hl, wMapSpriteData ; NPC text entries - ld a, [hSpriteIndexOrTextID] - dec a - add a - add l - ld l, a - jr nc, .noCarry - inc h -.noCarry - inc hl - ld a, [hl] ; a = text ID of the sprite - pop hl -.skipSpriteHandling -; look up the address of the text in the map's text entries - dec a - ld e, a - sla e - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a ; hl = address of the text - ld a, [hl] ; a = first byte of text -; check first byte of text for special cases - cp $fe ; Pokemart NPC - jp z, DisplayPokemartDialogue - cp $ff ; Pokemon Center NPC - jp z, DisplayPokemonCenterDialogue - cp $fc ; Item Storage PC - jp z, FuncTX_ItemStoragePC - cp $fd ; Bill's PC - jp z, FuncTX_BillsPC - cp $f9 ; Pokemon Center PC - jp z, FuncTX_PokemonCenterPC - cp $f5 ; Vending Machine - jr nz, .notVendingMachine - callba VendingMachineMenu ; jump banks to vending machine routine - jr AfterDisplayingTextID -.notVendingMachine - cp $f7 ; prize menu - jp z, FuncTX_GameCornerPrizeMenu - cp $f6 ; cable connection NPC in Pokemon Center - jr nz, .notSpecialCase - callab CableClubNPC - jr AfterDisplayingTextID -.notSpecialCase - call PrintText_NoCreatingTextBox ; display the text - ld a, [wDoNotWaitForButtonPressAfterDisplayingText] - and a - jr nz, HoldTextDisplayOpen - -AfterDisplayingTextID:: - ld a, [wEnteringCableClub] - and a - jr nz, HoldTextDisplayOpen - call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text - -; loop to hold the dialogue box open as long as the player keeps holding down the A button -HoldTextDisplayOpen:: - call Joypad - ld a, [hJoyHeld] - bit 0, a ; is the A button being pressed? - jr nz, HoldTextDisplayOpen - -CloseTextDisplay:: - ld a, [wCurMap] - call SwitchToMapRomBank - ld a, $90 - ld [hWY], a ; move the window off the screen - call DelayFrame - call LoadGBPal - xor a - ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank -; loop to make sprites face the directions they originally faced before the dialogue - ld hl, wSpriteStateData2 + $19 - ld c, $0f - ld de, $0010 -.restoreSpriteFacingDirectionLoop - ld a, [hl] - dec h - ld [hl], a - inc h - add hl, de - dec c - jr nz, .restoreSpriteFacingDirectionLoop - ld a, BANK(InitMapSprites) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl, wFontLoaded - res 0, [hl] - ld a, [wd732] - bit 3, a ; used fly warp - call z, LoadPlayerSpriteGraphics - call LoadCurrentMapView - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp UpdateSprites - -DisplayPokemartDialogue:: - push hl - ld hl, PokemartGreetingText - call PrintText - pop hl - inc hl - call LoadItemList - ld a, PRICEDITEMLISTMENU - ld [wListMenuID], a - ld a, [hLoadedROMBank] - push af - ld a, BANK(DisplayPokemartDialogue_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call DisplayPokemartDialogue_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp AfterDisplayingTextID - -PokemartGreetingText:: - TX_FAR _PokemartGreetingText - db "@" - -LoadItemList:: - ld a, 1 - ld [wUpdateSpritesEnabled], a - ld a, h - ld [wItemListPointer], a - ld a, l - ld [wItemListPointer + 1], a - ld de, wItemList -.loop - ld a, [hli] - ld [de], a - inc de - cp $ff - jr nz, .loop - ret - -DisplayPokemonCenterDialogue:: -; zeroing these doesn't appear to serve any purpose - xor a - ld [hItemPrice], a - ld [hItemPrice + 1], a - ld [hItemPrice + 2], a - - inc hl - ld a, [hLoadedROMBank] - push af - ld a, BANK(DisplayPokemonCenterDialogue_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call DisplayPokemonCenterDialogue_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp AfterDisplayingTextID - -DisplaySafariGameOverText:: - callab PrintSafariGameOverText - jp AfterDisplayingTextID - -DisplayPokemonFaintedText:: - ld hl, PokemonFaintedText - call PrintText - jp AfterDisplayingTextID - -PokemonFaintedText:: - TX_FAR _PokemonFaintedText - db "@" - -DisplayPlayerBlackedOutText:: - ld hl, PlayerBlackedOutText - call PrintText - ld a, [wd732] - res 5, a ; reset forced to use bike bit - ld [wd732], a - jp HoldTextDisplayOpen - -PlayerBlackedOutText:: - TX_FAR _PlayerBlackedOutText - db "@" - -DisplayRepelWoreOffText:: - ld hl, RepelWoreOffText - call PrintText - jp AfterDisplayingTextID - -RepelWoreOffText:: - TX_FAR _RepelWoreOffText - db "@" - -INCLUDE "home/start_menu.asm" - -; function to count how many bits are set in a string of bytes +; function to count how many bits are set in a string of bytes ; INPUT: ; hl = address of string of bytes ; b = length of string of bytes @@ -1204,740 +194,73 @@ CountSetBits:: srl e ld a, 0 adc c - ld c, a - dec d - jr nz, .innerLoop - dec b - jr nz, .loop - ld a, c - ld [wNumSetBits], a - ret - -; subtracts the amount the player paid from their money -; OUTPUT: carry = 0(success) or 1(fail because there is not enough money) -SubtractAmountPaidFromMoney:: - jpba SubtractAmountPaidFromMoney_ - -; adds the amount the player sold to their money -AddAmountSoldToMoney:: - ld de, wPlayerMoney + 2 - ld hl, hMoney + 2 ; total price of items - ld c, 3 ; length of money in bytes - predef AddBCDPredef ; add total price to money - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID ; redraw money text box - ld a, SFX_PURCHASE - call PlaySoundWaitForCurrent - jp WaitForSoundToFinish - -; function to remove an item (in varying quantities) from the player's bag or PC box -; INPUT: -; HL = address of inventory (either wNumBagItems or wNumBoxItems) -; [wWhichPokemon] = index (within the inventory) of the item to remove -; [wItemQuantity] = quantity to remove -RemoveItemFromInventory:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(RemoveItemFromInventory_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call RemoveItemFromInventory_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; function to add an item (in varying quantities) to the player's bag or PC box -; INPUT: -; HL = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID -; [wItemQuantity] = item quantity -; sets carry flag if successful, unsets carry flag if unsuccessful -AddItemToInventory:: - push bc - ld a, [hLoadedROMBank] - push af - ld a, BANK(AddItemToInventory_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call AddItemToInventory_ - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - pop bc - ret - -; INPUT: -; [wListMenuID] = list menu ID -; [wListPointer] = address of the list (2 bytes) -DisplayListMenuID:: - xor a - ld [hAutoBGTransferEnabled], a ; disable auto-transfer - ld a, 1 - ld [hJoy7], a ; joypad state update flag - ld a, [wBattleType] - and a ; is it the Old Man battle? - jr nz, .specialBattleType - ld a, $01 ; hardcoded bank - jr .bankswitch -.specialBattleType ; Old Man battle - ld a, BANK(DisplayBattleMenu) -.bankswitch - call BankswitchHome - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ld [wListCount], a - ld a, [wListPointer] - ld l, a - ld a, [wListPointer + 1] - ld h, a ; hl = address of the list - ld a, [hl] ; the first byte is the number of entries in the list - ld [wListCount], a - ld a, LIST_MENU_BOX - ld [wTextBoxID], a - call DisplayTextBoxID ; draw the menu text box - call UpdateSprites ; disable sprites behind the text box -; the code up to .skipMovingSprites appears to be useless - coord hl, 4, 2 ; coordinates of upper left corner of menu text box - lb de, 9, 14 ; height and width of menu text box - ld a, [wListMenuID] - and a ; is it a PC pokemon list? - jr nz, .skipMovingSprites - call UpdateSprites -.skipMovingSprites - ld a, 1 ; max menu item ID is 1 if the list has less than 2 entries - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wListCount] - cp 2 ; does the list have less than 2 entries? - jr c, .setMenuVariables - ld a, 2 ; max menu item ID is 2 if the list has at least 2 entries -.setMenuVariables - ld [wMaxMenuItem], a - ld a, 4 - ld [wTopMenuItemY], a - ld a, 5 - ld [wTopMenuItemX], a - ld a, A_BUTTON | B_BUTTON | SELECT - ld [wMenuWatchedKeys], a - ld c, 10 - call DelayFrames - -DisplayListMenuIDLoop:: - xor a - ld [hAutoBGTransferEnabled], a ; disable transfer - call PrintListMenuEntries - ld a, 1 - ld [hAutoBGTransferEnabled], a ; enable transfer - call Delay3 - ld a, [wBattleType] - and a ; is it the Old Man battle? - jr z, .notOldManBattle -.oldManBattle - ld a, "▶" - Coorda 5, 4 ; place menu cursor in front of first menu entry - ld c, 80 - call DelayFrames - xor a - ld [wCurrentMenuItem], a - coord hl, 5, 4 - ld a, l - ld [wMenuCursorLocation], a - ld a, h - ld [wMenuCursorLocation + 1], a - jr .buttonAPressed -.notOldManBattle - call LoadGBPal - call HandleMenuInput - push af - call PlaceMenuCursor - pop af - bit 0, a ; was the A button pressed? - jp z, .checkOtherKeys -.buttonAPressed - ld a, [wCurrentMenuItem] - call PlaceUnfilledArrowMenuCursor - -; pointless because both values are overwritten before they are read - ld a, $01 - ld [wMenuExitMethod], a - ld [wChosenMenuItem], a - - xor a - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wCurrentMenuItem] - ld c, a - ld a, [wListScrollOffset] - add c - ld c, a - ld a, [wListCount] - and a ; is the list empty? - jp z, ExitListMenu ; if so, exit the menu - dec a - cp c ; did the player select Cancel? - jp c, ExitListMenu ; if so, exit the menu - ld a, c - ld [wWhichPokemon], a - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .skipMultiplying -; if it's an item menu - sla c ; item entries are 2 bytes long, so multiply by 2 -.skipMultiplying - ld a, [wListPointer] - ld l, a - ld a, [wListPointer + 1] - ld h, a - inc hl ; hl = beginning of list entries - ld b, 0 - add hl, bc - ld a, [hl] - ld [wcf91], a - ld a, [wListMenuID] - and a ; is it a PC pokemon list? - jr z, .pokemonList - push hl - call GetItemPrice - pop hl - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .skipGettingQuantity -; if it's an item menu - inc hl - ld a, [hl] ; a = item quantity - ld [wMaxItemQuantity], a -.skipGettingQuantity - ld a, [wcf91] - ld [wd0b5], a - ld a, BANK(ItemNames) - ld [wPredefBank], a - call GetName - jr .storeChosenEntry -.pokemonList - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld hl, wPartyMonNicks - jr z, .getPokemonName - ld hl, wBoxMonNicks ; box pokemon names -.getPokemonName - ld a, [wWhichPokemon] - call GetPartyMonName -.storeChosenEntry ; store the menu entry that the player chose and return - ld de, wcd6d - call CopyStringToCF4B ; copy name to wcf4b - ld a, CHOSE_MENU_ITEM - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - xor a - ld [hJoy7], a ; joypad state update flag - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay - jp BankswitchBack -.checkOtherKeys ; check B, SELECT, Up, and Down keys - bit 1, a ; was the B button pressed? - jp nz, ExitListMenu ; if so, exit the menu - bit 2, a ; was the select button pressed? - jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries - ld b, a - bit 7, b ; was Down pressed? - ld hl, wListScrollOffset - jr z, .upPressed -.downPressed - ld a, [hl] - add 3 - ld b, a - ld a, [wListCount] - cp b ; will going down scroll past the Cancel button? - jp c, DisplayListMenuIDLoop - inc [hl] ; if not, go down - jp DisplayListMenuIDLoop -.upPressed - ld a, [hl] - and a - jp z, DisplayListMenuIDLoop - dec [hl] - jp DisplayListMenuIDLoop - -DisplayChooseQuantityMenu:: -; text box dimensions/coordinates for just quantity - coord hl, 15, 9 - ld b, 1 ; height - ld c, 3 ; width - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .drawTextBox -; text box dimensions/coordinates for quantity and price - coord hl, 7, 9 - ld b, 1 ; height - ld c, 11 ; width -.drawTextBox - call TextBoxBorder - coord hl, 16, 10 - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .printInitialQuantity - coord hl, 8, 10 -.printInitialQuantity - ld de, InitialQuantityText - call PlaceString - xor a - ld [wItemQuantity], a ; initialize current quantity to 0 - jp .incrementQuantity -.waitForKeyPressLoop - call JoypadLowSensitivity - ld a, [hJoyPressed] ; newly pressed buttons - bit 0, a ; was the A button pressed? - jp nz, .buttonAPressed - bit 1, a ; was the B button pressed? - jp nz, .buttonBPressed - bit 6, a ; was Up pressed? - jr nz, .incrementQuantity - bit 7, a ; was Down pressed? - jr nz, .decrementQuantity - jr .waitForKeyPressLoop -.incrementQuantity - ld a, [wMaxItemQuantity] - inc a - ld b, a - ld hl, wItemQuantity ; current quantity - inc [hl] - ld a, [hl] - cp b - jr nz, .handleNewQuantity -; wrap to 1 if the player goes above the max quantity - ld a, 1 - ld [hl], a - jr .handleNewQuantity -.decrementQuantity - ld hl, wItemQuantity ; current quantity - dec [hl] - jr nz, .handleNewQuantity -; wrap to the max quantity if the player goes below 1 - ld a, [wMaxItemQuantity] - ld [hl], a -.handleNewQuantity - coord hl, 17, 10 - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .printQuantity -.printPrice - ld c, $03 - ld a, [wItemQuantity] - ld b, a - ld hl, hMoney ; total price -; initialize total price to 0 - xor a - ld [hli], a - ld [hli], a - ld [hl], a -.addLoop ; loop to multiply the individual price by the quantity to get the total price - ld de, hMoney + 2 - ld hl, hItemPrice + 2 - push bc - predef AddBCDPredef ; add the individual price to the current sum - pop bc - dec b - jr nz, .addLoop - ld a, [hHalveItemPrices] - and a ; should the price be halved (for selling items)? - jr z, .skipHalvingPrice - xor a - ld [hDivideBCDDivisor], a - ld [hDivideBCDDivisor + 1], a - ld a, $02 - ld [hDivideBCDDivisor + 2], a - predef DivideBCDPredef3 ; halves the price -; store the halved price - ld a, [hDivideBCDQuotient] - ld [hMoney], a - ld a, [hDivideBCDQuotient + 1] - ld [hMoney + 1], a - ld a, [hDivideBCDQuotient + 2] - ld [hMoney + 2], a -.skipHalvingPrice - coord hl, 12, 10 - ld de, SpacesBetweenQuantityAndPriceText - call PlaceString - ld de, hMoney ; total price - ld c, $a3 - call PrintBCDNumber - coord hl, 9, 10 -.printQuantity - ld de, wItemQuantity ; current quantity - lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits - call PrintNumber - jp .waitForKeyPressLoop -.buttonAPressed ; the player chose to make the transaction - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ret -.buttonBPressed ; the player chose to cancel the transaction - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ld a, $ff - ret - -InitialQuantityText:: - db "×01@" - -SpacesBetweenQuantityAndPriceText:: - db " @" - -ExitListMenu:: - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - ld [wMenuWatchMovingOutOfBounds], a - xor a - ld [hJoy7], a - ld hl, wd730 - res 6, [hl] - call BankswitchBack - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - scf - ret - -PrintListMenuEntries:: - coord hl, 5, 3 - ld b, 9 - ld c, 14 - call ClearScreenArea - ld a, [wListPointer] - ld e, a - ld a, [wListPointer + 1] - ld d, a - inc de ; de = beginning of list entries - ld a, [wListScrollOffset] - ld c, a - ld a, [wListMenuID] - cp ITEMLISTMENU - ld a, c - jr nz, .skipMultiplying -; if it's an item menu -; item entries are 2 bytes long, so multiply by 2 - sla a - sla c -.skipMultiplying - add e - ld e, a - jr nc, .noCarry - inc d -.noCarry - coord hl, 6, 4 ; coordinates of first list entry name - ld b, 4 ; print 4 names -.loop - ld a, b - ld [wWhichPokemon], a - ld a, [de] - ld [wd11e], a - cp $ff - jp z, .printCancelMenuItem - push bc - push de - push hl - push hl - push de - ld a, [wListMenuID] - and a - jr z, .pokemonPCMenu - cp MOVESLISTMENU - jr z, .movesMenu -.itemMenu - call GetItemName - jr .placeNameString -.pokemonPCMenu - push hl - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld hl, wPartyMonNicks - jr z, .getPokemonName - ld hl, wBoxMonNicks ; box pokemon names -.getPokemonName - ld a, [wWhichPokemon] - ld b, a - ld a, 4 - sub b - ld b, a - ld a, [wListScrollOffset] - add b - call GetPartyMonName - pop hl - jr .placeNameString -.movesMenu - call GetMoveName -.placeNameString - call PlaceString - pop de - pop hl - ld a, [wPrintItemPrices] - and a ; should prices be printed? - jr z, .skipPrintingItemPrice -.printItemPrice - push hl - ld a, [de] - ld de, ItemPrices - ld [wcf91], a - call GetItemPrice ; get price - pop hl - ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right - add hl, bc - ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes - call PrintBCDNumber -.skipPrintingItemPrice - ld a, [wListMenuID] - and a - jr nz, .skipPrintingPokemonLevel -.printPokemonLevel - ld a, [wd11e] - push af - push hl - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld a, PLAYER_PARTY_DATA - jr z, .next - ld a, BOX_DATA -.next - ld [wMonDataLocation], a - ld hl, wWhichPokemon - ld a, [hl] - ld b, a - ld a, $04 - sub b - ld b, a - ld a, [wListScrollOffset] - add b - ld [hl], a - call LoadMonData - ld a, [wMonDataLocation] - and a ; is it a list of party pokemon or box pokemon? - jr z, .skipCopyingLevel -.copyLevel - ld a, [wLoadedMonBoxLevel] - ld [wLoadedMonLevel], a -.skipCopyingLevel - pop hl - ld bc, $001c - add hl, bc - call PrintLevel - pop af - ld [wd11e], a -.skipPrintingPokemonLevel - pop hl - pop de - inc de - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .nextListEntry -.printItemQuantity - ld a, [wd11e] - ld [wcf91], a - call IsKeyItem ; check if item is unsellable - ld a, [wIsKeyItem] - and a ; is the item unsellable? - jr nz, .skipPrintingItemQuantity ; if so, don't print the quantity - push hl - ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right - add hl, bc - ld a, "×" - ld [hli], a - ld a, [wd11e] - push af - ld a, [de] - ld [wMaxItemQuantity], a - push de - ld de, wd11e - ld [de], a - lb bc, 1, 2 - call PrintNumber - pop de - pop af - ld [wd11e], a - pop hl -.skipPrintingItemQuantity - inc de - pop bc - inc c - push bc - inc c - ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - and a ; is an item being swapped? - jr z, .nextListEntry - sla a - cp c ; is it this item? - jr nz, .nextListEntry - dec hl - ld a, $ec ; unfilled right arrow menu cursor to indicate an item being swapped - ld [hli], a -.nextListEntry - ld bc, 2 * SCREEN_WIDTH ; 2 rows - add hl, bc - pop bc - inc c + ld c, a + dec d + jr nz, .innerLoop dec b - jp nz, .loop - ld bc, -8 - add hl, bc - ld a, "▼" - ld [hl], a + jr nz, .loop + ld a, c + ld [wNumSetBits], a ret -.printCancelMenuItem - ld de, ListMenuCancelText - jp PlaceString -ListMenuCancelText:: - db "CANCEL@" +; subtracts the amount the player paid from their money +; OUTPUT: carry = 0(success) or 1(fail because there is not enough money) +SubtractAmountPaidFromMoney:: + jpba SubtractAmountPaidFromMoney_ -GetMonName:: - push hl +; adds the amount the player sold to their money +AddAmountSoldToMoney:: + ld de, wPlayerMoney + 2 + ld hl, hMoney + 2 ; total price of items + ld c, 3 ; length of money in bytes + predef AddBCDPredef ; add total price to money + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID ; redraw money text box + ld a, SFX_PURCHASE + call PlaySoundWaitForCurrent + jp WaitForSoundToFinish + +; function to remove an item (in varying quantities) from the player's bag or PC box +; INPUT: +; HL = address of inventory (either wNumBagItems or wNumBoxItems) +; [wWhichPokemon] = index (within the inventory) of the item to remove +; [wItemQuantity] = quantity to remove +RemoveItemFromInventory:: ld a, [hLoadedROMBank] push af - ld a, BANK(MonsterNames) + ld a, BANK(RemoveItemFromInventory_) ld [hLoadedROMBank], a ld [MBC1RomBank], a - ld a, [wd11e] - dec a - ld hl, MonsterNames - ld c, 10 - ld b, 0 - call AddNTimes - ld de, wcd6d - push de - ld bc, 10 - call CopyData - ld hl, wcd6d + 10 - ld [hl], "@" - pop de + call RemoveItemFromInventory_ pop af ld [hLoadedROMBank], a ld [MBC1RomBank], a - pop hl - ret - -GetItemName:: -; given an item ID at [wd11e], store the name of the item into a string -; starting at wcd6d - push hl - push bc - ld a, [wd11e] - cp HM_01 ; is this a TM/HM? - jr nc, .Machine - - ld [wd0b5], a - ld a, ITEM_NAME - ld [wNameListType], a - ld a, BANK(ItemNames) - ld [wPredefBank], a - call GetName - jr .Finish - -.Machine - call GetMachineName -.Finish - ld de, wcd6d ; pointer to where item name is stored in RAM - pop bc - pop hl ret -GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wcd6d - push hl - push de +; function to add an item (in varying quantities) to the player's bag or PC box +; INPUT: +; HL = address of inventory (either wNumBagItems or wNumBoxItems) +; [wcf91] = item ID +; [wItemQuantity] = item quantity +; sets carry flag if successful, unsets carry flag if unsuccessful +AddItemToInventory:: push bc - ld a, [wd11e] - push af - cp TM_01 ; is this a TM? [not HM] - jr nc, .WriteTM -; if HM, then write "HM" and add 5 to the item ID, so we can reuse the -; TM printing code - add 5 - ld [wd11e], a - ld hl, HiddenPrefix ; points to "HM" - ld bc, 2 - jr .WriteMachinePrefix -.WriteTM - ld hl, TechnicalPrefix ; points to "TM" - ld bc, 2 -.WriteMachinePrefix - ld de, wcd6d - call CopyData - -; now get the machine number and convert it to text - ld a, [wd11e] - sub TM_01 - 1 - ld b, "0" -.FirstDigit - sub 10 - jr c, .SecondDigit - inc b - jr .FirstDigit -.SecondDigit - add 10 + ld a, [hLoadedROMBank] push af + ld a, BANK(AddItemToInventory_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call AddItemToInventory_ + pop bc ld a, b - ld [de], a - inc de - pop af - ld b, "0" - add b - ld [de], a - inc de - ld a, "@" - ld [de], a - pop af - ld [wd11e], a + ld [hLoadedROMBank], a + ld [MBC1RomBank], a pop bc - pop de - pop hl - ret - -TechnicalPrefix:: - db "TM" -HiddenPrefix:: - db "HM" - -; sets carry if item is HM, clears carry if item is not HM -; Input: a = item ID -IsItemHM:: - cp HM_01 - jr c, .notHM - cp TM_01 - ret -.notHM - and a ret -; sets carry if move is an HM, clears carry if move is not an HM -; Input: a = move ID -IsMoveHM:: - ld hl, HMMoves - ld de, 1 - jp IsInArray - -HMMoves:: - db CUT,FLY,SURF,STRENGTH,FLASH - db $ff ; terminator - -GetMoveName:: - push hl - ld a, MOVE_NAME - ld [wNameListType], a - ld a, [wd11e] - ld [wd0b5], a - ld a, BANK(MoveNames) - ld [wPredefBank], a - call GetName - ld de, wcd6d ; pointer to where move name is stored in RAM - pop hl - ret +INCLUDE "home/list_menu.asm" +INCLUDE "home/names.asm" ; reloads text box tile patterns, current map view, and tileset tile patterns ReloadMapData:: @@ -2103,442 +426,7 @@ EndNPCMovementScript:: EmptyFunc2:: ret -; stores hl in [wTrainerHeaderPtr] -StoreTrainerHeaderPointer:: - ld a, h - ld [wTrainerHeaderPtr], a - ld a, l - ld [wTrainerHeaderPtr+1], a - ret - -; executes the current map script from the function pointer array provided in hl. -; a: map script index to execute (unless overridden by [wd733] bit 4) -ExecuteCurMapScriptInTable:: - push af - push de - call StoreTrainerHeaderPointer - pop hl - pop af - push hl - ld hl, wFlags_D733 - bit 4, [hl] - res 4, [hl] - jr z, .useProvidedIndex ; test if map script index was overridden manually - ld a, [wCurMapScript] -.useProvidedIndex - pop hl - ld [wCurMapScript], a - call CallFunctionInTable - ld a, [wCurMapScript] - ret - -LoadGymLeaderAndCityName:: - push de - ld de, wGymCityName - ld bc, $11 - call CopyData ; load city name - pop hl - ld de, wGymLeaderName - ld bc, NAME_LENGTH - jp CopyData ; load gym leader name - -; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) -; a: offset in header data -; 0 -> flag's bit (into wTrainerHeaderFlagBit) -; 2 -> flag's byte ptr (into hl) -; 4 -> before battle text (into hl) -; 6 -> after battle text (into hl) -; 8 -> end battle text (into hl) -ReadTrainerHeaderInfo:: - push de - push af - ld d, $0 - ld e, a - ld hl, wTrainerHeaderPtr - ld a, [hli] - ld l, [hl] - ld h, a - add hl, de - pop af - and a - jr nz, .nonZeroOffset - ld a, [hl] - ld [wTrainerHeaderFlagBit], a ; store flag's bit - jr .done -.nonZeroOffset - cp $2 - jr z, .readPointer ; read flag's byte ptr - cp $4 - jr z, .readPointer ; read before battle text - cp $6 - jr z, .readPointer ; read after battle text - cp $8 - jr z, .readPointer ; read end battle text - cp $a - jr nz, .done - ld a, [hli] ; read end battle text (2) but override the result afterwards (XXX why, bug?) - ld d, [hl] - ld e, a - jr .done -.readPointer - ld a, [hli] - ld h, [hl] - ld l, a -.done - pop de - ret - -TrainerFlagAction:: - predef_jump FlagActionPredef - -TalkToTrainer:: - call StoreTrainerHeaderPointer - xor a - call ReadTrainerHeaderInfo ; read flag's bit - ld a, $2 - call ReadTrainerHeaderInfo ; read flag's byte ptr - ld a, [wTrainerHeaderFlagBit] - ld c, a - ld b, FLAG_TEST - call TrainerFlagAction ; read trainer's flag - ld a, c - and a - jr z, .trainerNotYetFought ; test trainer's flag - ld a, $6 - call ReadTrainerHeaderInfo ; print after battle text - jp PrintText -.trainerNotYetFought - ld a, $4 - call ReadTrainerHeaderInfo ; print before battle text - call PrintText - ld a, $a - call ReadTrainerHeaderInfo ; (?) does nothing apparently (maybe bug in ReadTrainerHeaderInfo) - push de - ld a, $8 - call ReadTrainerHeaderInfo ; read end battle text - pop de - call SaveEndBattleTextPointers - ld hl, wFlags_D733 - set 4, [hl] ; activate map script index override (index is set below) - ld hl, wFlags_0xcd60 - bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) - ret nz -; if the player talked to the trainer of his own volition - call EngageMapTrainer - ld hl, wCurMapScript - inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) - jp StartTrainerBattle - -; checks if any trainers are seeing the player and wanting to fight -CheckFightingMapTrainers:: - call CheckForEngagingTrainers - ld a, [wSpriteIndex] - cp $ff - jr nz, .trainerEngaging - xor a - ld [wSpriteIndex], a - ld [wTrainerHeaderFlagBit], a - ret -.trainerEngaging - ld hl, wFlags_D733 - set 3, [hl] - ld [wEmotionBubbleSpriteIndex], a - xor a ; EXCLAMATION_BUBBLE - ld [wWhichEmotionBubble], a - predef EmotionBubble - ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN - ld [wJoyIgnore], a - xor a - ld [hJoyHeld], a - call TrainerWalkUpToPlayer_Bank0 - ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) - ret - -; display the before battle text after the enemy trainer has walked up to the player's sprite -DisplayEnemyTrainerTextAndStartBattle:: - ld a, [wd730] - and $1 - ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite - ld [wJoyIgnore], a - ld a, [wSpriteIndex] - ld [hSpriteIndexOrTextID], a - call DisplayTextID - ; fall through - -StartTrainerBattle:: - xor a - ld [wJoyIgnore], a - call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] - ld hl, wd72e - set 1, [hl] - ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) - ret - -EndTrainerBattle:: - ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] - ld hl, wd72d - res 7, [hl] - ld hl, wFlags_0xcd60 - res 0, [hl] ; player is no longer engaged by any trainer - ld a, [wIsInBattle] - cp $ff - jp z, ResetButtonPressedAndMapScript - ld a, $2 - call ReadTrainerHeaderInfo - ld a, [wTrainerHeaderFlagBit] - ld c, a - ld b, FLAG_SET - call TrainerFlagAction ; flag trainer as fought - ld a, [wEnemyMonOrTrainerClass] - cp OPP_ID_OFFSET - jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) - ld hl, wMissableObjectList - ld de, $2 - ld a, [wSpriteIndex] - call IsInArray ; search for sprite ID - inc hl - ld a, [hl] - ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it - predef HideObject -.skipRemoveSprite - ld hl, wd730 - bit 4, [hl] - res 4, [hl] - ret nz - -ResetButtonPressedAndMapScript:: - xor a - ld [wJoyIgnore], a - ld [hJoyHeld], a - ld [hJoyPressed], a - ld [hJoyReleased], a - ld [wCurMapScript], a ; reset battle status - ret - -; calls TrainerWalkUpToPlayer -TrainerWalkUpToPlayer_Bank0:: - jpba TrainerWalkUpToPlayer - -; sets opponent type and mon set/lvl based on the engaging trainer data -InitBattleEnemyParameters:: - ld a, [wEngagedTrainerClass] - ld [wCurOpponent], a - ld [wEnemyMonOrTrainerClass], a - cp OPP_ID_OFFSET - ld a, [wEngagedTrainerSet] - jr c, .noTrainer - ld [wTrainerNo], a - ret -.noTrainer - ld [wCurEnemyLVL], a - ret - -GetSpritePosition1:: - ld hl, _GetSpritePosition1 - jr SpritePositionBankswitch - -GetSpritePosition2:: - ld hl, _GetSpritePosition2 - jr SpritePositionBankswitch - -SetSpritePosition1:: - ld hl, _SetSpritePosition1 - jr SpritePositionBankswitch - -SetSpritePosition2:: - ld hl, _SetSpritePosition2 -SpritePositionBankswitch:: - ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2) - jp Bankswitch ; indirect jump to one of the four functions - -CheckForEngagingTrainers:: - xor a - call ReadTrainerHeaderInfo ; read trainer flag's bit (unused) - ld d, h ; store trainer header address in de - ld e, l -.trainerLoop - call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer - ld a, [de] - ld [wSpriteIndex], a ; store trainer flag's bit - ld [wTrainerHeaderFlagBit], a - cp $ff - ret z - ld a, $2 - call ReadTrainerHeaderInfo ; read trainer flag's byte ptr - ld b, FLAG_TEST - ld a, [wTrainerHeaderFlagBit] - ld c, a - call TrainerFlagAction ; read trainer flag - ld a, c - and a ; has the trainer already been defeated? - jr nz, .continue - push hl - push de - push hl - xor a - call ReadTrainerHeaderInfo ; get trainer header pointer - inc hl - ld a, [hl] ; read trainer engage distance - pop hl - ld [wTrainerEngageDistance], a - ld a, [wSpriteIndex] - swap a - ld [wTrainerSpriteOffset], a - predef TrainerEngage - pop de - pop hl - ld a, [wTrainerSpriteOffset] - and a - ret nz ; break if the trainer is engaging -.continue - ld hl, $c - add hl, de - ld d, h - ld e, l - jr .trainerLoop - -; hl = text if the player wins -; de = text if the player loses -SaveEndBattleTextPointers:: - ld a, [hLoadedROMBank] - ld [wEndBattleTextRomBank], a - ld a, h - ld [wEndBattleWinTextPointer], a - ld a, l - ld [wEndBattleWinTextPointer + 1], a - ld a, d - ld [wEndBattleLoseTextPointer], a - ld a, e - ld [wEndBattleLoseTextPointer + 1], a - ret - -; loads data of some trainer on the current map and plays pre-battle music -; [wSpriteIndex]: sprite ID of trainer who is engaged -EngageMapTrainer:: - ld hl, wMapSpriteExtraData - ld d, $0 - ld a, [wSpriteIndex] - dec a - add a - ld e, a - add hl, de ; seek to engaged trainer data - ld a, [hli] ; load trainer class - ld [wEngagedTrainerClass], a - ld a, [hl] ; load trainer mon set - ld [wEngagedTrainerSet], a - jp PlayTrainerMusic - -PrintEndBattleText:: - push hl - ld hl, wd72d - bit 7, [hl] - res 7, [hl] - pop hl - ret z - ld a, [hLoadedROMBank] - push af - ld a, [wEndBattleTextRomBank] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - push hl - callba SaveTrainerName - ld hl, TrainerEndBattleText - call PrintText - pop hl - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - callba FreezeEnemyTrainerSprite - jp WaitForSoundToFinish - -GetSavedEndBattleTextPointer:: - ld a, [wBattleResult] - and a -; won battle - jr nz, .lostBattle - ld a, [wEndBattleWinTextPointer] - ld h, a - ld a, [wEndBattleWinTextPointer + 1] - ld l, a - ret -.lostBattle - ld a, [wEndBattleLoseTextPointer] - ld h, a - ld a, [wEndBattleLoseTextPointer + 1] - ld l, a - ret - -TrainerEndBattleText:: - TX_FAR _TrainerNameText - TX_ASM - call GetSavedEndBattleTextPointer - call TextCommandProcessor - jp TextScriptEnd - -; only engage withe trainer if the player is not already -; engaged with another trainer -; XXX unused? -CheckIfAlreadyEngaged:: - ld a, [wFlags_0xcd60] - bit 0, a - ret nz - call EngageMapTrainer - xor a - ret - -PlayTrainerMusic:: - ld a, [wEngagedTrainerClass] - cp OPP_SONY1 - ret z - cp OPP_SONY2 - ret z - cp OPP_SONY3 - ret z - ld a, [wGymLeaderNo] - and a - ret nz - xor a - ld [wAudioFadeOutControl], a - ld a, SFX_STOP_ALL_MUSIC - call PlaySound - ld a, BANK(Music_MeetEvilTrainer) - ld [wAudioROMBank], a - ld [wAudioSavedROMBank], a - ld a, [wEngagedTrainerClass] - ld b, a - ld hl, EvilTrainerList -.evilTrainerListLoop - ld a, [hli] - cp $ff - jr z, .noEvilTrainer - cp b - jr nz, .evilTrainerListLoop - ld a, MUSIC_MEET_EVIL_TRAINER - jr .PlaySound -.noEvilTrainer - ld hl, FemaleTrainerList -.femaleTrainerListLoop - ld a, [hli] - cp $ff - jr z, .maleTrainer - cp b - jr nz, .femaleTrainerListLoop - ld a, MUSIC_MEET_FEMALE_TRAINER - jr .PlaySound -.maleTrainer - ld a, MUSIC_MEET_MALE_TRAINER -.PlaySound - ld [wNewSoundID], a - jp PlaySound - -INCLUDE "data/trainers/encounter_types.asm" +INCLUDE "home/trainers.asm" ; checks if the player's coordinates match an arrow movement tile's coordinates ; and if so, decodes the RLE movement data @@ -2841,83 +729,8 @@ HasEnoughCoins:: ld c, 2 jp StringCmp - -BankswitchHome:: -; switches to bank # in a -; Only use this when in the home bank! - ld [wBankswitchHomeTemp], a - ld a, [hLoadedROMBank] - ld [wBankswitchHomeSavedROMBank], a - ld a, [wBankswitchHomeTemp] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -BankswitchBack:: -; returns from BankswitchHome - ld a, [wBankswitchHomeSavedROMBank] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -Bankswitch:: -; self-contained bankswitch, use this when not in the home bank -; switches to the bank in b - ld a, [hLoadedROMBank] - push af - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ld bc, .Return - push bc - jp hl -.Return - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; displays yes/no choice -; yes -> set carry -YesNoChoice:: - call SaveScreenTilesToBuffer1 - call InitYesNoTextBoxParameters - jr DisplayYesNoChoice - -Func_35f4:: - ld a, TWO_OPTION_MENU - ld [wTextBoxID], a - call InitYesNoTextBoxParameters - jp DisplayTextBoxID - -InitYesNoTextBoxParameters:: - xor a ; YES_NO_MENU - ld [wTwoOptionMenuID], a - coord hl, 14, 7 - ld bc, $80f - ret - -YesNoChoicePokeCenter:: - call SaveScreenTilesToBuffer1 - ld a, HEAL_CANCEL_MENU - ld [wTwoOptionMenuID], a - coord hl, 11, 6 - lb bc, 8, 12 - jr DisplayYesNoChoice - -WideYesNoChoice:: ; unused - call SaveScreenTilesToBuffer1 - ld a, WIDE_YES_NO_MENU - ld [wTwoOptionMenuID], a - coord hl, 12, 7 - lb bc, 8, 13 - -DisplayYesNoChoice:: - ld a, TWO_OPTION_MENU - ld [wTextBoxID], a - call DisplayTextBoxID - jp LoadScreenTilesFromBuffer1 +INCLUDE "home/bankswitch.asm" +INCLUDE "home/yes_no.asm" ; calculates the difference |a-b|, setting carry flag if a999) - cp 999 / $100 + 1 - jr nc, .overflow - cp 999 / $100 - jr c, .noOverflow - ld a, [hMultiplicand+2] - cp 999 % $100 + 1 - jr c, .noOverflow -.overflow - ld a, 999 / $100 ; overflow: cap at 999 - ld [hMultiplicand+1], a - ld a, 999 % $100 - ld [hMultiplicand+2], a -.noOverflow - pop bc - pop de - pop hl - ret - -AddEnemyMonToPlayerParty:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(_AddEnemyMonToPlayerParty) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _AddEnemyMonToPlayerParty - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -MoveMon:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(_MoveMon) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _MoveMon - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret +INCLUDE "home/move_mon.asm" ; skips a text entries, each of size NAME_LENGTH (like trainer name, OT name, rival name, ...) ; hl: base pointer, will be incremented by NAME_LENGTH * a @@ -4091,225 +1568,7 @@ PrintText_NoCreatingTextBox:: coord bc, 1, 14 jp TextCommandProcessor - -PrintNumber:: -; Print the c-digit, b-byte value at de. -; Allows 2 to 7 digits. For 1-digit numbers, add -; the value to char "0" instead of calling PrintNumber. -; Flags LEADING_ZEROES and LEFT_ALIGN can be given -; in bits 7 and 6 of b respectively. - push bc - xor a - ld [hPastLeadingZeros], a - ld [hNumToPrint], a - ld [hNumToPrint + 1], a - ld a, b - and $f - cp 1 - jr z, .byte - cp 2 - jr z, .word -.long - ld a, [de] - ld [hNumToPrint], a - inc de - ld a, [de] - ld [hNumToPrint + 1], a - inc de - ld a, [de] - ld [hNumToPrint + 2], a - jr .start - -.word - ld a, [de] - ld [hNumToPrint + 1], a - inc de - ld a, [de] - ld [hNumToPrint + 2], a - jr .start - -.byte - ld a, [de] - ld [hNumToPrint + 2], a - -.start - push de - - ld d, b - ld a, c - ld b, a - xor a - ld c, a - ld a, b - - cp 2 - jr z, .tens - cp 3 - jr z, .hundreds - cp 4 - jr z, .thousands - cp 5 - jr z, .ten_thousands - cp 6 - jr z, .hundred_thousands - -print_digit: macro - -if (\1) / $10000 - ld a, \1 / $10000 % $100 -else xor a -endc - ld [hPowerOf10 + 0], a - -if (\1) / $100 - ld a, \1 / $100 % $100 -else xor a -endc - ld [hPowerOf10 + 1], a - - ld a, \1 / $1 % $100 - ld [hPowerOf10 + 2], a - - call .PrintDigit - call .NextDigit -endm - -.millions print_digit 1000000 -.hundred_thousands print_digit 100000 -.ten_thousands print_digit 10000 -.thousands print_digit 1000 -.hundreds print_digit 100 - -.tens - ld c, 0 - ld a, [hNumToPrint + 2] -.mod - cp 10 - jr c, .ok - sub 10 - inc c - jr .mod -.ok - - ld b, a - ld a, [hPastLeadingZeros] - or c - ld [hPastLeadingZeros], a - jr nz, .past - call .PrintLeadingZero - jr .next -.past - ld a, "0" - add c - ld [hl], a -.next - - call .NextDigit -.ones - ld a, "0" - add b - ld [hli], a - pop de - dec de - pop bc - ret - -.PrintDigit: -; Divide by the current decimal place. -; Print the quotient, and keep the modulus. - ld c, 0 -.loop - ld a, [hPowerOf10] - ld b, a - ld a, [hNumToPrint] - ld [hSavedNumToPrint], a - cp b - jr c, .underflow0 - sub b - ld [hNumToPrint], a - ld a, [hPowerOf10 + 1] - ld b, a - ld a, [hNumToPrint + 1] - ld [hSavedNumToPrint + 1], a - cp b - jr nc, .noborrow1 - - ld a, [hNumToPrint] - or 0 - jr z, .underflow1 - dec a - ld [hNumToPrint], a - ld a, [hNumToPrint + 1] -.noborrow1 - - sub b - ld [hNumToPrint + 1], a - ld a, [hPowerOf10 + 2] - ld b, a - ld a, [hNumToPrint + 2] - ld [hSavedNumToPrint + 2], a - cp b - jr nc, .noborrow2 - - ld a, [hNumToPrint + 1] - and a - jr nz, .borrowed - - ld a, [hNumToPrint] - and a - jr z, .underflow2 - dec a - ld [hNumToPrint], a - xor a -.borrowed - - dec a - ld [hNumToPrint + 1], a - ld a, [hNumToPrint + 2] -.noborrow2 - sub b - ld [hNumToPrint + 2], a - inc c - jr .loop - -.underflow2 - ld a, [hSavedNumToPrint + 1] - ld [hNumToPrint + 1], a -.underflow1 - ld a, [hSavedNumToPrint] - ld [hNumToPrint], a -.underflow0 - ld a, [hPastLeadingZeros] - or c - jr z, .PrintLeadingZero - - ld a, "0" - add c - ld [hl], a - ld [hPastLeadingZeros], a - ret - -.PrintLeadingZero: - bit BIT_LEADING_ZEROES, d - ret z - ld [hl], "0" - ret - -.NextDigit: -; Increment unless the number is left-aligned, -; leading zeroes are not printed, and no digits -; have been printed yet. - bit BIT_LEADING_ZEROES, d - jr nz, .inc - bit BIT_LEFT_ALIGN, d - jr z, .inc - ld a, [hPastLeadingZeros] - and a - ret z -.inc - inc hl - ret - +INCLUDE "home/print_num.asm" CallFunctionInTable:: ; Call function a in jumptable hl. @@ -4333,7 +1592,6 @@ CallFunctionInTable:: pop hl ret - IsInArray:: ; Search an array at hl for the value in a. ; Entry size is de bytes. @@ -4360,7 +1618,6 @@ IsInRestOfArray:: scf ret - RestoreScreenTilesAndReloadTilePatterns:: call ClearSprites ld a, $1 @@ -4371,7 +1628,6 @@ RestoreScreenTilesAndReloadTilePatterns:: call RunDefaultPaletteCommand jr Delay3 - GBPalWhiteOutWithDelay3:: call GBPalWhiteOut @@ -4397,7 +1653,6 @@ GBPalWhiteOut:: ld [rOBP1], a ret - RunDefaultPaletteCommand:: ld b, $ff RunPaletteCommand:: @@ -4441,7 +1696,6 @@ ReloadMapSpriteTilePatterns:: call LoadFontTilePatterns jp UpdateSprites - GiveItem:: ; Give player quantity c of item b, ; and copy the item's name to wcf4b. @@ -4469,7 +1723,6 @@ GivePokemon:: ld [wMonDataLocation], a jpba _GivePokemon - Random:: ; Return a random number in a. ; For battles, use BattleRandom. @@ -4483,10 +1736,8 @@ Random:: pop hl ret - INCLUDE "home/predef.asm" - UpdateCinnabarGymGateTileBlocks:: jpba UpdateCinnabarGymGateTileBlocks_ @@ -4554,72 +1805,4 @@ SetMapTextPointer:: ld [wMapTextPtr + 1], a ret -TextPredefs:: -const_value = 1 - - add_tx_pre CardKeySuccessText ; 01 - add_tx_pre CardKeyFailText ; 02 - add_tx_pre RedBedroomPCText ; 03 - add_tx_pre RedBedroomSNESText ; 04 - add_tx_pre PushStartText ; 05 - add_tx_pre SaveOptionText ; 06 - add_tx_pre StrengthsAndWeaknessesText ; 07 - add_tx_pre OakLabEmailText ; 08 - add_tx_pre AerodactylFossilText ; 09 - add_tx_pre Route15UpstairsBinocularsText ; 0A - add_tx_pre KabutopsFossilText ; 0B - add_tx_pre GymStatueText1 ; 0C - add_tx_pre GymStatueText2 ; 0D - add_tx_pre BookcaseText ; 0E - add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F - add_tx_pre PewterCityPokecenterBenchGuyText ; 10 - add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 - add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 - add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 - add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 - add_tx_pre CeladonCityHotelText ; 15 - add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 - add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 - add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 - add_tx_pre MtMoonPokecenterBenchGuyText ; 19 - add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A - add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused - add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused - add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused - add_tx_pre UnusedPredefText ; 1E XXX unused - add_tx_pre PokemonCenterPCText ; 1F - add_tx_pre ViridianSchoolNotebook ; 20 - add_tx_pre ViridianSchoolBlackboard ; 21 - add_tx_pre JustAMomentText ; 22 - add_tx_pre OpenBillsPCText ; 23 - add_tx_pre FoundHiddenItemText ; 24 - add_tx_pre HiddenItemBagFullText ; 25 XXX unused - add_tx_pre VermilionGymTrashText ; 26 - add_tx_pre IndigoPlateauHQText ; 27 - add_tx_pre GameCornerOutOfOrderText ; 28 - add_tx_pre GameCornerOutToLunchText ; 29 - add_tx_pre GameCornerSomeonesKeysText ; 2A - add_tx_pre FoundHiddenCoinsText ; 2B - add_tx_pre DroppedHiddenCoinsText ; 2C - add_tx_pre BillsHouseMonitorText ; 2D - add_tx_pre BillsHouseInitiatedText ; 2E - add_tx_pre BillsHousePokemonList ; 2F - add_tx_pre MagazinesText ; 30 - add_tx_pre CinnabarGymQuiz ; 31 - add_tx_pre GameCornerNoCoinsText ; 32 - add_tx_pre GameCornerCoinCaseText ; 33 - add_tx_pre LinkCableHelp ; 34 - add_tx_pre TMNotebook ; 35 - add_tx_pre FightingDojoText ; 36 - add_tx_pre EnemiesOnEverySideText ; 37 - add_tx_pre WhatGoesAroundComesAroundText ; 38 - add_tx_pre NewBicycleText ; 39 - add_tx_pre IndigoPlateauStatues ; 3A - add_tx_pre VermilionGymTrashSuccessText1 ; 3B - add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused - add_tx_pre VermilionGymTrashSuccessText3 ; 3D - add_tx_pre VermilionGymTrashFailText ; 3E - add_tx_pre TownMapText ; 3F - add_tx_pre BookOrSculptureText ; 40 - add_tx_pre ElevatorText ; 41 - add_tx_pre PokemonStuffText ; 42 +INCLUDE "data/text_predef_pointers.asm" diff --git a/home/bankswitch.asm b/home/bankswitch.asm new file mode 100644 index 00000000..086ca2f3 --- /dev/null +++ b/home/bankswitch.asm @@ -0,0 +1,35 @@ +BankswitchHome:: +; switches to bank # in a +; Only use this when in the home bank! + ld [wBankswitchHomeTemp], a + ld a, [hLoadedROMBank] + ld [wBankswitchHomeSavedROMBank], a + ld a, [wBankswitchHomeTemp] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +BankswitchBack:: +; returns from BankswitchHome + ld a, [wBankswitchHomeSavedROMBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +Bankswitch:: +; self-contained bankswitch, use this when not in the home bank +; switches to the bank in b + ld a, [hLoadedROMBank] + push af + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld bc, .Return + push bc + jp hl +.Return + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/list_menu.asm b/home/list_menu.asm new file mode 100644 index 00000000..68335ed5 --- /dev/null +++ b/home/list_menu.asm @@ -0,0 +1,526 @@ +; INPUT: +; [wListMenuID] = list menu ID +; [wListPointer] = address of the list (2 bytes) +DisplayListMenuID:: + xor a + ld [hAutoBGTransferEnabled], a ; disable auto-transfer + ld a, 1 + ld [hJoy7], a ; joypad state update flag + ld a, [wBattleType] + and a ; is it the Old Man battle? + jr nz, .specialBattleType + ld a, $01 ; hardcoded bank + jr .bankswitch +.specialBattleType ; Old Man battle + ld a, BANK(DisplayBattleMenu) +.bankswitch + call BankswitchHome + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld [wListCount], a + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a ; hl = address of the list + ld a, [hl] ; the first byte is the number of entries in the list + ld [wListCount], a + ld a, LIST_MENU_BOX + ld [wTextBoxID], a + call DisplayTextBoxID ; draw the menu text box + call UpdateSprites ; disable sprites behind the text box +; the code up to .skipMovingSprites appears to be useless + coord hl, 4, 2 ; coordinates of upper left corner of menu text box + lb de, 9, 14 ; height and width of menu text box + ld a, [wListMenuID] + and a ; is it a PC pokemon list? + jr nz, .skipMovingSprites + call UpdateSprites +.skipMovingSprites + ld a, 1 ; max menu item ID is 1 if the list has less than 2 entries + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wListCount] + cp 2 ; does the list have less than 2 entries? + jr c, .setMenuVariables + ld a, 2 ; max menu item ID is 2 if the list has at least 2 entries +.setMenuVariables + ld [wMaxMenuItem], a + ld a, 4 + ld [wTopMenuItemY], a + ld a, 5 + ld [wTopMenuItemX], a + ld a, A_BUTTON | B_BUTTON | SELECT + ld [wMenuWatchedKeys], a + ld c, 10 + call DelayFrames + +DisplayListMenuIDLoop:: + xor a + ld [hAutoBGTransferEnabled], a ; disable transfer + call PrintListMenuEntries + ld a, 1 + ld [hAutoBGTransferEnabled], a ; enable transfer + call Delay3 + ld a, [wBattleType] + and a ; is it the Old Man battle? + jr z, .notOldManBattle +.oldManBattle + ld a, "▶" + Coorda 5, 4 ; place menu cursor in front of first menu entry + ld c, 80 + call DelayFrames + xor a + ld [wCurrentMenuItem], a + coord hl, 5, 4 + ld a, l + ld [wMenuCursorLocation], a + ld a, h + ld [wMenuCursorLocation + 1], a + jr .buttonAPressed +.notOldManBattle + call LoadGBPal + call HandleMenuInput + push af + call PlaceMenuCursor + pop af + bit 0, a ; was the A button pressed? + jp z, .checkOtherKeys +.buttonAPressed + ld a, [wCurrentMenuItem] + call PlaceUnfilledArrowMenuCursor + +; pointless because both values are overwritten before they are read + ld a, $01 + ld [wMenuExitMethod], a + ld [wChosenMenuItem], a + + xor a + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wCurrentMenuItem] + ld c, a + ld a, [wListScrollOffset] + add c + ld c, a + ld a, [wListCount] + and a ; is the list empty? + jp z, ExitListMenu ; if so, exit the menu + dec a + cp c ; did the player select Cancel? + jp c, ExitListMenu ; if so, exit the menu + ld a, c + ld [wWhichPokemon], a + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipMultiplying +; if it's an item menu + sla c ; item entries are 2 bytes long, so multiply by 2 +.skipMultiplying + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a + inc hl ; hl = beginning of list entries + ld b, 0 + add hl, bc + ld a, [hl] + ld [wcf91], a + ld a, [wListMenuID] + and a ; is it a PC pokemon list? + jr z, .pokemonList + push hl + call GetItemPrice + pop hl + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipGettingQuantity +; if it's an item menu + inc hl + ld a, [hl] ; a = item quantity + ld [wMaxItemQuantity], a +.skipGettingQuantity + ld a, [wcf91] + ld [wd0b5], a + ld a, BANK(ItemNames) + ld [wPredefBank], a + call GetName + jr .storeChosenEntry +.pokemonList + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld hl, wPartyMonNicks + jr z, .getPokemonName + ld hl, wBoxMonNicks ; box pokemon names +.getPokemonName + ld a, [wWhichPokemon] + call GetPartyMonName +.storeChosenEntry ; store the menu entry that the player chose and return + ld de, wcd6d + call CopyStringToCF4B ; copy name to wcf4b + ld a, CHOSE_MENU_ITEM + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + xor a + ld [hJoy7], a ; joypad state update flag + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay + jp BankswitchBack +.checkOtherKeys ; check B, SELECT, Up, and Down keys + bit 1, a ; was the B button pressed? + jp nz, ExitListMenu ; if so, exit the menu + bit 2, a ; was the select button pressed? + jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries + ld b, a + bit 7, b ; was Down pressed? + ld hl, wListScrollOffset + jr z, .upPressed +.downPressed + ld a, [hl] + add 3 + ld b, a + ld a, [wListCount] + cp b ; will going down scroll past the Cancel button? + jp c, DisplayListMenuIDLoop + inc [hl] ; if not, go down + jp DisplayListMenuIDLoop +.upPressed + ld a, [hl] + and a + jp z, DisplayListMenuIDLoop + dec [hl] + jp DisplayListMenuIDLoop + +DisplayChooseQuantityMenu:: +; text box dimensions/coordinates for just quantity + coord hl, 15, 9 + ld b, 1 ; height + ld c, 3 ; width + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .drawTextBox +; text box dimensions/coordinates for quantity and price + coord hl, 7, 9 + ld b, 1 ; height + ld c, 11 ; width +.drawTextBox + call TextBoxBorder + coord hl, 16, 10 + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printInitialQuantity + coord hl, 8, 10 +.printInitialQuantity + ld de, InitialQuantityText + call PlaceString + xor a + ld [wItemQuantity], a ; initialize current quantity to 0 + jp .incrementQuantity +.waitForKeyPressLoop + call JoypadLowSensitivity + ld a, [hJoyPressed] ; newly pressed buttons + bit 0, a ; was the A button pressed? + jp nz, .buttonAPressed + bit 1, a ; was the B button pressed? + jp nz, .buttonBPressed + bit 6, a ; was Up pressed? + jr nz, .incrementQuantity + bit 7, a ; was Down pressed? + jr nz, .decrementQuantity + jr .waitForKeyPressLoop +.incrementQuantity + ld a, [wMaxItemQuantity] + inc a + ld b, a + ld hl, wItemQuantity ; current quantity + inc [hl] + ld a, [hl] + cp b + jr nz, .handleNewQuantity +; wrap to 1 if the player goes above the max quantity + ld a, 1 + ld [hl], a + jr .handleNewQuantity +.decrementQuantity + ld hl, wItemQuantity ; current quantity + dec [hl] + jr nz, .handleNewQuantity +; wrap to the max quantity if the player goes below 1 + ld a, [wMaxItemQuantity] + ld [hl], a +.handleNewQuantity + coord hl, 17, 10 + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printQuantity +.printPrice + ld c, $03 + ld a, [wItemQuantity] + ld b, a + ld hl, hMoney ; total price +; initialize total price to 0 + xor a + ld [hli], a + ld [hli], a + ld [hl], a +.addLoop ; loop to multiply the individual price by the quantity to get the total price + ld de, hMoney + 2 + ld hl, hItemPrice + 2 + push bc + predef AddBCDPredef ; add the individual price to the current sum + pop bc + dec b + jr nz, .addLoop + ld a, [hHalveItemPrices] + and a ; should the price be halved (for selling items)? + jr z, .skipHalvingPrice + xor a + ld [hDivideBCDDivisor], a + ld [hDivideBCDDivisor + 1], a + ld a, $02 + ld [hDivideBCDDivisor + 2], a + predef DivideBCDPredef3 ; halves the price +; store the halved price + ld a, [hDivideBCDQuotient] + ld [hMoney], a + ld a, [hDivideBCDQuotient + 1] + ld [hMoney + 1], a + ld a, [hDivideBCDQuotient + 2] + ld [hMoney + 2], a +.skipHalvingPrice + coord hl, 12, 10 + ld de, SpacesBetweenQuantityAndPriceText + call PlaceString + ld de, hMoney ; total price + ld c, $a3 + call PrintBCDNumber + coord hl, 9, 10 +.printQuantity + ld de, wItemQuantity ; current quantity + lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits + call PrintNumber + jp .waitForKeyPressLoop +.buttonAPressed ; the player chose to make the transaction + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ret +.buttonBPressed ; the player chose to cancel the transaction + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld a, $ff + ret + +InitialQuantityText:: + db "×01@" + +SpacesBetweenQuantityAndPriceText:: + db " @" + +ExitListMenu:: + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + ld [wMenuWatchMovingOutOfBounds], a + xor a + ld [hJoy7], a + ld hl, wd730 + res 6, [hl] + call BankswitchBack + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + scf + ret + +PrintListMenuEntries:: + coord hl, 5, 3 + ld b, 9 + ld c, 14 + call ClearScreenArea + ld a, [wListPointer] + ld e, a + ld a, [wListPointer + 1] + ld d, a + inc de ; de = beginning of list entries + ld a, [wListScrollOffset] + ld c, a + ld a, [wListMenuID] + cp ITEMLISTMENU + ld a, c + jr nz, .skipMultiplying +; if it's an item menu +; item entries are 2 bytes long, so multiply by 2 + sla a + sla c +.skipMultiplying + add e + ld e, a + jr nc, .noCarry + inc d +.noCarry + coord hl, 6, 4 ; coordinates of first list entry name + ld b, 4 ; print 4 names +.loop + ld a, b + ld [wWhichPokemon], a + ld a, [de] + ld [wd11e], a + cp $ff + jp z, .printCancelMenuItem + push bc + push de + push hl + push hl + push de + ld a, [wListMenuID] + and a + jr z, .pokemonPCMenu + cp MOVESLISTMENU + jr z, .movesMenu +.itemMenu + call GetItemName + jr .placeNameString +.pokemonPCMenu + push hl + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld hl, wPartyMonNicks + jr z, .getPokemonName + ld hl, wBoxMonNicks ; box pokemon names +.getPokemonName + ld a, [wWhichPokemon] + ld b, a + ld a, 4 + sub b + ld b, a + ld a, [wListScrollOffset] + add b + call GetPartyMonName + pop hl + jr .placeNameString +.movesMenu + call GetMoveName +.placeNameString + call PlaceString + pop de + pop hl + ld a, [wPrintItemPrices] + and a ; should prices be printed? + jr z, .skipPrintingItemPrice +.printItemPrice + push hl + ld a, [de] + ld de, ItemPrices + ld [wcf91], a + call GetItemPrice ; get price + pop hl + ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right + add hl, bc + ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes + call PrintBCDNumber +.skipPrintingItemPrice + ld a, [wListMenuID] + and a + jr nz, .skipPrintingPokemonLevel +.printPokemonLevel + ld a, [wd11e] + push af + push hl + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld a, PLAYER_PARTY_DATA + jr z, .next + ld a, BOX_DATA +.next + ld [wMonDataLocation], a + ld hl, wWhichPokemon + ld a, [hl] + ld b, a + ld a, $04 + sub b + ld b, a + ld a, [wListScrollOffset] + add b + ld [hl], a + call LoadMonData + ld a, [wMonDataLocation] + and a ; is it a list of party pokemon or box pokemon? + jr z, .skipCopyingLevel +.copyLevel + ld a, [wLoadedMonBoxLevel] + ld [wLoadedMonLevel], a +.skipCopyingLevel + pop hl + ld bc, $001c + add hl, bc + call PrintLevel + pop af + ld [wd11e], a +.skipPrintingPokemonLevel + pop hl + pop de + inc de + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .nextListEntry +.printItemQuantity + ld a, [wd11e] + ld [wcf91], a + call IsKeyItem ; check if item is unsellable + ld a, [wIsKeyItem] + and a ; is the item unsellable? + jr nz, .skipPrintingItemQuantity ; if so, don't print the quantity + push hl + ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right + add hl, bc + ld a, "×" + ld [hli], a + ld a, [wd11e] + push af + ld a, [de] + ld [wMaxItemQuantity], a + push de + ld de, wd11e + ld [de], a + lb bc, 1, 2 + call PrintNumber + pop de + pop af + ld [wd11e], a + pop hl +.skipPrintingItemQuantity + inc de + pop bc + inc c + push bc + inc c + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + and a ; is an item being swapped? + jr z, .nextListEntry + sla a + cp c ; is it this item? + jr nz, .nextListEntry + dec hl + ld a, $ec ; unfilled right arrow menu cursor to indicate an item being swapped + ld [hli], a +.nextListEntry + ld bc, 2 * SCREEN_WIDTH ; 2 rows + add hl, bc + pop bc + inc c + dec b + jp nz, .loop + ld bc, -8 + add hl, bc + ld a, "▼" + ld [hl], a + ret +.printCancelMenuItem + ld de, ListMenuCancelText + jp PlaceString + +ListMenuCancelText:: + db "CANCEL@" diff --git a/home/move_mon.asm b/home/move_mon.asm new file mode 100644 index 00000000..e13ebf4e --- /dev/null +++ b/home/move_mon.asm @@ -0,0 +1,242 @@ +; Function to remove a pokemon from the party or the current box. +; wWhichPokemon determines the pokemon. +; [wRemoveMonFromBox] == 0 specifies the party. +; [wRemoveMonFromBox] != 0 specifies the current box. +RemovePokemon:: + jpab _RemovePokemon + +AddPartyMon:: + push hl + push de + push bc + callba _AddPartyMon + pop bc + pop de + pop hl + ret + +; calculates all 5 stats of current mon and writes them to [de] +CalcStats:: + ld c, $0 +.statsLoop + inc c + call CalcStat + ld a, [hMultiplicand+1] + ld [de], a + inc de + ld a, [hMultiplicand+2] + ld [de], a + inc de + ld a, c + cp NUM_STATS + jr nz, .statsLoop + ret + +; calculates stat c of current mon +; c: stat to calc (HP=1,Atk=2,Def=3,Spd=4,Spc=5) +; b: consider stat exp? +; hl: base ptr to stat exp values ([hl + 2*c - 1] and [hl + 2*c]) +CalcStat:: + push hl + push de + push bc + ld a, b + ld d, a + push hl + ld hl, wMonHeader + ld b, $0 + add hl, bc + ld a, [hl] ; read base value of stat + ld e, a + pop hl + push hl + sla c + ld a, d + and a + jr z, .statExpDone ; consider stat exp? + add hl, bc ; skip to corresponding stat exp value +.statExpLoop ; calculates ceil(Sqrt(stat exp)) in b + xor a + ld [hMultiplicand], a + ld [hMultiplicand+1], a + inc b ; increment current stat exp bonus + ld a, b + cp $ff + jr z, .statExpDone + ld [hMultiplicand+2], a + ld [hMultiplier], a + call Multiply + ld a, [hld] + ld d, a + ld a, [hProduct + 3] + sub d + ld a, [hli] + ld d, a + ld a, [hProduct + 2] + sbc d ; test if (current stat exp bonus)^2 < stat exp + jr c, .statExpLoop +.statExpDone + srl c + pop hl + push bc + ld bc, wPartyMon1DVs - (wPartyMon1HPExp - 1) ; also wEnemyMonDVs - wEnemyMonHP + add hl, bc + pop bc + ld a, c + cp $2 + jr z, .getAttackIV + cp $3 + jr z, .getDefenseIV + cp $4 + jr z, .getSpeedIV + cp $5 + jr z, .getSpecialIV +.getHpIV + push bc + ld a, [hl] ; Atk IV + swap a + and $1 + sla a + sla a + sla a + ld b, a + ld a, [hli] ; Def IV + and $1 + sla a + sla a + add b + ld b, a + ld a, [hl] ; Spd IV + swap a + and $1 + sla a + add b + ld b, a + ld a, [hl] ; Spc IV + and $1 + add b ; HP IV: LSB of the other 4 IVs + pop bc + jr .calcStatFromIV +.getAttackIV + ld a, [hl] + swap a + and $f + jr .calcStatFromIV +.getDefenseIV + ld a, [hl] + and $f + jr .calcStatFromIV +.getSpeedIV + inc hl + ld a, [hl] + swap a + and $f + jr .calcStatFromIV +.getSpecialIV + inc hl + ld a, [hl] + and $f +.calcStatFromIV + ld d, $0 + add e + ld e, a + jr nc, .noCarry + inc d ; de = Base + IV +.noCarry + sla e + rl d ; de = (Base + IV) * 2 + srl b + srl b ; b = ceil(Sqrt(stat exp)) / 4 + ld a, b + add e + jr nc, .noCarry2 + inc d ; de = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4 +.noCarry2 + ld [hMultiplicand+2], a + ld a, d + ld [hMultiplicand+1], a + xor a + ld [hMultiplicand], a + ld a, [wCurEnemyLVL] + ld [hMultiplier], a + call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level + ld a, [hMultiplicand] + ld [hDividend], a + ld a, [hMultiplicand+1] + ld [hDividend+1], a + ld a, [hMultiplicand+2] + ld [hDividend+2], a + ld a, $64 + ld [hDivisor], a + ld a, $3 + ld b, a + call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + ld a, c + cp $1 + ld a, 5 ; + 5 for non-HP stat + jr nz, .notHPStat + ld a, [wCurEnemyLVL] + ld b, a + ld a, [hMultiplicand+2] + add b + ld [hMultiplicand+2], a + jr nc, .noCarry3 + ld a, [hMultiplicand+1] + inc a + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level +.noCarry3 + ld a, 10 ; +10 for HP stat +.notHPStat + ld b, a + ld a, [hMultiplicand+2] + add b + ld [hMultiplicand+2], a + jr nc, .noCarry4 + ld a, [hMultiplicand+1] + inc a ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5 + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 +.noCarry4 + ld a, [hMultiplicand+1] ; check for overflow (>999) + cp 999 / $100 + 1 + jr nc, .overflow + cp 999 / $100 + jr c, .noOverflow + ld a, [hMultiplicand+2] + cp 999 % $100 + 1 + jr c, .noOverflow +.overflow + ld a, 999 / $100 ; overflow: cap at 999 + ld [hMultiplicand+1], a + ld a, 999 % $100 + ld [hMultiplicand+2], a +.noOverflow + pop bc + pop de + pop hl + ret + +AddEnemyMonToPlayerParty:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(_AddEnemyMonToPlayerParty) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call _AddEnemyMonToPlayerParty + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +MoveMon:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(_MoveMon) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call _MoveMon + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/names.asm b/home/names.asm new file mode 100644 index 00000000..cbc8910b --- /dev/null +++ b/home/names.asm @@ -0,0 +1,141 @@ +GetMonName:: + push hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(MonsterNames) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld a, [wd11e] + dec a + ld hl, MonsterNames + ld c, 10 + ld b, 0 + call AddNTimes + ld de, wcd6d + push de + ld bc, 10 + call CopyData + ld hl, wcd6d + 10 + ld [hl], "@" + pop de + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + pop hl + ret + +GetItemName:: +; given an item ID at [wd11e], store the name of the item into a string +; starting at wcd6d + push hl + push bc + ld a, [wd11e] + cp HM_01 ; is this a TM/HM? + jr nc, .Machine + + ld [wd0b5], a + ld a, ITEM_NAME + ld [wNameListType], a + ld a, BANK(ItemNames) + ld [wPredefBank], a + call GetName + jr .Finish + +.Machine + call GetMachineName +.Finish + ld de, wcd6d ; pointer to where item name is stored in RAM + pop bc + pop hl + ret + +GetMachineName:: +; copies the name of the TM/HM in [wd11e] to wcd6d + push hl + push de + push bc + ld a, [wd11e] + push af + cp TM_01 ; is this a TM? [not HM] + jr nc, .WriteTM +; if HM, then write "HM" and add 5 to the item ID, so we can reuse the +; TM printing code + add 5 + ld [wd11e], a + ld hl, HiddenPrefix ; points to "HM" + ld bc, 2 + jr .WriteMachinePrefix +.WriteTM + ld hl, TechnicalPrefix ; points to "TM" + ld bc, 2 +.WriteMachinePrefix + ld de, wcd6d + call CopyData + +; now get the machine number and convert it to text + ld a, [wd11e] + sub TM_01 - 1 + ld b, "0" +.FirstDigit + sub 10 + jr c, .SecondDigit + inc b + jr .FirstDigit +.SecondDigit + add 10 + push af + ld a, b + ld [de], a + inc de + pop af + ld b, "0" + add b + ld [de], a + inc de + ld a, "@" + ld [de], a + pop af + ld [wd11e], a + pop bc + pop de + pop hl + ret + +TechnicalPrefix:: + db "TM" +HiddenPrefix:: + db "HM" + +; sets carry if item is HM, clears carry if item is not HM +; Input: a = item ID +IsItemHM:: + cp HM_01 + jr c, .notHM + cp TM_01 + ret +.notHM + and a + ret + +; sets carry if move is an HM, clears carry if move is not an HM +; Input: a = move ID +IsMoveHM:: + ld hl, HMMoves + ld de, 1 + jp IsInArray + +HMMoves:: +INCLUDE "data/moves/hm_moves.asm" + +GetMoveName:: + push hl + ld a, MOVE_NAME + ld [wNameListType], a + ld a, [wd11e] + ld [wd0b5], a + ld a, BANK(MoveNames) + ld [wPredefBank], a + call GetName + ld de, wcd6d ; pointer to where move name is stored in RAM + pop hl + ret diff --git a/home/names2.asm b/home/names2.asm new file mode 100644 index 00000000..178a0780 --- /dev/null +++ b/home/names2.asm @@ -0,0 +1,93 @@ +NamePointers:: + dw MonsterNames + dw MoveNames + dw UnusedNames + dw ItemNames + dw wPartyMonOT ; player's OT names list + dw wEnemyMonOT ; enemy's OT names list + dw TrainerNames + +GetName:: +; arguments: +; [wd0b5] = which name +; [wNameListType] = which list +; [wPredefBank] = bank of list +; +; returns pointer to name in de + ld a, [wd0b5] + ld [wd11e], a + + ; TM names are separate from item names. + ; BUG: This applies to all names instead of just items. + cp HM_01 + jp nc, GetMachineName + + ld a, [hLoadedROMBank] + push af + push hl + push bc + push de + ld a, [wNameListType] ;List3759_entrySelector + dec a + jr nz, .otherEntries + ;1 = MON_NAMES + call GetMonName + ld hl, NAME_LENGTH + add hl, de + ld e, l + ld d, h + jr .gotPtr +.otherEntries + ;2-7 = OTHER ENTRIES + ld a, [wPredefBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld a, [wNameListType] ;VariousNames' entryID + dec a + add a + ld d, 0 + ld e, a + jr nc, .skip + inc d +.skip + ld hl, NamePointers + add hl, de + ld a, [hli] + ld [hSwapTemp + 1], a + ld a, [hl] + ld [hSwapTemp], a + ld a, [hSwapTemp] + ld h, a + ld a, [hSwapTemp + 1] + ld l, a + ld a, [wd0b5] + ld b, a + ld c, 0 +.nextName + ld d, h + ld e, l +.nextChar + ld a, [hli] + cp "@" + jr nz, .nextChar + inc c ;entry counter + ld a, b ;wanted entry + cp c + jr nz, .nextName + ld h, d + ld l, e + ld de, wcd6d + ld bc, $0014 + call CopyData +.gotPtr + ld a, e + ld [wUnusedCF8D], a + ld a, d + ld [wUnusedCF8D + 1], a + pop de + pop bc + pop hl + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/overworld_text.asm b/home/overworld_text.asm new file mode 100644 index 00000000..b32335f7 --- /dev/null +++ b/home/overworld_text.asm @@ -0,0 +1,31 @@ +TextScriptEndingChar:: + db "@" + +TextScriptEnd:: + ld hl, TextScriptEndingChar + ret + +ExclamationText:: + TX_FAR _ExclamationText + db "@" + +GroundRoseText:: + TX_FAR _GroundRoseText + db "@" + +BoulderText:: + TX_FAR _BoulderText + db "@" + +MartSignText:: + TX_FAR _MartSignText + db "@" + +PokeCenterSignText:: + TX_FAR _PokeCenterSignText + db "@" + +PickUpItemText:: + TX_ASM + predef PickUpItem + jp TextScriptEnd diff --git a/home/pokemon.asm b/home/pokemon.asm new file mode 100644 index 00000000..141baa65 --- /dev/null +++ b/home/pokemon.asm @@ -0,0 +1,464 @@ +DrawHPBar:: +; Draw an HP bar d tiles long, and fill it to e pixels. +; If c is nonzero, show at least a sliver regardless. +; The right end of the bar changes with [wHPBarType]. + + push hl + push de + push bc + + ; Left + ld a, $71 ; "HP:" + ld [hli], a + ld a, $62 + ld [hli], a + + push hl + + ; Middle + ld a, $63 ; empty +.draw + ld [hli], a + dec d + jr nz, .draw + + ; Right + ld a, [wHPBarType] + dec a + ld a, $6d ; status screen and battle + jr z, .ok + dec a ; pokemon menu +.ok + ld [hl], a + + pop hl + + ld a, e + and a + jr nz, .fill + + ; If c is nonzero, draw a pixel anyway. + ld a, c + and a + jr z, .done + ld e, 1 + +.fill + ld a, e + sub 8 + jr c, .partial + ld e, a + ld a, $6b ; full + ld [hli], a + ld a, e + and a + jr z, .done + jr .fill + +.partial + ; Fill remaining pixels at the end if necessary. + ld a, $63 ; empty + add e + ld [hl], a +.done + pop bc + pop de + pop hl + ret + + +; loads pokemon data from one of multiple sources to wLoadedMon +; loads base stats to wMonHeader +; INPUT: +; [wWhichPokemon] = index of pokemon within party/box +; [wMonDataLocation] = source +; 00: player's party +; 01: enemy's party +; 02: current box +; 03: daycare +; OUTPUT: +; [wcf91] = pokemon ID +; wLoadedMon = base address of pokemon data +; wMonHeader = base address of base stats +LoadMonData:: + jpab LoadMonData_ + +OverwritewMoves:: +; Write c to [wMoves + b]. Unused. + ld hl, wMoves + ld e, b + ld d, 0 + add hl, de + ld a, c + ld [hl], a + ret + +LoadFlippedFrontSpriteByMonIndex:: + ld a, 1 + ld [wSpriteFlipped], a + +LoadFrontSpriteByMonIndex:: + push hl + ld a, [wd11e] + push af + ld a, [wcf91] + ld [wd11e], a + predef IndexToPokedex + ld hl, wd11e + ld a, [hl] + pop bc + ld [hl], b + and a + pop hl + jr z, .invalidDexNumber ; dex #0 invalid + cp NUM_POKEMON + 1 + jr c, .validDexNumber ; dex >#151 invalid +.invalidDexNumber + ld a, RHYDON ; $1 + ld [wcf91], a + ret +.validDexNumber + push hl + ld de, vFrontPic + call LoadMonFrontSprite + pop hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(CopyUncompressedPicToHL) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + xor a + ld [hStartTileID], a + call CopyUncompressedPicToHL + xor a + ld [wSpriteFlipped], a + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + + +PlayCry:: +; Play monster a's cry. + call GetCryData + call PlaySound + jp WaitForSoundToFinish + +GetCryData:: +; Load cry data for monster a. + dec a + ld c, a + ld b, 0 + ld hl, CryData + add hl, bc + add hl, bc + add hl, bc + + ld a, BANK(CryData) + call BankswitchHome + ld a, [hli] + ld b, a ; cry id + ld a, [hli] + ld [wFrequencyModifier], a + ld a, [hl] + ld [wTempoModifier], a + call BankswitchBack + + ; Cry headers have 3 channels, + ; and start from index CRY_SFX_START, + ; so add 3 times the cry id. + ld a, b + ld c, CRY_SFX_START + rlca ; * 2 + add b + add c + ret + +DisplayPartyMenu:: + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + call GBPalWhiteOutWithDelay3 + call ClearSprites + call PartyMenuInit + call DrawPartyMenu + jp HandlePartyMenuInput + +GoBackToPartyMenu:: + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + call PartyMenuInit + call RedrawPartyMenu + jp HandlePartyMenuInput + +PartyMenuInit:: + ld a, 1 ; hardcoded bank + call BankswitchHome + call LoadHpBarAndStatusTilePatterns + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a + ld [wMenuWatchMovingOutOfBounds], a + ld hl, wTopMenuItemY + inc a + ld [hli], a ; top menu item Y + xor a + ld [hli], a ; top menu item X + ld a, [wPartyAndBillsPCSavedMenuItem] + push af + ld [hli], a ; current menu item ID + inc hl + ld a, [wPartyCount] + and a ; are there more than 0 pokemon in the party? + jr z, .storeMaxMenuItemID + dec a +; if party is not empty, the max menu item ID is ([wPartyCount] - 1) +; otherwise, it is 0 +.storeMaxMenuItemID + ld [hli], a ; max menu item ID + ld a, [wForcePlayerToChooseMon] + and a + ld a, A_BUTTON | B_BUTTON + jr z, .next + xor a + ld [wForcePlayerToChooseMon], a + inc a ; a = A_BUTTON +.next + ld [hli], a ; menu watched keys + pop af + ld [hl], a ; old menu item ID + ret + +HandlePartyMenuInput:: + ld a, 1 + ld [wMenuWrappingEnabled], a + ld a, $40 + ld [wPartyMenuAnimMonEnabled], a + call HandleMenuInput_ + call PlaceUnfilledArrowMenuCursor + ld b, a + xor a + ld [wPartyMenuAnimMonEnabled], a + ld a, [wCurrentMenuItem] + ld [wPartyAndBillsPCSavedMenuItem], a + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay + ld a, [wMenuItemToSwap] + and a + jp nz, .swappingPokemon + pop af + ld [hTilesetType], a + bit 1, b + jr nz, .noPokemonChosen + ld a, [wPartyCount] + and a + jr z, .noPokemonChosen + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + ld hl, wPartySpecies + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wcf91], a + ld [wBattleMonSpecies2], a + call BankswitchBack + and a + ret +.noPokemonChosen + call BankswitchBack + scf + ret +.swappingPokemon + bit 1, b ; was the B button pressed? + jr z, .handleSwap ; if not, handle swapping the pokemon +.cancelSwap ; if the B button was pressed + callba ErasePartyMenuCursors + xor a + ld [wMenuItemToSwap], a + ld [wPartyMenuTypeOrMessageID], a + call RedrawPartyMenu + jr HandlePartyMenuInput +.handleSwap + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + callba SwitchPartyMon + jr HandlePartyMenuInput + +DrawPartyMenu:: + ld hl, DrawPartyMenu_ + jr DrawPartyMenuCommon + +RedrawPartyMenu:: + ld hl, RedrawPartyMenu_ + +DrawPartyMenuCommon:: + ld b, BANK(RedrawPartyMenu_) + jp Bankswitch + +; prints a pokemon's status condition +; INPUT: +; de = address of status condition +; hl = destination address +PrintStatusCondition:: + push de + dec de + dec de ; de = address of current HP + ld a, [de] + ld b, a + dec de + ld a, [de] + or b ; is the pokemon's HP zero? + pop de + jr nz, PrintStatusConditionNotFainted +; if the pokemon's HP is 0, print "FNT" + ld a, "F" + ld [hli], a + ld a, "N" + ld [hli], a + ld [hl], "T" + and a + ret + +PrintStatusConditionNotFainted:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(PrintStatusAilment) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call PrintStatusAilment ; print status condition + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +; function to print pokemon level, leaving off the ":L" if the level is at least 100 +; INPUT: +; hl = destination address +; [wLoadedMonLevel] = level +PrintLevel:: + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 2 ; number of digits + ld a, [wLoadedMonLevel] ; level + cp 100 + jr c, PrintLevelCommon +; if level at least 100, write over the ":L" tile + dec hl + inc c ; increment number of digits to 3 + jr PrintLevelCommon + +; prints the level without leaving off ":L" regardless of level +; INPUT: +; hl = destination address +; [wLoadedMonLevel] = level +PrintLevelFull:: + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 3 ; number of digits + ld a, [wLoadedMonLevel] ; level + +PrintLevelCommon:: + ld [wd11e], a + ld de, wd11e + ld b, LEFT_ALIGN | 1 ; 1 byte + jp PrintNumber + +GetwMoves:: +; Unused. Returns the move at index a from wMoves in a + ld hl, wMoves + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] + ret + +; copies the base stat data of a pokemon to wMonHeader +; INPUT: +; [wd0b5] = pokemon ID +GetMonHeader:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(BaseStats) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + push bc + push de + push hl + ld a, [wd11e] + push af + ld a, [wd0b5] + ld [wd11e], a + ld de, FossilKabutopsPic + ld b, $66 ; size of Kabutops fossil and Ghost sprites + cp FOSSIL_KABUTOPS ; Kabutops fossil + jr z, .specialID + ld de, GhostPic + cp MON_GHOST ; Ghost + jr z, .specialID + ld de, FossilAerodactylPic + ld b, $77 ; size of Aerodactyl fossil sprite + cp FOSSIL_AERODACTYL ; Aerodactyl fossil + jr z, .specialID + cp MEW + jr z, .mew + predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number + ld a, [wd11e] + dec a + ld bc, MonBaseStatsEnd - MonBaseStats + ld hl, BaseStats + call AddNTimes + ld de, wMonHeader + ld bc, MonBaseStatsEnd - MonBaseStats + call CopyData + jr .done +.specialID + ld hl, wMonHSpriteDim + ld [hl], b ; write sprite dimensions + inc hl + ld [hl], e ; write front sprite pointer + inc hl + ld [hl], d + jr .done +.mew + ld hl, MewBaseStats + ld de, wMonHeader + ld bc, MonBaseStatsEnd - MonBaseStats + ld a, BANK(MewBaseStats) + call FarCopyData +.done + ld a, [wd0b5] + ld [wMonHIndex], a + pop af + ld [wd11e], a + pop hl + pop de + pop bc + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +; copy party pokemon's name to wcd6d +GetPartyMonName2:: + ld a, [wWhichPokemon] ; index within party + ld hl, wPartyMonNicks + +; this is called more often +GetPartyMonName:: + push hl + push bc + call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times + ld de, wcd6d + push de + ld bc, NAME_LENGTH + call CopyData + pop de + pop bc + pop hl + ret diff --git a/home/predef_text.asm b/home/predef_text.asm new file mode 100644 index 00000000..24001c24 --- /dev/null +++ b/home/predef_text.asm @@ -0,0 +1,237 @@ +; this function is used to display sign messages, sprite dialog, etc. +; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID +DisplayTextID:: + ld a, [hLoadedROMBank] + push af + callba DisplayTextIDInit ; initialization + ld hl, wTextPredefFlag + bit 0, [hl] + res 0, [hl] + jr nz, .skipSwitchToMapBank + ld a, [wCurMap] + call SwitchToMapRomBank +.skipSwitchToMapBank + ld a, 30 ; half a second + ld [hFrameCounter], a ; used as joypad poll timer + ld hl, wMapTextPtr + ld a, [hli] + ld h, [hl] + ld l, a ; hl = map text pointer + ld d, $00 + ld a, [hSpriteIndexOrTextID] ; text ID + ld [wSpriteIndex], a + and a + jp z, DisplayStartMenu + cp TEXT_SAFARI_GAME_OVER + jp z, DisplaySafariGameOverText + cp TEXT_MON_FAINTED + jp z, DisplayPokemonFaintedText + cp TEXT_BLACKED_OUT + jp z, DisplayPlayerBlackedOutText + cp TEXT_REPEL_WORE_OFF + jp z, DisplayRepelWoreOffText + ld a, [wNumSprites] + ld e, a + ld a, [hSpriteIndexOrTextID] ; sprite ID + cp e + jr z, .spriteHandling + jr nc, .skipSpriteHandling +.spriteHandling +; get the text ID of the sprite + push hl + push de + push bc + callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) + pop bc + pop de + ld hl, wMapSpriteData ; NPC text entries + ld a, [hSpriteIndexOrTextID] + dec a + add a + add l + ld l, a + jr nc, .noCarry + inc h +.noCarry + inc hl + ld a, [hl] ; a = text ID of the sprite + pop hl +.skipSpriteHandling +; look up the address of the text in the map's text entries + dec a + ld e, a + sla e + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a ; hl = address of the text + ld a, [hl] ; a = first byte of text +; check first byte of text for special cases + cp $fe ; Pokemart NPC + jp z, DisplayPokemartDialogue + cp $ff ; Pokemon Center NPC + jp z, DisplayPokemonCenterDialogue + cp $fc ; Item Storage PC + jp z, FuncTX_ItemStoragePC + cp $fd ; Bill's PC + jp z, FuncTX_BillsPC + cp $f9 ; Pokemon Center PC + jp z, FuncTX_PokemonCenterPC + cp $f5 ; Vending Machine + jr nz, .notVendingMachine + callba VendingMachineMenu ; jump banks to vending machine routine + jr AfterDisplayingTextID +.notVendingMachine + cp $f7 ; prize menu + jp z, FuncTX_GameCornerPrizeMenu + cp $f6 ; cable connection NPC in Pokemon Center + jr nz, .notSpecialCase + callab CableClubNPC + jr AfterDisplayingTextID +.notSpecialCase + call PrintText_NoCreatingTextBox ; display the text + ld a, [wDoNotWaitForButtonPressAfterDisplayingText] + and a + jr nz, HoldTextDisplayOpen + +AfterDisplayingTextID:: + ld a, [wEnteringCableClub] + and a + jr nz, HoldTextDisplayOpen + call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text + +; loop to hold the dialogue box open as long as the player keeps holding down the A button +HoldTextDisplayOpen:: + call Joypad + ld a, [hJoyHeld] + bit 0, a ; is the A button being pressed? + jr nz, HoldTextDisplayOpen + +CloseTextDisplay:: + ld a, [wCurMap] + call SwitchToMapRomBank + ld a, $90 + ld [hWY], a ; move the window off the screen + call DelayFrame + call LoadGBPal + xor a + ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank +; loop to make sprites face the directions they originally faced before the dialogue + ld hl, wSpriteStateData2 + $19 + ld c, $0f + ld de, $0010 +.restoreSpriteFacingDirectionLoop + ld a, [hl] + dec h + ld [hl], a + inc h + add hl, de + dec c + jr nz, .restoreSpriteFacingDirectionLoop + ld a, BANK(InitMapSprites) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) + ld hl, wFontLoaded + res 0, [hl] + ld a, [wd732] + bit 3, a ; used fly warp + call z, LoadPlayerSpriteGraphics + call LoadCurrentMapView + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp UpdateSprites + +DisplayPokemartDialogue:: + push hl + ld hl, PokemartGreetingText + call PrintText + pop hl + inc hl + call LoadItemList + ld a, PRICEDITEMLISTMENU + ld [wListMenuID], a + ld a, [hLoadedROMBank] + push af + ld a, BANK(DisplayPokemartDialogue_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call DisplayPokemartDialogue_ + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp AfterDisplayingTextID + +PokemartGreetingText:: + TX_FAR _PokemartGreetingText + db "@" + +LoadItemList:: + ld a, 1 + ld [wUpdateSpritesEnabled], a + ld a, h + ld [wItemListPointer], a + ld a, l + ld [wItemListPointer + 1], a + ld de, wItemList +.loop + ld a, [hli] + ld [de], a + inc de + cp $ff + jr nz, .loop + ret + +DisplayPokemonCenterDialogue:: +; zeroing these doesn't appear to serve any purpose + xor a + ld [hItemPrice], a + ld [hItemPrice + 1], a + ld [hItemPrice + 2], a + + inc hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(DisplayPokemonCenterDialogue_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call DisplayPokemonCenterDialogue_ + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp AfterDisplayingTextID + +DisplaySafariGameOverText:: + callab PrintSafariGameOverText + jp AfterDisplayingTextID + +DisplayPokemonFaintedText:: + ld hl, PokemonFaintedText + call PrintText + jp AfterDisplayingTextID + +PokemonFaintedText:: + TX_FAR _PokemonFaintedText + db "@" + +DisplayPlayerBlackedOutText:: + ld hl, PlayerBlackedOutText + call PrintText + ld a, [wd732] + res 5, a ; reset forced to use bike bit + ld [wd732], a + jp HoldTextDisplayOpen + +PlayerBlackedOutText:: + TX_FAR _PlayerBlackedOutText + db "@" + +DisplayRepelWoreOffText:: + ld hl, RepelWoreOffText + call PrintText + jp AfterDisplayingTextID + +RepelWoreOffText:: + TX_FAR _RepelWoreOffText + db "@" diff --git a/home/print_bcd.asm b/home/print_bcd.asm new file mode 100644 index 00000000..38aedd3c --- /dev/null +++ b/home/print_bcd.asm @@ -0,0 +1,77 @@ +; function to print a BCD (Binary-coded decimal) number +; de = address of BCD number +; hl = destination address +; c = flags and length +; bit 7: if set, do not print leading zeroes +; if unset, print leading zeroes +; bit 6: if set, left-align the string (do not pad empty digits with spaces) +; if unset, right-align the string +; bit 5: if set, print currency symbol at the beginning of the string +; if unset, do not print the currency symbol +; bits 0-4: length of BCD number in bytes +; Note that bits 5 and 7 are modified during execution. The above reflects +; their meaning at the beginning of the functions's execution. +PrintBCDNumber:: + ld b, c ; save flags in b + res 7, c + res 6, c + res 5, c ; c now holds the length + bit 5, b + jr z, .loop + bit 7, b + jr nz, .loop + ld [hl], "¥" + inc hl +.loop + ld a, [de] + swap a + call PrintBCDDigit ; print upper digit + ld a, [de] + call PrintBCDDigit ; print lower digit + inc de + dec c + jr nz, .loop + bit 7, b ; were any non-zero digits printed? + jr z, .done ; if so, we are done +.numberEqualsZero ; if every digit of the BCD number is zero + bit 6, b ; left or right alignment? + jr nz, .skipRightAlignmentAdjustment + dec hl ; if the string is right-aligned, it needs to be moved back one space +.skipRightAlignmentAdjustment + bit 5, b + jr z, .skipCurrencySymbol + ld [hl], "¥" + inc hl +.skipCurrencySymbol + ld [hl], "0" + call PrintLetterDelay + inc hl +.done + ret + +PrintBCDDigit:: + and $f + and a + jr z, .zeroDigit +.nonzeroDigit + bit 7, b ; have any non-space characters been printed? + jr z, .outputDigit +; if bit 7 is set, then no numbers have been printed yet + bit 5, b ; print the currency symbol? + jr z, .skipCurrencySymbol + ld [hl], "¥" + inc hl + res 5, b +.skipCurrencySymbol + res 7, b ; unset 7 to indicate that a nonzero digit has been reached +.outputDigit + add "0" + ld [hli], a + jp PrintLetterDelay +.zeroDigit + bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + jr z, .outputDigit ; if so, print a zero digit + bit 6, b ; left or right alignment? + ret nz + inc hl ; if right-aligned, "print" a space by advancing the pointer + ret diff --git a/home/print_num.asm b/home/print_num.asm new file mode 100644 index 00000000..5155977b --- /dev/null +++ b/home/print_num.asm @@ -0,0 +1,217 @@ +PrintNumber:: +; Print the c-digit, b-byte value at de. +; Allows 2 to 7 digits. For 1-digit numbers, add +; the value to char "0" instead of calling PrintNumber. +; Flags LEADING_ZEROES and LEFT_ALIGN can be given +; in bits 7 and 6 of b respectively. + push bc + xor a + ld [hPastLeadingZeros], a + ld [hNumToPrint], a + ld [hNumToPrint + 1], a + ld a, b + and $f + cp 1 + jr z, .byte + cp 2 + jr z, .word +.long + ld a, [de] + ld [hNumToPrint], a + inc de + ld a, [de] + ld [hNumToPrint + 1], a + inc de + ld a, [de] + ld [hNumToPrint + 2], a + jr .start + +.word + ld a, [de] + ld [hNumToPrint + 1], a + inc de + ld a, [de] + ld [hNumToPrint + 2], a + jr .start + +.byte + ld a, [de] + ld [hNumToPrint + 2], a + +.start + push de + + ld d, b + ld a, c + ld b, a + xor a + ld c, a + ld a, b + + cp 2 + jr z, .tens + cp 3 + jr z, .hundreds + cp 4 + jr z, .thousands + cp 5 + jr z, .ten_thousands + cp 6 + jr z, .hundred_thousands + +print_digit: macro + +if (\1) / $10000 + ld a, \1 / $10000 % $100 +else xor a +endc + ld [hPowerOf10 + 0], a + +if (\1) / $100 + ld a, \1 / $100 % $100 +else xor a +endc + ld [hPowerOf10 + 1], a + + ld a, \1 / $1 % $100 + ld [hPowerOf10 + 2], a + + call .PrintDigit + call .NextDigit +endm + +.millions print_digit 1000000 +.hundred_thousands print_digit 100000 +.ten_thousands print_digit 10000 +.thousands print_digit 1000 +.hundreds print_digit 100 + +.tens + ld c, 0 + ld a, [hNumToPrint + 2] +.mod + cp 10 + jr c, .ok + sub 10 + inc c + jr .mod +.ok + + ld b, a + ld a, [hPastLeadingZeros] + or c + ld [hPastLeadingZeros], a + jr nz, .past + call .PrintLeadingZero + jr .next +.past + ld a, "0" + add c + ld [hl], a +.next + + call .NextDigit +.ones + ld a, "0" + add b + ld [hli], a + pop de + dec de + pop bc + ret + +.PrintDigit: +; Divide by the current decimal place. +; Print the quotient, and keep the modulus. + ld c, 0 +.loop + ld a, [hPowerOf10] + ld b, a + ld a, [hNumToPrint] + ld [hSavedNumToPrint], a + cp b + jr c, .underflow0 + sub b + ld [hNumToPrint], a + ld a, [hPowerOf10 + 1] + ld b, a + ld a, [hNumToPrint + 1] + ld [hSavedNumToPrint + 1], a + cp b + jr nc, .noborrow1 + + ld a, [hNumToPrint] + or 0 + jr z, .underflow1 + dec a + ld [hNumToPrint], a + ld a, [hNumToPrint + 1] +.noborrow1 + + sub b + ld [hNumToPrint + 1], a + ld a, [hPowerOf10 + 2] + ld b, a + ld a, [hNumToPrint + 2] + ld [hSavedNumToPrint + 2], a + cp b + jr nc, .noborrow2 + + ld a, [hNumToPrint + 1] + and a + jr nz, .borrowed + + ld a, [hNumToPrint] + and a + jr z, .underflow2 + dec a + ld [hNumToPrint], a + xor a +.borrowed + + dec a + ld [hNumToPrint + 1], a + ld a, [hNumToPrint + 2] +.noborrow2 + sub b + ld [hNumToPrint + 2], a + inc c + jr .loop + +.underflow2 + ld a, [hSavedNumToPrint + 1] + ld [hNumToPrint + 1], a +.underflow1 + ld a, [hSavedNumToPrint] + ld [hNumToPrint], a +.underflow0 + ld a, [hPastLeadingZeros] + or c + jr z, .PrintLeadingZero + + ld a, "0" + add c + ld [hl], a + ld [hPastLeadingZeros], a + ret + +.PrintLeadingZero: + bit BIT_LEADING_ZEROES, d + ret z + ld [hl], "0" + ret + +.NextDigit: +; Increment unless the number is left-aligned, +; leading zeroes are not printed, and no digits +; have been printed yet. + bit BIT_LEADING_ZEROES, d + jr nz, .inc + bit BIT_LEFT_ALIGN, d + jr z, .inc + ld a, [hPastLeadingZeros] + and a + ret z +.inc + inc hl + ret diff --git a/home/trainers.asm b/home/trainers.asm new file mode 100644 index 00000000..9c3519a2 --- /dev/null +++ b/home/trainers.asm @@ -0,0 +1,436 @@ +; stores hl in [wTrainerHeaderPtr] +StoreTrainerHeaderPointer:: + ld a, h + ld [wTrainerHeaderPtr], a + ld a, l + ld [wTrainerHeaderPtr+1], a + ret + +; executes the current map script from the function pointer array provided in hl. +; a: map script index to execute (unless overridden by [wd733] bit 4) +ExecuteCurMapScriptInTable:: + push af + push de + call StoreTrainerHeaderPointer + pop hl + pop af + push hl + ld hl, wFlags_D733 + bit 4, [hl] + res 4, [hl] + jr z, .useProvidedIndex ; test if map script index was overridden manually + ld a, [wCurMapScript] +.useProvidedIndex + pop hl + ld [wCurMapScript], a + call CallFunctionInTable + ld a, [wCurMapScript] + ret + +LoadGymLeaderAndCityName:: + push de + ld de, wGymCityName + ld bc, $11 + call CopyData ; load city name + pop hl + ld de, wGymLeaderName + ld bc, NAME_LENGTH + jp CopyData ; load gym leader name + +; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) +; a: offset in header data +; 0 -> flag's bit (into wTrainerHeaderFlagBit) +; 2 -> flag's byte ptr (into hl) +; 4 -> before battle text (into hl) +; 6 -> after battle text (into hl) +; 8 -> end battle text (into hl) +ReadTrainerHeaderInfo:: + push de + push af + ld d, $0 + ld e, a + ld hl, wTrainerHeaderPtr + ld a, [hli] + ld l, [hl] + ld h, a + add hl, de + pop af + and a + jr nz, .nonZeroOffset + ld a, [hl] + ld [wTrainerHeaderFlagBit], a ; store flag's bit + jr .done +.nonZeroOffset + cp $2 + jr z, .readPointer ; read flag's byte ptr + cp $4 + jr z, .readPointer ; read before battle text + cp $6 + jr z, .readPointer ; read after battle text + cp $8 + jr z, .readPointer ; read end battle text + cp $a + jr nz, .done + ld a, [hli] ; read end battle text (2) but override the result afterwards (XXX why, bug?) + ld d, [hl] + ld e, a + jr .done +.readPointer + ld a, [hli] + ld h, [hl] + ld l, a +.done + pop de + ret + +TrainerFlagAction:: + predef_jump FlagActionPredef + +TalkToTrainer:: + call StoreTrainerHeaderPointer + xor a + call ReadTrainerHeaderInfo ; read flag's bit + ld a, $2 + call ReadTrainerHeaderInfo ; read flag's byte ptr + ld a, [wTrainerHeaderFlagBit] + ld c, a + ld b, FLAG_TEST + call TrainerFlagAction ; read trainer's flag + ld a, c + and a + jr z, .trainerNotYetFought ; test trainer's flag + ld a, $6 + call ReadTrainerHeaderInfo ; print after battle text + jp PrintText +.trainerNotYetFought + ld a, $4 + call ReadTrainerHeaderInfo ; print before battle text + call PrintText + ld a, $a + call ReadTrainerHeaderInfo ; (?) does nothing apparently (maybe bug in ReadTrainerHeaderInfo) + push de + ld a, $8 + call ReadTrainerHeaderInfo ; read end battle text + pop de + call SaveEndBattleTextPointers + ld hl, wFlags_D733 + set 4, [hl] ; activate map script index override (index is set below) + ld hl, wFlags_0xcd60 + bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) + ret nz +; if the player talked to the trainer of his own volition + call EngageMapTrainer + ld hl, wCurMapScript + inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) + jp StartTrainerBattle + +; checks if any trainers are seeing the player and wanting to fight +CheckFightingMapTrainers:: + call CheckForEngagingTrainers + ld a, [wSpriteIndex] + cp $ff + jr nz, .trainerEngaging + xor a + ld [wSpriteIndex], a + ld [wTrainerHeaderFlagBit], a + ret +.trainerEngaging + ld hl, wFlags_D733 + set 3, [hl] + ld [wEmotionBubbleSpriteIndex], a + xor a ; EXCLAMATION_BUBBLE + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN + ld [wJoyIgnore], a + xor a + ld [hJoyHeld], a + call TrainerWalkUpToPlayer_Bank0 + ld hl, wCurMapScript + inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) + ret + +; display the before battle text after the enemy trainer has walked up to the player's sprite +DisplayEnemyTrainerTextAndStartBattle:: + ld a, [wd730] + and $1 + ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite + ld [wJoyIgnore], a + ld a, [wSpriteIndex] + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ; fall through + +StartTrainerBattle:: + xor a + ld [wJoyIgnore], a + call InitBattleEnemyParameters + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, wd72e + set 1, [hl] + ld hl, wCurMapScript + inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) + ret + +EndTrainerBattle:: + ld hl, wCurrentMapScriptFlags + set 5, [hl] + set 6, [hl] + ld hl, wd72d + res 7, [hl] + ld hl, wFlags_0xcd60 + res 0, [hl] ; player is no longer engaged by any trainer + ld a, [wIsInBattle] + cp $ff + jp z, ResetButtonPressedAndMapScript + ld a, $2 + call ReadTrainerHeaderInfo + ld a, [wTrainerHeaderFlagBit] + ld c, a + ld b, FLAG_SET + call TrainerFlagAction ; flag trainer as fought + ld a, [wEnemyMonOrTrainerClass] + cp OPP_ID_OFFSET + jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + ld hl, wMissableObjectList + ld de, $2 + ld a, [wSpriteIndex] + call IsInArray ; search for sprite ID + inc hl + ld a, [hl] + ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it + predef HideObject +.skipRemoveSprite + ld hl, wd730 + bit 4, [hl] + res 4, [hl] + ret nz + +ResetButtonPressedAndMapScript:: + xor a + ld [wJoyIgnore], a + ld [hJoyHeld], a + ld [hJoyPressed], a + ld [hJoyReleased], a + ld [wCurMapScript], a ; reset battle status + ret + +; calls TrainerWalkUpToPlayer +TrainerWalkUpToPlayer_Bank0:: + jpba TrainerWalkUpToPlayer + +; sets opponent type and mon set/lvl based on the engaging trainer data +InitBattleEnemyParameters:: + ld a, [wEngagedTrainerClass] + ld [wCurOpponent], a + ld [wEnemyMonOrTrainerClass], a + cp OPP_ID_OFFSET + ld a, [wEngagedTrainerSet] + jr c, .noTrainer + ld [wTrainerNo], a + ret +.noTrainer + ld [wCurEnemyLVL], a + ret + +GetSpritePosition1:: + ld hl, _GetSpritePosition1 + jr SpritePositionBankswitch + +GetSpritePosition2:: + ld hl, _GetSpritePosition2 + jr SpritePositionBankswitch + +SetSpritePosition1:: + ld hl, _SetSpritePosition1 + jr SpritePositionBankswitch + +SetSpritePosition2:: + ld hl, _SetSpritePosition2 +SpritePositionBankswitch:: + ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2) + jp Bankswitch ; indirect jump to one of the four functions + +CheckForEngagingTrainers:: + xor a + call ReadTrainerHeaderInfo ; read trainer flag's bit (unused) + ld d, h ; store trainer header address in de + ld e, l +.trainerLoop + call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer + ld a, [de] + ld [wSpriteIndex], a ; store trainer flag's bit + ld [wTrainerHeaderFlagBit], a + cp $ff + ret z + ld a, $2 + call ReadTrainerHeaderInfo ; read trainer flag's byte ptr + ld b, FLAG_TEST + ld a, [wTrainerHeaderFlagBit] + ld c, a + call TrainerFlagAction ; read trainer flag + ld a, c + and a ; has the trainer already been defeated? + jr nz, .continue + push hl + push de + push hl + xor a + call ReadTrainerHeaderInfo ; get trainer header pointer + inc hl + ld a, [hl] ; read trainer engage distance + pop hl + ld [wTrainerEngageDistance], a + ld a, [wSpriteIndex] + swap a + ld [wTrainerSpriteOffset], a + predef TrainerEngage + pop de + pop hl + ld a, [wTrainerSpriteOffset] + and a + ret nz ; break if the trainer is engaging +.continue + ld hl, $c + add hl, de + ld d, h + ld e, l + jr .trainerLoop + +; hl = text if the player wins +; de = text if the player loses +SaveEndBattleTextPointers:: + ld a, [hLoadedROMBank] + ld [wEndBattleTextRomBank], a + ld a, h + ld [wEndBattleWinTextPointer], a + ld a, l + ld [wEndBattleWinTextPointer + 1], a + ld a, d + ld [wEndBattleLoseTextPointer], a + ld a, e + ld [wEndBattleLoseTextPointer + 1], a + ret + +; loads data of some trainer on the current map and plays pre-battle music +; [wSpriteIndex]: sprite ID of trainer who is engaged +EngageMapTrainer:: + ld hl, wMapSpriteExtraData + ld d, $0 + ld a, [wSpriteIndex] + dec a + add a + ld e, a + add hl, de ; seek to engaged trainer data + ld a, [hli] ; load trainer class + ld [wEngagedTrainerClass], a + ld a, [hl] ; load trainer mon set + ld [wEngagedTrainerSet], a + jp PlayTrainerMusic + +PrintEndBattleText:: + push hl + ld hl, wd72d + bit 7, [hl] + res 7, [hl] + pop hl + ret z + ld a, [hLoadedROMBank] + push af + ld a, [wEndBattleTextRomBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + push hl + callba SaveTrainerName + ld hl, TrainerEndBattleText + call PrintText + pop hl + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + callba FreezeEnemyTrainerSprite + jp WaitForSoundToFinish + +GetSavedEndBattleTextPointer:: + ld a, [wBattleResult] + and a +; won battle + jr nz, .lostBattle + ld a, [wEndBattleWinTextPointer] + ld h, a + ld a, [wEndBattleWinTextPointer + 1] + ld l, a + ret +.lostBattle + ld a, [wEndBattleLoseTextPointer] + ld h, a + ld a, [wEndBattleLoseTextPointer + 1] + ld l, a + ret + +TrainerEndBattleText:: + TX_FAR _TrainerNameText + TX_ASM + call GetSavedEndBattleTextPointer + call TextCommandProcessor + jp TextScriptEnd + +; only engage with the trainer if the player is not already +; engaged with another trainer +; XXX unused? +CheckIfAlreadyEngaged:: + ld a, [wFlags_0xcd60] + bit 0, a + ret nz + call EngageMapTrainer + xor a + ret + +PlayTrainerMusic:: + ld a, [wEngagedTrainerClass] + cp OPP_SONY1 + ret z + cp OPP_SONY2 + ret z + cp OPP_SONY3 + ret z + ld a, [wGymLeaderNo] + and a + ret nz + xor a + ld [wAudioFadeOutControl], a + ld a, SFX_STOP_ALL_MUSIC + call PlaySound + ld a, BANK(Music_MeetEvilTrainer) + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + ld a, [wEngagedTrainerClass] + ld b, a + ld hl, EvilTrainerList +.evilTrainerListLoop + ld a, [hli] + cp $ff + jr z, .noEvilTrainer + cp b + jr nz, .evilTrainerListLoop + ld a, MUSIC_MEET_EVIL_TRAINER + jr .PlaySound +.noEvilTrainer + ld hl, FemaleTrainerList +.femaleTrainerListLoop + ld a, [hli] + cp $ff + jr z, .maleTrainer + cp b + jr nz, .femaleTrainerListLoop + ld a, MUSIC_MEET_FEMALE_TRAINER + jr .PlaySound +.maleTrainer + ld a, MUSIC_MEET_MALE_TRAINER +.PlaySound + ld [wNewSoundID], a + jp PlaySound + +INCLUDE "data/trainers/encounter_types.asm" diff --git a/home/uncompress.asm b/home/uncompress.asm new file mode 100644 index 00000000..02683db7 --- /dev/null +++ b/home/uncompress.asm @@ -0,0 +1,196 @@ +; uncompresses the front or back sprite of the specified mon +; assumes the corresponding mon header is already loaded +; hl contains offset to sprite pointer ($b for front or $d for back) +UncompressMonSprite:: + ld bc, wMonHeader + add hl, bc + ld a, [hli] + ld [wSpriteInputPtr], a ; fetch sprite input pointer + ld a, [hl] + ld [wSpriteInputPtr+1], a +; define (by index number) the bank that a pokemon's image is in +; index = Mew, bank 1 +; index = Kabutops fossil, bank $B +; index < $1F, bank 9 +; $1F ≤ index < $4A, bank $A +; $4A ≤ index < $74, bank $B +; $74 ≤ index < $99, bank $C +; $99 ≤ index, bank $D + ld a, [wcf91] ; XXX name for this ram location + ld b, a + cp MEW + ld a, BANK(MewPicFront) + jr z, .GotBank + ld a, b + cp FOSSIL_KABUTOPS + ld a, BANK(FossilKabutopsPic) + jr z, .GotBank + ld a, b + cp TANGELA + 1 + ld a, BANK(TangelaPicFront) + jr c, .GotBank + ld a, b + cp MOLTRES + 1 + ld a, BANK(MoltresPicFront) + jr c, .GotBank + ld a, b + cp BEEDRILL + 2 + ld a, BANK(BeedrillPicFront) + jr c, .GotBank + ld a, b + cp STARMIE + 1 + ld a, BANK(StarmiePicFront) + jr c, .GotBank + ld a, BANK(VictreebelPicFront) +.GotBank + jp UncompressSpriteData + +; de: destination location +LoadMonFrontSprite:: + push de + ld hl, wMonHFrontSprite - wMonHeader + call UncompressMonSprite + ld hl, wMonHSpriteDim + ld a, [hli] + ld c, a + pop de + ; fall through + +; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram +; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers +; de: destination location +; a,c: sprite dimensions (in tiles of 8x8 each) +LoadUncompressedSpriteData:: + push de + and $f + ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width + ld b, a + ld a, $7 + sub b ; 7-w + inc a ; 8-w + srl a ; (8-w)/2 ; horizontal center (in tiles, rounded up) + ld b, a + add a + add a + add a + sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles) + ld [hSpriteOffset], a + ld a, c + swap a + and $f + ld b, a + add a + add a + add a ; 8*tiles is height in bytes + ld [hSpriteHeight], a + ld a, $7 + sub b ; 7-h ; skip for vertical center (in tiles, relative to current column) + ld b, a + ld a, [hSpriteOffset] + add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles) + add a + add a + add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) + ld [hSpriteOffset], a + xor a + ld [$4000], a + ld hl, sSpriteBuffer0 + call ZeroSpriteBuffer ; zero buffer 0 + ld de, sSpriteBuffer1 + ld hl, sSpriteBuffer0 + call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite) + ld hl, sSpriteBuffer1 + call ZeroSpriteBuffer ; zero buffer 1 + ld de, sSpriteBuffer2 + ld hl, sSpriteBuffer1 + call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) + pop de + jp InterlaceMergeSpriteBuffers + +; copies and aligns the sprite data properly inside the sprite buffer +; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area +AlignSpriteDataCentered:: + ld a, [hSpriteOffset] + ld b, $0 + ld c, a + add hl, bc + ld a, [hSpriteWidth] +.columnLoop + push af + push hl + ld a, [hSpriteHeight] + ld c, a +.columnInnerLoop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .columnInnerLoop + pop hl + ld bc, 7*8 ; 7 tiles + add hl, bc ; advance one full column + pop af + dec a + jr nz, .columnLoop + ret + +; fills the sprite buffer (pointed to in hl) with zeros +ZeroSpriteBuffer:: + ld bc, SPRITEBUFFERSIZE +.nextByteLoop + xor a + ld [hli], a + dec bc + ld a, b + or c + jr nz, .nextByteLoop + ret + +; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2 +; in the resulting sprite, the rows of the two source sprites are interlaced +; de: output address +InterlaceMergeSpriteBuffers:: + xor a + ld [$4000], a + push de + ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 + ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 + ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 + ld a, SPRITEBUFFERSIZE/2 ; $c4 + ld [hSpriteInterlaceCounter], a +.interlaceLoop + ld a, [de] + dec de + ld [hld], a ; write byte of source 2 + ld a, [bc] + dec bc + ld [hld], a ; write byte of source 1 + ld a, [de] + dec de + ld [hld], a ; write byte of source 2 + ld a, [bc] + dec bc + ld [hld], a ; write byte of source 1 + ld a, [hSpriteInterlaceCounter] + dec a + ld [hSpriteInterlaceCounter], a + jr nz, .interlaceLoop + ld a, [wSpriteFlipped] + and a + jr z, .notFlipped + ld bc, 2*SPRITEBUFFERSIZE + ld hl, sSpriteBuffer1 +.swapLoop + swap [hl] ; if flipped swap nybbles in all bytes + inc hl + dec bc + ld a, b + or c + jr nz, .swapLoop +.notFlipped + pop hl + ld de, sSpriteBuffer1 + ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied + ld a, [hLoadedROMBank] + ld b, a + jp CopyVideoData diff --git a/home/yes_no.asm b/home/yes_no.asm new file mode 100644 index 00000000..61aa1390 --- /dev/null +++ b/home/yes_no.asm @@ -0,0 +1,40 @@ +; displays yes/no choice +; yes -> set carry +YesNoChoice:: + call SaveScreenTilesToBuffer1 + call InitYesNoTextBoxParameters + jr DisplayYesNoChoice + +Func_35f4:: + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a + call InitYesNoTextBoxParameters + jp DisplayTextBoxID + +InitYesNoTextBoxParameters:: + xor a ; YES_NO_MENU + ld [wTwoOptionMenuID], a + coord hl, 14, 7 + ld bc, $80f + ret + +YesNoChoicePokeCenter:: + call SaveScreenTilesToBuffer1 + ld a, HEAL_CANCEL_MENU + ld [wTwoOptionMenuID], a + coord hl, 11, 6 + lb bc, 8, 12 + jr DisplayYesNoChoice + +WideYesNoChoice:: ; unused + call SaveScreenTilesToBuffer1 + ld a, WIDE_YES_NO_MENU + ld [wTwoOptionMenuID], a + coord hl, 12, 7 + lb bc, 8, 13 + +DisplayYesNoChoice:: + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a + call DisplayTextBoxID + jp LoadScreenTilesFromBuffer1 diff --git a/macros/predef.asm b/macros/predef.asm index fda42004..d86582d1 100644 --- a/macros/predef.asm +++ b/macros/predef.asm @@ -1,13 +1,3 @@ -predef_const: MACRO - const \1PredefID -ENDM - -add_predef: MACRO -\1Predef:: - db BANK(\1) - dw \1 -ENDM - predef_id: MACRO ld a, (\1Predef - PredefPointers) / 3 ENDM @@ -22,17 +12,6 @@ predef_jump: MACRO jp Predef ENDM -tx_pre_const: MACRO - const \1_id -ENDM - -add_tx_pre: MACRO -\1_id:: dw \1 -ENDM - -db_tx_pre: MACRO - db (\1_id - TextPredefs) / 2 + 1 -ENDM tx_pre_id: MACRO ld a, (\1_id - TextPredefs) / 2 + 1 @@ -47,3 +26,7 @@ tx_pre_jump: MACRO tx_pre_id \1 jp PrintPredefTextID ENDM + +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM -- cgit v1.3.1-sl0p From e4e0af4d6713161d46cc0a1d580645ca40d6fa81 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 4 Jul 2020 01:00:45 -0400 Subject: Remove remaining raw $xxxx values, and replace "+ -1" with "- 1" (supported by rgbds 0.4.0) --- constants/hardware_constants.asm | 13 +++++ constants/move_constants.asm | 2 +- constants/pokedex_constants.asm | 2 +- constants/pokemon_constants.asm | 2 +- data/moves/effects_pointers.asm | 14 +++--- engine/battle/animations.asm | 6 +-- engine/battle/core.asm | 12 ++--- engine/battle/trainer_ai.asm | 2 +- engine/events/diploma.asm | 2 +- engine/events/prize_menu.asm | 4 +- engine/menus/display_text_id_init.asm | 4 +- engine/menus/save.asm | 4 +- engine/menus/start_sub_menus.asm | 10 ++-- engine/movie/title.asm | 2 +- engine/overworld/map_sprites.asm | 3 +- engine/overworld/wild_mons.asm | 6 +-- engine/pokemon/status_screen.asm | 4 +- engine/slots/slot_machine.asm | 2 +- home/init.asm | 12 ++--- home/list_menu.asm | 2 +- home/names2.asm | 2 +- home/overworld.asm | 12 ++--- home/pics.asm | 4 +- home/predef_text.asm | 2 +- macros/scripts/events.asm | 12 ++--- macros/wram.asm | 92 ++++++++++++++++++++++++++++++++++ scripts/OaksLab.asm | 2 +- scripts/VermilionDock.asm | 2 +- wram.asm | 94 ++--------------------------------- 29 files changed, 172 insertions(+), 158 deletions(-) create mode 100644 macros/wram.asm (limited to 'macros') diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 59ec6170..993a02f5 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -2,6 +2,19 @@ GBC EQU $11 +; memory map +VRAM_Begin EQU $8000 +VRAM_End EQU $a000 +SRAM_Begin EQU $a000 +SRAM_End EQU $c000 +WRAM0_Begin EQU $c000 +WRAM0_End EQU $d000 +WRAM1_Begin EQU $d000 +WRAM1_End EQU $e000 +; hardware registers $ff00-$ff80 (see below) +HRAM_Begin EQU $ff80 +HRAM_End EQU $ffff + ; MBC1 MBC1SRamEnable EQU $0000 MBC1RomBank EQU $2000 diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 850662de..5dd06a41 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -165,7 +165,7 @@ const SLASH ; a3 const SUBSTITUTE ; a4 -NUM_ATTACKS EQU const_value + -1 +NUM_ATTACKS EQU const_value - 1 const STRUGGLE ; a5 diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm index c8605852..e462586e 100644 --- a/constants/pokedex_constants.asm +++ b/constants/pokedex_constants.asm @@ -151,4 +151,4 @@ const DEX_MEWTWO ; 150 const DEX_MEW ; 151 -NUM_POKEMON EQU const_value + -1 +NUM_POKEMON EQU const_value - 1 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 5484a65d..7abdd4d3 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -191,4 +191,4 @@ const WEEPINBELL ; $BD const VICTREEBEL ; $BE -NUM_POKEMON_INDEXES EQU const_value + -1 +NUM_POKEMON_INDEXES EQU const_value - 1 diff --git a/data/moves/effects_pointers.asm b/data/moves/effects_pointers.asm index 0d36e887..02f6e5c6 100644 --- a/data/moves/effects_pointers.asm +++ b/data/moves/effects_pointers.asm @@ -7,7 +7,7 @@ MoveEffectPointerTable: dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1 dw ExplodeEffect ; EXPLODE_EFFECT dw DrainHPEffect ; DREAM_EATER_EFFECT - dw $0000 ; MIRROR_MOVE_EFFECT + dw NULL ; MIRROR_MOVE_EFFECT dw StatModifierUpEffect ; ATTACK_UP1_EFFECT dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT dw StatModifierUpEffect ; SPEED_UP1_EFFECT @@ -15,7 +15,7 @@ MoveEffectPointerTable: dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT dw StatModifierUpEffect ; EVASION_UP1_EFFECT dw PayDayEffect ; PAY_DAY_EFFECT - dw $0000 ; SWIFT_EFFECT + dw NULL ; SWIFT_EFFECT dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT @@ -38,12 +38,12 @@ MoveEffectPointerTable: dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2 dw OneHitKOEffect ; OHKO_EFFECT dw ChargeEffect ; CHARGE_EFFECT - dw $0000 ; SUPER_FANG_EFFECT - dw $0000 ; SPECIAL_DAMAGE_EFFECT + dw NULL ; SUPER_FANG_EFFECT + dw NULL ; SPECIAL_DAMAGE_EFFECT dw TrappingEffect ; TRAPPING_EFFECT dw ChargeEffect ; FLY_EFFECT dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT - dw $0000 ; JUMP_KICK_EFFECT + dw NULL ; JUMP_KICK_EFFECT dw MistEffect ; MIST_EFFECT dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT dw RecoilEffect ; RECOIL_EFFECT @@ -76,12 +76,12 @@ MoveEffectPointerTable: dw StatModifierDownEffect ; unused effect dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT - dw $0000 ; unused effect + dw NULL ; unused effect dw SubstituteEffect ; SUBSTITUTE_EFFECT dw HyperBeamEffect ; HYPER_BEAM_EFFECT dw RageEffect ; RAGE_EFFECT dw MimicEffect ; MIMIC_EFFECT - dw $0000 ; METRONOME_EFFECT + dw NULL ; METRONOME_EFFECT dw LeechSeedEffect ; LEECH_SEED_EFFECT dw SplashEffect ; SPLASH_EFFECT dw DisableEffect ; DISABLE_EFFECT diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index d858e066..ee476ce9 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1735,7 +1735,7 @@ AnimationSlideMonDownAndHide: jr nz, .loop call AnimationHideMonPic ld hl, wTempPic - ld bc, $0310 + ld bc, $310 xor a call FillMemory jp CopyTempPicToMonPic @@ -1896,7 +1896,7 @@ AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a - ld bc, $0310 + ld bc, $310 call FillMemory ld a, [hWhoseTurn] and a @@ -1932,7 +1932,7 @@ AnimationSubstitute: jp AnimationShowMonPic CopySlowbroSpriteData: - ld bc, $0010 + ld bc, $10 ld a, BANK(SlowbroSprite) jp FarCopyData2 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 00852b2b..6881aef5 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -582,7 +582,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ld a, [de] ; increment toxic counter inc a ld [de], a - ld hl, $0000 + ld hl, 0 .toxicTicksLoop add hl, bc dec a @@ -5345,8 +5345,8 @@ MoveHitTest: ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true) call CheckTargetSubstitute ; substitute check (note that this overwrites a) jr z, .checkForDigOrFlyStatus -; this code is buggy. it's supposed to prevent HP draining moves from working on substitutes. -; since $7b79 overwrites a with either $00 or $01, it never works. +; This code is buggy. It's supposed to prevent HP draining moves from working on substitutes. +; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works. cp DRAIN_HP_EFFECT jp z, .moveMissed cp DREAM_EATER_EFFECT @@ -6335,9 +6335,9 @@ LoadPlayerBackPic: ld de, vBackPic call InterlaceMergeSpriteBuffers ld a, $a - ld [$0], a + ld [MBC1SRamEnable], a xor a - ld [$4000], a + ld [MBC1SRamBank], a ld hl, vSprites ld de, sSpriteBuffer1 ld a, [hLoadedROMBank] @@ -6345,7 +6345,7 @@ LoadPlayerBackPic: ld c, 7 * 7 call CopyVideoData xor a - ld [$0], a + ld [MBC1SRamEnable], a ld a, $31 ld [hStartTileID], a coord hl, 1, 5 diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 2178be38..d61b44f8 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -134,7 +134,7 @@ AIMoveChoiceModification1: push de push bc ld hl, StatusAilmentMoveEffects - ld de, $0001 + ld de, 1 call IsInArray pop bc pop de diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 24bd2f22..53d78e57 100755 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -9,7 +9,7 @@ DisplayDiploma:: call DisableLCD ld hl, CircleTile ld de, vChars2 + $700 - ld bc, $0010 + ld bc, $10 ld a, BANK(CircleTile) call FarCopyData2 coord hl, 0, 0 diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index aa86f828..5a00a89e 100755 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -131,10 +131,8 @@ GetPrizeMenuId: coord hl, 13, 5 ; reg. c: ; [low nybble] number of bytes -; [bit 765 = %100] space-padding (not zero-padding) +; [bits 765 = %100] space-padding (not zero-padding) ld c, (1 << 7 | 2) -; Function $15CD displays BCD value (same routine -; used by text-command $02) call PrintBCDNumber ld de, wPrize2Price coord hl, 13, 7 diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index e1f6c678..45c76f9c 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -43,7 +43,7 @@ DisplayTextIDInit:: ; the original direction they were facing must be restored after the dialogue is over ld hl, wSpriteStateData1 + $19 ld c, $0f - ld de, $0010 + ld de, $10 .spriteFacingDirectionCopyLoop ld a, [hl] inc h @@ -55,7 +55,7 @@ DisplayTextIDInit:: ; loop to force all the sprites in the middle of animation to stand still ; (so that they don't like they're frozen mid-step during the dialogue) ld hl, wSpriteStateData1 + 2 - ld de, $0010 + ld de, $10 ld c, e .spriteStandStillLoop ld a, [hl] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index f2ecc3aa..ee73c850 100755 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -702,7 +702,7 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, $a000 ; start of SRAM - ld bc, $2000 ; size of SRAM + ld hl, SRAM_Begin + ld bc, SRAM_End - SRAM_Begin ld a, $ff jp FillMemory diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 43c767e2..526540df 100755 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -491,12 +491,12 @@ DrawTrainerInfo: call CopyData ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns ld de, vChars2 + $770 - ld bc, $0080 + ld bc, $80 push bc call TrainerInfo_FarCopyData ld hl, BlankLeaderNames ld de, vChars2 + $600 - ld bc, $0170 + ld bc, $170 call TrainerInfo_FarCopyData pop bc ld hl, BadgeNumbersTileGraphics ; badge number tile patterns @@ -504,14 +504,14 @@ DrawTrainerInfo: call TrainerInfo_FarCopyData ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns ld de, vChars2 + $200 - ld bc, $0400 + ld bc, $400 ld a, $03 call FarCopyData2 ld hl, TextBoxGraphics - ld de, $00d0 + ld de, $d0 add hl, de ; hl = colon tile pattern ld de, vChars1 + $560 - ld bc, $0010 + ld bc, $10 ld a, $04 push bc call FarCopyData2 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 1a2d16a0..9cbe5494 100755 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -317,7 +317,7 @@ DrawPlayerCharacter: xor a ld [wPlayerCharacterOAMTile], a ld hl, wOAMBuffer - ld de, $605a + lb de, $60, $5a ld b, 7 .loop push de diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index eb8edb10..904e9b04 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -133,8 +133,7 @@ LoadMapSpriteTilePatterns: jr nc, .fourTileSpriteVRAMAddr ld d, a dec d -; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM -; slot and adding the result to $8000 (the VRAM base address). +; vSprites += [hVRAMSlot] * $C0 (the number of bytes in 12 tiles) .calculateVRAMAddrLoop add hl, bc dec d diff --git a/engine/overworld/wild_mons.asm b/engine/overworld/wild_mons.asm index 24dc7681..2593e0ec 100644 --- a/engine/overworld/wild_mons.asm +++ b/engine/overworld/wild_mons.asm @@ -16,10 +16,10 @@ LoadWildData:: jr z, .NoGrassData ; if no grass data, skip to surfing data push hl ld de, wGrassMons ; otherwise, load grass data - ld bc, $0014 + ld bc, $14 call CopyData pop hl - ld bc, $0014 + ld bc, $14 add hl, bc .NoGrassData ld a, [hli] @@ -27,7 +27,7 @@ LoadWildData:: and a ret z ; if no water data, we're done ld de, wWaterMons ; otherwise, load surfing data - ld bc, $0014 + ld bc, $14 jp CopyData INCLUDE "data/wild/grass_water.asm" diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index f66cdf5a..b262a8b7 100755 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -254,7 +254,7 @@ PrintStatsBox: ld c, 8 call TextBoxBorder ; Draws the box coord hl, 1, 9 ; Start printing stats from here - ld bc, $0019 ; Number offset + ld bc, $19 ; Number offset jr .PrintStats .DifferentBox coord hl, 9, 2 @@ -262,7 +262,7 @@ PrintStatsBox: ld c, 9 call TextBoxBorder coord hl, 11, 3 - ld bc, $0018 + ld bc, $18 .PrintStats push bc push hl diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 16696713..c3de5dd2 100755 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -31,7 +31,7 @@ PromptUserToPlaySlots: xor a ld [wSlotMachineAllowMatchesCounter], a ld hl, wStoppingWhichSlotMachineWheel - ld bc, $0014 + ld bc, $14 call FillMemory call MainSlotMachineLoop ld hl, wd730 diff --git a/home/init.asm b/home/init.asm index 48294fa6..83238bad 100644 --- a/home/init.asm +++ b/home/init.asm @@ -41,8 +41,8 @@ rLCDC_DEFAULT EQU %11100011 ld sp, wStack - ld hl, $c000 ; start of WRAM - ld bc, $2000 ; size of WRAM + ld hl, WRAM0_Begin + ld bc, WRAM1_End - WRAM0_Begin .loop ld [hl], 0 inc hl @@ -53,8 +53,8 @@ rLCDC_DEFAULT EQU %11100011 call ClearVram - ld hl, $ff80 ; start of HRAM - ld bc, $ffff - $ff80 ; size of HRAM + ld hl, HRAM_Begin + ld bc, HRAM_End - HRAM_Begin call FillMemory call ClearSprites @@ -119,8 +119,8 @@ rLCDC_DEFAULT EQU %11100011 jp SetDefaultNamesBeforeTitlescreen ClearVram:: - ld hl, $8000 - ld bc, $2000 + ld hl, VRAM_Begin + ld bc, VRAM_End - VRAM_Begin xor a jp FillMemory diff --git a/home/list_menu.asm b/home/list_menu.asm index 68335ed5..4ce973b2 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -454,7 +454,7 @@ PrintListMenuEntries:: ld [wLoadedMonLevel], a .skipCopyingLevel pop hl - ld bc, $001c + ld bc, $1c add hl, bc call PrintLevel pop af diff --git a/home/names2.asm b/home/names2.asm index 178a0780..319febd3 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -77,7 +77,7 @@ GetName:: ld h, d ld l, e ld de, wcd6d - ld bc, $0014 + ld bc, $14 call CopyData .gotPtr ld a, e diff --git a/home/overworld.asm b/home/overworld.asm index c959beb6..79e4ea97 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1424,18 +1424,18 @@ LoadCurrentMapView:: dec b jr nz, .rowLoop ld hl, wTileMapBackup - ld bc, $0000 + ld bc, $0 .adjustForYCoordWithinTileBlock ld a, [wYBlockCoord] and a jr z, .adjustForXCoordWithinTileBlock - ld bc, $0030 + ld bc, $30 add hl, bc .adjustForXCoordWithinTileBlock ld a, [wXBlockCoord] and a jr z, .copyToVisibleAreaBuffer - ld bc, $0002 + ld bc, $2 add hl, bc .copyToVisibleAreaBuffer coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank @@ -1739,7 +1739,7 @@ ScheduleSouthRowRedraw:: ld l, a ld a, [wMapViewVRAMPointer + 1] ld h, a - ld bc, $0200 + ld bc, $200 add hl, bc ld a, h and $03 @@ -1835,7 +1835,7 @@ DrawTileBlock:: ld a, [de] ld [hl], a inc de - ld bc, $0015 + ld bc, $15 add hl, bc pop bc dec c @@ -2180,7 +2180,7 @@ LoadMapHeader:: jr nz, .zeroSpriteDataLoop ; initialize all C100-C1FF sprite entries to disabled (other than player's) ld hl, wSpriteStateData1 + $12 - ld de, $0010 + ld de, $10 ld c, $0f .disableSpriteEntriesLoop ld [hl], $ff diff --git a/home/pics.asm b/home/pics.asm index 02683db7..c6d99cbb 100644 --- a/home/pics.asm +++ b/home/pics.asm @@ -93,7 +93,7 @@ LoadUncompressedSpriteData:: add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) ld [hSpriteOffset], a xor a - ld [$4000], a + ld [MBC1SRamBank], a ld hl, sSpriteBuffer0 call ZeroSpriteBuffer ; zero buffer 0 ld de, sSpriteBuffer1 @@ -151,7 +151,7 @@ ZeroSpriteBuffer:: ; de: output address InterlaceMergeSpriteBuffers:: xor a - ld [$4000], a + ld [MBC1SRamBank], a push de ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 diff --git a/home/predef_text.asm b/home/predef_text.asm index 24001c24..059e23ab 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -119,7 +119,7 @@ CloseTextDisplay:: ; loop to make sprites face the directions they originally faced before the dialogue ld hl, wSpriteStateData2 + $19 ld c, $0f - ld de, $0010 + ld de, $10 .restoreSpriteFacingDirectionLoop ld a, [hl] dec h diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index 9be354e3..c5f90107 100755 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -183,7 +183,7 @@ ENDM ;\3, \4, ... = additional (optional) event indices SetEvents: MACRO SetEvent \1 - rept (_NARG + -1) + rept _NARG - 1 SetEventReuseHL \2 shift endr @@ -235,7 +235,7 @@ ENDM ;\3 = event index (optional) ResetEvents: MACRO ResetEvent \1 - rept (_NARG + -1) + rept _NARG - 1 ResetEventReuseHL \2 shift endr @@ -283,7 +283,7 @@ event_fill_start = event_start_byte + 1 event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 +event_fill_start = event_fill_start - 1 event_fill_count = event_fill_count + 1 ELSE ld a, [wEventFlags + event_start_byte] @@ -304,7 +304,7 @@ event_fill_count = event_fill_count + 1 ld a, $ff ld hl, wEventFlags + event_fill_start - REPT event_fill_count + -1 + REPT event_fill_count - 1 ld [hli], a ENDR @@ -345,7 +345,7 @@ event_fill_start = event_start_byte + 1 event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 +event_fill_start = event_fill_start - 1 event_fill_count = event_fill_count + 1 ELSE ld a, [wEventFlags + event_start_byte] @@ -370,7 +370,7 @@ event_fill_count = event_fill_count + 1 xor a ENDC - REPT event_fill_count + -1 + REPT event_fill_count - 1 ld [hli], a ENDR diff --git a/macros/wram.asm b/macros/wram.asm new file mode 100644 index 00000000..7a9b4a6a --- /dev/null +++ b/macros/wram.asm @@ -0,0 +1,92 @@ +; Used in wram.asm + +flag_array: MACRO + ds ((\1) + 7) / 8 +ENDM + +BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 + +box_struct: MACRO +\1Species:: db +\1HP:: dw +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1OTID:: dw +\1Exp:: ds 3 +\1HPExp:: dw +\1AttackExp:: dw +\1DefenseExp:: dw +\1SpeedExp:: dw +\1SpecialExp:: dw +\1DVs:: ds 2 +\1PP:: ds NUM_MOVES +ENDM + +party_struct: MACRO + box_struct \1 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +ENDM + +battle_struct: MACRO +\1Species:: db +\1HP:: dw +\1PartyPos:: +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1DVs:: ds 2 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +\1PP:: ds NUM_MOVES +ENDM + +spritestatedata1: MACRO +\1PictureID:: db +\1MovementStatus:: db +\1ImageIndex:: db +\1YStepVector:: db +\1YPixels:: db +\1XStepVector:: db +\1XPixels:: db +\1IntraAnimFrameCounter:: db +\1AnimFrameCounter:: db +\1FacingDirection:: db + ds 6 +\1End:: +ENDM + +spritestatedata2: MACRO +\1WalkAnimationCounter:: db + ds 1 +\1YDisplacement:: db +\1XDisplacement:: db +\1MapY:: db +\1MapX:: db +\1MovementByte1:: db +\1GrassPriority:: db +\1MovementDelay:: db + ds 5 +\1ImageBaseOffset:: db + ds 1 +\1End:: +ENDM diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 9bb84923..b3347849 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -652,7 +652,7 @@ OaksLabScript18: OaksLabScript_RemoveParcel: ld hl, wBagItems - ld bc, $0000 + ld bc, 0 .loop ld a, [hli] cp $ff diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 4b0cf439..90fef6b2 100755 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -78,7 +78,7 @@ VermilionDock_1db9b: ld d, $0 ld e, $8 .asm_1dbfa - ld hl, $0002 + ld hl, $2 add hl, bc ld a, l ld [wMapViewVRAMPointer], a diff --git a/wram.asm b/wram.asm index 9c37b3db..e2fa05a6 100755 --- a/wram.asm +++ b/wram.asm @@ -1,63 +1,6 @@ INCLUDE "constants.asm" -flag_array: MACRO - ds ((\1) + 7) / 8 -ENDM - -box_struct_length EQU 25 + NUM_MOVES * 2 -box_struct: MACRO -\1Species:: db -\1HP:: dw -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1OTID:: dw -\1Exp:: ds 3 -\1HPExp:: dw -\1AttackExp:: dw -\1DefenseExp:: dw -\1SpeedExp:: dw -\1SpecialExp:: dw -\1DVs:: ds 2 -\1PP:: ds NUM_MOVES -ENDM - -party_struct: MACRO - box_struct \1 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -ENDM - -battle_struct: MACRO -\1Species:: db -\1HP:: dw -\1PartyPos:: -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1DVs:: ds 2 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -\1PP:: ds NUM_MOVES -ENDM +INCLUDE "macros/wram.asm" SECTION "WRAM Bank 0", WRAM0 @@ -228,21 +171,6 @@ wSpriteStateData1:: ; C1xD ; C1xE ; C1xF -spritestatedata1: MACRO -\1PictureID:: db -\1MovementStatus:: db -\1ImageIndex:: db -\1YStepVector:: db -\1YPixels:: db -\1XStepVector:: db -\1XPixels:: db -\1IntraAnimFrameCounter:: db -\1AnimFrameCounter:: db -\1FacingDirection:: db - ds 6 -\1End:: -endm - wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1 wSprite01StateData1:: spritestatedata1 wSprite01StateData1 wSprite02StateData1:: spritestatedata1 wSprite02StateData1 @@ -280,22 +208,6 @@ wSpriteStateData2:: ; C2xD ; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2) ; C2xF -spritestatedata2: MACRO -\1WalkAnimationCounter:: db - ds 1 -\1YDisplacement:: db -\1XDisplacement:: db -\1MapY:: db -\1MapX:: db -\1MovementByte1:: db -\1GrassPriority:: db -\1MovementDelay:: db - ds 5 -\1ImageBaseOffset:: db - ds 1 -\1End:: -endm - wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2 wSprite01StateData2:: spritestatedata2 wSprite01StateData2 wSprite02StateData2:: spritestatedata2 wSprite02StateData2 @@ -1050,7 +962,7 @@ wOptionsCancelCursorX:: ds 1 wDayCarePerLevelCost:: -; 2-byte BCD number (always set to $0100) +; 2-byte BCD number (always set to $100) wHoFTeamIndex2:: @@ -3185,7 +3097,7 @@ wBoxSpecies:: ds MONS_PER_BOX + 1 wBoxMons:: wBoxMon1:: box_struct wBoxMon1 -wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) +wBoxMon2:: ds BOX_STRUCT_LENGTH * (MONS_PER_BOX - 1) wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX -- cgit v1.3.1-sl0p