pokecrystal-board/engine/overworld/landmarks.asm

83 lines
1.1 KiB
NASM
Raw Normal View History

GetLandmarkCoords:
2013-11-28 00:54:21 -08:00
; Return coordinates (d, e) of landmark e.
2013-02-16 23:56:50 -08:00
push hl
ld l, e
2013-11-28 00:54:21 -08:00
ld h, 0
2013-02-16 23:56:50 -08:00
add hl, hl
add hl, hl
2013-02-16 23:56:50 -08:00
ld de, Landmarks
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
ret
GetLandmarkName::
2018-01-23 14:39:09 -08:00
; Copy the name of landmark e to wStringBuffer1.
2013-02-16 23:56:50 -08:00
push hl
push de
push bc
2013-11-28 00:54:21 -08:00
2013-02-16 23:56:50 -08:00
ld l, e
2013-11-28 00:54:21 -08:00
ld h, 0
2013-02-16 23:56:50 -08:00
add hl, hl
add hl, hl
2013-11-28 00:54:21 -08:00
ld de, Landmarks + 2
2013-02-16 23:56:50 -08:00
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
2013-11-28 00:54:21 -08:00
2018-01-23 14:39:09 -08:00
ld de, wStringBuffer1
2013-02-16 23:56:50 -08:00
ld c, 18
2013-11-28 00:54:21 -08:00
.copy
2013-02-16 23:56:50 -08:00
ld a, [hli]
ld [de], a
inc de
dec c
2013-11-28 00:54:21 -08:00
jr nz, .copy
2013-02-16 23:56:50 -08:00
pop bc
pop de
pop hl
ret
INCLUDE "data/maps/landmarks.asm"
2013-02-16 23:56:50 -08:00
RegionCheck:
; Checks if the player is in Kanto or Johto.
; If in Johto, returns 0 in e.
; If in Kanto, returns 1 in e.
2018-01-23 14:39:09 -08:00
ld a, [wMapGroup]
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wMapNumber]
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
2018-01-23 14:39:09 -08:00
ld a, [wBackupMapGroup]
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wBackupMapNumber]
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
2018-01-11 09:00:01 -08:00
ld e, JOHTO_REGION
ret
.kanto
2018-01-11 09:00:01 -08:00
ld e, KANTO_REGION
ret