pokecrystal-board/engine/landmarks.asm
Remy Oukaour 31cce83e9b Move lots of data tables into individual data/ files
(This is not expected to be their final location, but it makes them easier to relocate when necessary, and easier for users to edit until the whole project's file structure is finalized.)
2017-12-11 14:23:18 -05:00

89 lines
1.2 KiB
NASM

GetLandmarkCoords: ; 0x1ca896
; Return coordinates (d, e) of landmark e.
push hl
ld l, e
ld h, 0
add hl, hl
add hl, hl
ld de, Landmarks
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
ret
; 0x1ca8a5
GetLandmarkName:: ; 0x1ca8a5
; Copy the name of landmark e to StringBuffer1.
push hl
push de
push bc
ld l, e
ld h, 0
add hl, hl
add hl, hl
ld de, Landmarks + 2
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, StringBuffer1
ld c, 18
.copy
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .copy
pop bc
pop de
pop hl
ret
; 0x1ca8c3
Landmarks: ; 0x1ca8c3
INCLUDE "data/landmarks.asm"
RegionCheck: ; 0x1caea1
; Checks if the player is in Kanto or Johto.
; If in Johto, returns 0 in e.
; If in Kanto, returns 1 in e.
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp FAST_SHIP ; S.S. Aqua
jr z, .johto
cp SPECIAL_MAP
jr nz, .checkagain
; In a special map, get the backup map group / map id
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
.checkagain
cp KANTO_LANDMARK
jr c, .johto
; Victory Road area is considered to be Johto.
cp VICTORY_ROAD
jr c, .kanto
.johto
ld e, 0
ret
.kanto
ld e, 1
ret