mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Use constants to delineate map types, and factor out more data
This commit is contained in:
parent
70eac3a1f7
commit
bfd9f617c9
17 changed files with 126 additions and 135 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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, "@"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue