diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-31 10:23:19 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-31 10:23:19 -0400 |
commit | bfd9f617c96af851ad4100b752ea967ef8989edc (patch) | |
tree | 078f667a596ee500839f21081c2371ade0ec7950 /engine | |
parent | 70eac3a1f7a27d5b71b968708f423dbbff6b146c (diff) |
Use constants to delineate map types, and factor out more data
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/battle_transitions.asm | 3 | ||||
-rw-r--r-- | engine/battle/wild_encounters.asm | 2 | ||||
-rwxr-xr-x | engine/events/card_key.asm | 15 | ||||
-rwxr-xr-x | engine/events/diploma.asm | 21 | ||||
-rw-r--r-- | engine/events/hidden_objects/bench_guys.asm | 23 | ||||
-rwxr-xr-x | engine/events/pokedex_rating.asm | 48 | ||||
-rwxr-xr-x | engine/gfx/palettes.asm | 6 | ||||
-rwxr-xr-x | engine/items/item_effects.asm | 43 | ||||
-rwxr-xr-x | engine/items/town_map.asm | 14 | ||||
-rwxr-xr-x | engine/overworld/map_sprites.asm | 2 | ||||
-rw-r--r-- | engine/overworld/missable_objects.asm | 2 |
11 files changed, 47 insertions, 132 deletions
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 98040fa1..3a6db0b5 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -118,9 +118,6 @@ GetBattleTransitionID_CompareLevels: ld [wBattleTransitionSpiralDirection], a ret -; fails to recognize VICTORY_ROAD_2F, VICTORY_ROAD_3F, all ROCKET_HIDEOUT maps, -; POKEMON_MANSION_1F, SEAFOAM_ISLANDS_[B1F-B4F], POWER_PLANT, DIGLETTS_CAVE -; and SILPH_CO_[9-11]F as dungeon maps GetBattleTransitionID_IsDungeonMap: ld a, [wCurMap] ld e, a diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index e24f9632..8c9c1529 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -39,7 +39,7 @@ TryDoWildEncounter: ; so long as the map is "indoor" and has wild pokemon defined. ; ...as long as it's not Viridian Forest or Safari Zone. ld a, [wCurMap] - cp REDS_HOUSE_1F ; is this an indoor map? + cp FIRST_INDOOR_MAP ; is this an indoor map? jr c, .CantEncounter2 ld a, [wCurMapTileset] cp FOREST ; Viridian Forest/Safari Zone diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index 7ac39a6f..b052d3e2 100755 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -4,7 +4,7 @@ PrintCardKeyText: ld b, a .silphCoMapListLoop ld a, [hli] - cp $ff + cp -1 ret z cp b jr nz, .silphCoMapListLoop @@ -58,18 +58,7 @@ PrintCardKeyText: ldh [hSpriteIndexOrTextID], a jp PrintPredefTextID -SilphCoMapList: - db SILPH_CO_2F - db SILPH_CO_3F - db SILPH_CO_4F - db SILPH_CO_5F - db SILPH_CO_6F - db SILPH_CO_7F - db SILPH_CO_8F - db SILPH_CO_9F - db SILPH_CO_10F - db SILPH_CO_11F - db $FF +INCLUDE "data/events/card_key_maps.asm" CardKeySuccessText:: text_far _CardKeySuccessText1 diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index c282b49b..91541f09 100755 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -83,17 +83,18 @@ UnusedPlayerNameLengthFunc: dec c jr .loop +diploma_text: MACRO + dw \3 + dwcoord \1, \2 +ENDM + DiplomaTextPointersAndCoords: - dw DiplomaText - dwcoord 5, 2 - dw DiplomaPlayer - dwcoord 3, 4 - dw DiplomaEmptyText - dwcoord 15, 4 - dw DiplomaCongrats - dwcoord 2, 6 - dw DiplomaGameFreak - dwcoord 9, 16 + ; x, y, text + diploma_text 5, 2, DiplomaText + diploma_text 3, 4, DiplomaPlayer + diploma_text 15, 4, DiplomaEmptyText + diploma_text 2, 6, DiplomaCongrats + diploma_text 9, 16, DiplomaGameFreak DiplomaText: db CIRCLE_TILE_ID, "Diploma", CIRCLE_TILE_ID, "@" diff --git a/engine/events/hidden_objects/bench_guys.asm b/engine/events/hidden_objects/bench_guys.asm index 2a38e0d1..b41434ad 100644 --- a/engine/events/hidden_objects/bench_guys.asm +++ b/engine/events/hidden_objects/bench_guys.asm @@ -17,30 +17,11 @@ PrintBenchGuyText: ld b, a ld a, [wSpritePlayerStateData1FacingDirection] cp b - jr nz, .loop ; player isn't facing left at the bench guy + jr nz, .loop ; player isn't facing the bench guy ld a, [hl] jp PrintPredefTextID -bench_guy_text: MACRO - db \1, \2 - db_tx_pre \3 -ENDM - -BenchGuyTextPointers: - ; map id, player facing direction, predef text - bench_guy_text VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT, ViridianCityPokecenterBenchGuyText - bench_guy_text PEWTER_POKECENTER, SPRITE_FACING_LEFT, PewterCityPokecenterBenchGuyText - bench_guy_text CERULEAN_POKECENTER, SPRITE_FACING_LEFT, CeruleanCityPokecenterBenchGuyText - bench_guy_text LAVENDER_POKECENTER, SPRITE_FACING_LEFT, LavenderCityPokecenterBenchGuyText - bench_guy_text VERMILION_POKECENTER, SPRITE_FACING_LEFT, VermilionCityPokecenterBenchGuyText - bench_guy_text CELADON_POKECENTER, SPRITE_FACING_LEFT, CeladonCityPokecenterBenchGuyText - bench_guy_text CELADON_HOTEL, SPRITE_FACING_LEFT, CeladonCityHotelText - bench_guy_text FUCHSIA_POKECENTER, SPRITE_FACING_LEFT, FuchsiaCityPokecenterBenchGuyText - bench_guy_text CINNABAR_POKECENTER, SPRITE_FACING_LEFT, CinnabarIslandPokecenterBenchGuyText - bench_guy_text SAFFRON_POKECENTER, SPRITE_FACING_LEFT, SaffronCityPokecenterBenchGuyText - bench_guy_text MT_MOON_POKECENTER, SPRITE_FACING_LEFT, MtMoonPokecenterBenchGuyText - bench_guy_text ROCK_TUNNEL_POKECENTER, SPRITE_FACING_LEFT, RockTunnelPokecenterBenchGuyText - db -1 ; end +INCLUDE "data/events/bench_guys.asm" ViridianCityPokecenterBenchGuyText:: text_far _ViridianCityPokecenterGuyText diff --git a/engine/events/pokedex_rating.asm b/engine/events/pokedex_rating.asm index 490ae05a..c61253b7 100755 --- a/engine/events/pokedex_rating.asm +++ b/engine/events/pokedex_rating.asm @@ -56,38 +56,22 @@ PokedexRatingText_441cc: text_end DexRatingsTable: - db 10 - dw PokedexRatingText_44201 - db 20 - dw PokedexRatingText_44206 - db 30 - dw PokedexRatingText_4420b - db 40 - dw PokedexRatingText_44210 - db 50 - dw PokedexRatingText_44215 - db 60 - dw PokedexRatingText_4421a - db 70 - dw PokedexRatingText_4421f - db 80 - dw PokedexRatingText_44224 - db 90 - dw PokedexRatingText_44229 - db 100 - dw PokedexRatingText_4422e - db 110 - dw PokedexRatingText_44233 - db 120 - dw PokedexRatingText_44238 - db 130 - dw PokedexRatingText_4423d - db 140 - dw PokedexRatingText_44242 - db 150 - dw PokedexRatingText_44247 - db NUM_POKEMON + 1 - dw PokedexRatingText_4424c + dbw 10, PokedexRatingText_44201 + dbw 20, PokedexRatingText_44206 + dbw 30, PokedexRatingText_4420b + dbw 40, PokedexRatingText_44210 + dbw 50, PokedexRatingText_44215 + dbw 60, PokedexRatingText_4421a + dbw 70, PokedexRatingText_4421f + dbw 80, PokedexRatingText_44224 + dbw 90, PokedexRatingText_44229 + dbw 100, PokedexRatingText_4422e + dbw 110, PokedexRatingText_44233 + dbw 120, PokedexRatingText_44238 + dbw 130, PokedexRatingText_4423d + dbw 140, PokedexRatingText_44242 + dbw 150, PokedexRatingText_44247 + dbw NUM_POKEMON + 1, PokedexRatingText_4424c PokedexRatingText_44201: text_far _OaksLabText_44201 diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index f2019e85..f25ff215 100755 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -145,11 +145,11 @@ SetPal_Overworld: cp CAVERN jr z, .caveOrBruno ld a, [wCurMap] - cp REDS_HOUSE_1F + cp FIRST_INDOOR_MAP jr c, .townOrRoute cp CERULEAN_CAVE_2F jr c, .normalDungeonOrBuilding - cp NAME_RATERS_HOUSE + cp CERULEAN_CAVE_1F + 1 jr c, .caveOrBruno cp LORELEIS_ROOM jr z, .Lorelei @@ -158,7 +158,7 @@ SetPal_Overworld: .normalDungeonOrBuilding ld a, [wLastMap] ; town or route that current dungeon or building is located .townOrRoute - cp SAFFRON_CITY + 1 + cp NUM_CITY_MAPS jr c, .town ld a, PAL_ROUTE - 1 .town diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 05f8038f..9a030d9d 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1573,7 +1573,7 @@ ItemUseCardKey: ld b, a .loop ld a, [hli] - cp $ff + cp -1 jp z, ItemUseNotTime cp b jr nz, .nextEntry1 @@ -1600,46 +1600,7 @@ ItemUseCardKey: set 7, [hl] ret -; These tables are probably supposed to be door locations in Silph Co., -; but they are unused. -; The reason there are 3 tables is unknown. - -; Format: -; 00: Map ID -; 01: Y -; 02: X -; 03: ID? - -CardKeyTable1: - db SILPH_CO_2F,$04,$04,$00 - db SILPH_CO_2F,$04,$05,$01 - db SILPH_CO_4F,$0C,$04,$02 - db SILPH_CO_4F,$0C,$05,$03 - db SILPH_CO_7F,$06,$0A,$04 - db SILPH_CO_7F,$06,$0B,$05 - db SILPH_CO_9F,$04,$12,$06 - db SILPH_CO_9F,$04,$13,$07 - db SILPH_CO_10F,$08,$0A,$08 - db SILPH_CO_10F,$08,$0B,$09 - db $ff - -CardKeyTable2: - db SILPH_CO_3F,$08,$09,$0A - db SILPH_CO_3F,$09,$09,$0B - db SILPH_CO_5F,$04,$07,$0C - db SILPH_CO_5F,$05,$07,$0D - db SILPH_CO_6F,$0C,$05,$0E - db SILPH_CO_6F,$0D,$05,$0F - db SILPH_CO_8F,$08,$07,$10 - db SILPH_CO_8F,$09,$07,$11 - db SILPH_CO_9F,$08,$03,$12 - db SILPH_CO_9F,$09,$03,$13 - db $ff - -CardKeyTable3: - db SILPH_CO_11F,$08,$09,$14 - db SILPH_CO_11F,$09,$09,$15 - db $ff +INCLUDE "data/events/card_key_coords.asm" ItemUsePokedoll: ld a, [wIsInBattle] diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 83ea81bf..42d313d9 100755 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -1,3 +1,5 @@ +NOT_VISITED EQU $fe + DisplayTownMap: call LoadTownMap ld hl, wUpdateSpritesEnabled @@ -224,7 +226,7 @@ LoadTownMap_Fly:: ld a, [hl] cp $ff jr z, .wrapToStartOfList - cp $fe + cp NOT_VISITED jr z, .pressedUp ; skip past unvisited towns jp .townMapFlyLoop .wrapToStartOfList @@ -236,11 +238,11 @@ LoadTownMap_Fly:: ld a, [hl] cp $ff jr z, .wrapToEndOfList - cp $fe + cp NOT_VISITED jr z, .pressedDown ; skip past unvisited towns jp .townMapFlyLoop .wrapToEndOfList - ld hl, wFlyLocationsList + 11 + ld hl, wFlyLocationsList + NUM_CITY_MAPS jr .pressedDown ToText: @@ -254,11 +256,11 @@ BuildFlyLocationsList: ld e, a ld a, [wTownVisitedFlag + 1] ld d, a - ld bc, SAFFRON_CITY + 1 + lb bc, 0, NUM_CITY_MAPS .loop srl d rr e - ld a, $fe ; store $fe if the town hasn't been visited + ld a, NOT_VISITED jr nc, .notVisited ld a, b ; store the map number of the town if it has been visited .notVisited @@ -554,7 +556,7 @@ ZeroOutDuplicatesInList: LoadTownMapEntry: ; in: a = map number ; out: lower nybble of [de] = x, upper nybble of [de] = y, hl = address of name - cp REDS_HOUSE_1F + cp FIRST_INDOOR_MAP jr c, .external ld bc, 4 ld hl, InternalMapEntries diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 031ddc76..fa3a37dc 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -255,7 +255,7 @@ ReadSpriteSheetData: ; sets carry if the map is a city or route, unsets carry if not InitOutsideMapSprites: ld a, [wCurMap] - cp REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? + cp FIRST_INDOOR_MAP ; is the map a city or a route? ret nc ; if not, return ld hl, MapSpriteSets add l diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index fd2fe578..31fdc257 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -1,6 +1,6 @@ MarkTownVisitedAndLoadMissableObjects:: ld a, [wCurMap] - cp ROUTE_1 + cp FIRST_ROUTE_MAP jr nc, .notInTown ld c, a ld b, FLAG_SET |