diff --git a/constants.asm b/constants.asm index 0b24ea05..1e3960d6 100644 --- a/constants.asm +++ b/constants.asm @@ -30,3 +30,4 @@ INCLUDE "constants/credits_constants.asm" INCLUDE "constants/music_constants.asm" INCLUDE "constants/tilesets.asm" INCLUDE "constants/starter_mons.asm" +INCLUDE "constants/map_location_constants.asm" diff --git a/constants/map_location_constants.asm b/constants/map_location_constants.asm new file mode 100644 index 00000000..22df77c8 --- /dev/null +++ b/constants/map_location_constants.asm @@ -0,0 +1,55 @@ +PalletTown_LOCATION EQU $00 +ViridianCity_LOCATION EQU $01 +PewterCity_LOCATION EQU $02 +CeruleanCity_LOCATION EQU $03 +LavenderTown_LOCATION EQU $04 +VermilionCity_LOCATION EQU $05 +CeladonCity_LOCATION EQU $06 +FuchsiaCity_LOCATION EQU $07 +CinnabarIsland_LOCATION EQU $08 +IndigoPlateau_LOCATION EQU $09 +SaffronCity_LOCATION EQU $0a +Route1_LOCATION EQU $0b +Route2_LOCATION EQU $0c +Route3_LOCATION EQU $0d +Route4_LOCATION EQU $0e +Route5_LOCATION EQU $0f +Route6_LOCATION EQU $10 +Route7_LOCATION EQU $11 +Route8_LOCATION EQU $12 +Route9_LOCATION EQU $13 +Route10_LOCATION EQU $14 +Route11_LOCATION EQU $15 +Route12_LOCATION EQU $16 +Route13_LOCATION EQU $17 +Route14_LOCATION EQU $18 +Route15_LOCATION EQU $19 +Route16_LOCATION EQU $1a +Route17_LOCATION EQU $1b +Route18_LOCATION EQU $1c +Route19_LOCATION EQU $1d +Route20_LOCATION EQU $1e +Route21_LOCATION EQU $1f +Route22_LOCATION EQU $20 +Route23_LOCATION EQU $21 +Route24_LOCATION EQU $22 +Route25_LOCATION EQU $23 +ViridianForest_LOCATION EQU $24 +MountMoon_LOCATION EQU $25 +RockTunnel_LOCATION EQU $26 +SeaCottage_LOCATION EQU $27 +SSAnne_LOCATION EQU $28 +PokemonLeague_LOCATION EQU $29 +UndergroundPath_LOCATION EQU $2a +PokemonTower_LOCATION EQU $2b +SeafoamIslands_LOCATION EQU $2c +VictoryRoad_LOCATION EQU $2d +DiglettsCave_LOCATION EQU $2e +RocketHQ_LOCATION EQU $2f +SilphCo_LOCATION EQU $30 +PokemonMansion_LOCATION EQU $31 +SafariZone_LOCATION EQU $32 +CeruleanCave_LOCATION EQU $33 +PowerPlant_LOCATION EQU $34 + +NUM_LOCATIONS EQU $35 diff --git a/data/town_map_entries.asm b/data/town_map_entries.asm index d2edd949..c46c2c50 100755 --- a/data/town_map_entries.asm +++ b/data/town_map_entries.asm @@ -99,3 +99,66 @@ InternalMapEntries: ; 71382 (1c:5382) IMAP $ED,$A,$5,SilphCoName IMAP $F8,$0,$2,PokemonLeagueName db $FF + +MapToLocationIndexTable: + db $29,PalletTown_LOCATION + db $2E,ViridianCity_LOCATION + db $33,Route2_LOCATION + db $34,ViridianForest_LOCATION + db $3B,PewterCity_LOCATION + db $3E,MountMoon_LOCATION + db $44,CeruleanCity_LOCATION + db $45,Route4_LOCATION + db $46,CeruleanCity_LOCATION + db $49,Route5_LOCATION + db $4C,Route6_LOCATION + db $4F,Route7_LOCATION + db $51,Route8_LOCATION + db $53,RockTunnel_LOCATION + db $54,PowerPlant_LOCATION + db $57,Route11_LOCATION + db $58,Route12_LOCATION + db $59,SeaCottage_LOCATION + db $5F,VermilionCity_LOCATION + db $69,SSAnne_LOCATION + db $6D,VictoryRoad_LOCATION + db $77,PokemonLeague_LOCATION + db $78,UndergroundPath_LOCATION + db $79,PokemonLeague_LOCATION + db $7A,UndergroundPath_LOCATION + db $8D,CeladonCity_LOCATION + db $8E,LavenderTown_LOCATION + db $95,PokemonTower_LOCATION + db $98,LavenderTown_LOCATION + db $9C,FuchsiaCity_LOCATION + db $9D,SafariZone_LOCATION + db $9F,FuchsiaCity_LOCATION + db $A3,SeafoamIslands_LOCATION + db $A4,VermilionCity_LOCATION + db $A5,FuchsiaCity_LOCATION + db $A6,PokemonMansion_LOCATION + db $AE,CinnabarIsland_LOCATION + db $AF,IndigoPlateau_LOCATION + db $B8,SaffronCity_LOCATION + db $BA,Route15_LOCATION + db $BD,Route16_LOCATION + db $BE,Route12_LOCATION + db $C0,Route18_LOCATION + db $C1,SeafoamIslands_LOCATION + db $C2,Route22_LOCATION + db $C3,VictoryRoad_LOCATION + db $C4,Route12_LOCATION + db $C5,VermilionCity_LOCATION + db $C6,DiglettsCave_LOCATION + db $C7,VictoryRoad_LOCATION + db $CF,RocketHQ_LOCATION + db $D6,SilphCo_LOCATION + db $D9,PokemonMansion_LOCATION + db $E2,SafariZone_LOCATION + db $E5,CeruleanCave_LOCATION + db $E6,LavenderTown_LOCATION + db $E7,CeruleanCity_LOCATION + db $E9,RockTunnel_LOCATION + db $ED,SilphCo_LOCATION + db $F8,PokemonLeague_LOCATION + db $FF diff --git a/engine/town_map.asm b/engine/town_map.asm index 9e5eb827..1db61873 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -563,6 +563,21 @@ Func_712f1: ; 712f1 (1c:52f1) ld l, a ret +MapToLocationIndex: + cp REDS_HOUSE_1F + ret c + ld hl, MapToLocationIndexTable +.loop + cp [hl] + jr c, .found + inc hl + inc hl + jr .loop +.found + inc hl + ld a, [hl] + ret + INCLUDE "data/town_map_entries.asm" INCLUDE "text/map_names.asm" diff --git a/wram.asm b/wram.asm index c07b3dab..af8a4b43 100755 --- a/wram.asm +++ b/wram.asm @@ -1286,7 +1286,6 @@ wPokedexSeen:: ; d30a flag_array NUM_POKEMON wPokedexSeenEnd:: - wNumBagItems:: ; d31d ds 1 wBagItems:: ; d31e @@ -2115,6 +2114,9 @@ SECTION "Empty", WRAMX, BANK[1] wPokemonlessBlackout:: ds 1 +wHadEncounterInLocation:: + flag_array NUM_LOCATIONS + SECTION "Stack", WRAMX[$dfff], BANK[1] wStack:: ; dfff ds -$100