shithub: pokecrystal

Download patch

ref: 65f22544e0a2d3fdbbd23b0fee026120d84202d8
parent: c87f8512a4d736a847dbc69e09c781a29eeaa638
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Mar 15 10:10:53 EDT 2020

Refactor flypoints to separate const definition from data usage

--- a/constants/map_data_constants.asm
+++ b/constants/map_data_constants.asm
@@ -99,4 +99,34 @@
 	const SPAWN_FAST_SHIP
 NUM_SPAWNS EQU const_value
 
+; Flypoints indexes (see data/maps/flypoints.asm)
+	const_def
+; johto
+	const FLY_NEW_BARK
+	const FLY_CHERRYGROVE
+	const FLY_VIOLET
+	const FLY_AZALEA
+	const FLY_GOLDENROD
+	const FLY_ECRUTEAK
+	const FLY_OLIVINE
+	const FLY_CIANWOOD
+	const FLY_MAHOGANY
+	const FLY_LAKE_OF_RAGE
+	const FLY_BLACKTHORN
+	const FLY_MT_SILVER
+; kanto
+KANTO_FLYPOINT EQU const_value
+	const FLY_PALLET
+	const FLY_VIRIDIAN
+	const FLY_PEWTER
+	const FLY_CERULEAN
+	const FLY_VERMILION
+	const FLY_ROCK_TUNNEL
+	const FLY_LAVENDER
+	const FLY_CELADON
+	const FLY_SAFFRON
+	const FLY_FUCHSIA
+	const FLY_CINNABAR
+	const FLY_INDIGO
+
 MAX_OUTDOOR_SPRITES EQU 23 ; see engine/overworld/overworld.asm
--- a/data/maps/flypoints.asm
+++ b/data/maps/flypoints.asm
@@ -1,37 +1,30 @@
-flypoint: MACRO
-	const FLY_\1
-	db \2, SPAWN_\1
-ENDM
-
 Flypoints:
-; landmark, spawn point
-	const_def
+; entries correspond to FLY_* constants
 ; Johto
-	flypoint NEW_BARK,     NEW_BARK_TOWN
-	flypoint CHERRYGROVE,  CHERRYGROVE_CITY
-	flypoint VIOLET,       VIOLET_CITY
-	flypoint AZALEA,       AZALEA_TOWN
-	flypoint GOLDENROD,    GOLDENROD_CITY
-	flypoint ECRUTEAK,     ECRUTEAK_CITY
-	flypoint OLIVINE,      OLIVINE_CITY
-	flypoint CIANWOOD,     CIANWOOD_CITY
-	flypoint MAHOGANY,     MAHOGANY_TOWN
-	flypoint LAKE_OF_RAGE, LAKE_OF_RAGE
-	flypoint BLACKTHORN,   BLACKTHORN_CITY
-	flypoint MT_SILVER,    SILVER_CAVE
-
+	; landmark, spawn point
+	db NEW_BARK_TOWN,    SPAWN_NEW_BARK
+	db CHERRYGROVE_CITY, SPAWN_CHERRYGROVE
+	db VIOLET_CITY,      SPAWN_VIOLET
+	db AZALEA_TOWN,      SPAWN_AZALEA
+	db GOLDENROD_CITY,   SPAWN_GOLDENROD
+	db ECRUTEAK_CITY,    SPAWN_ECRUTEAK
+	db OLIVINE_CITY,     SPAWN_OLIVINE
+	db CIANWOOD_CITY,    SPAWN_CIANWOOD
+	db MAHOGANY_TOWN,    SPAWN_MAHOGANY
+	db LAKE_OF_RAGE,     SPAWN_LAKE_OF_RAGE
+	db BLACKTHORN_CITY,  SPAWN_BLACKTHORN
+	db SILVER_CAVE,      SPAWN_MT_SILVER
 ; Kanto
-KANTO_FLYPOINT EQU const_value
-	flypoint PALLET,       PALLET_TOWN
-	flypoint VIRIDIAN,     VIRIDIAN_CITY
-	flypoint PEWTER,       PEWTER_CITY
-	flypoint CERULEAN,     CERULEAN_CITY
-	flypoint VERMILION,    VERMILION_CITY
-	flypoint ROCK_TUNNEL,  ROCK_TUNNEL
-	flypoint LAVENDER,     LAVENDER_TOWN
-	flypoint CELADON,      CELADON_CITY
-	flypoint SAFFRON,      SAFFRON_CITY
-	flypoint FUCHSIA,      FUCHSIA_CITY
-	flypoint CINNABAR,     CINNABAR_ISLAND
-	flypoint INDIGO,       INDIGO_PLATEAU
+	db PALLET_TOWN,      SPAWN_PALLET
+	db VIRIDIAN_CITY,    SPAWN_VIRIDIAN
+	db PEWTER_CITY,      SPAWN_PEWTER
+	db CERULEAN_CITY,    SPAWN_CERULEAN
+	db VERMILION_CITY,   SPAWN_VERMILION
+	db ROCK_TUNNEL,      SPAWN_ROCK_TUNNEL
+	db LAVENDER_TOWN,    SPAWN_LAVENDER
+	db CELADON_CITY,     SPAWN_CELADON
+	db SAFFRON_CITY,     SPAWN_SAFFRON
+	db FUCHSIA_CITY,     SPAWN_FUCHSIA
+	db CINNABAR_ISLAND,  SPAWN_CINNABAR
+	db INDIGO_PLATEAU,   SPAWN_INDIGO
 	db -1
--- a/data/maps/spawn_points.asm
+++ b/data/maps/spawn_points.asm
@@ -37,4 +37,5 @@
 	spawn BLACKTHORN_CITY,            21, 30
 	spawn SILVER_CAVE_OUTSIDE,        23, 20
 	spawn FAST_SHIP_CABINS_SW_SSW_NW,  6,  2
+
 	spawn N_A,                        -1, -1