pokecrystal/engine/landmarks.asm

88 lines
1.2 KiB
NASM
Raw Normal View History

2013-02-17 07:56:50 +00:00
GetLandmarkCoords: ; 0x1ca896
2013-11-28 08:54:21 +00:00
; Return coordinates (d, e) of landmark e.
2013-02-17 07:56:50 +00:00
push hl
ld l, e
2013-11-28 08:54:21 +00:00
ld h, 0
2013-02-17 07:56:50 +00:00
add hl, hl
add hl, hl
2013-02-17 07:56:50 +00:00
ld de, Landmarks
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
ret
2013-11-28 08:54:21 +00:00
; 0x1ca8a5
2013-02-17 07:56:50 +00:00
GetLandmarkName:: ; 0x1ca8a5
2013-11-28 08:54:21 +00:00
; Copy the name of landmark e to StringBuffer1.
2013-02-17 07:56:50 +00:00
push hl
push de
push bc
2013-11-28 08:54:21 +00:00
2013-02-17 07:56:50 +00:00
ld l, e
2013-11-28 08:54:21 +00:00
ld h, 0
2013-02-17 07:56:50 +00:00
add hl, hl
add hl, hl
2013-11-28 08:54:21 +00:00
ld de, Landmarks + 2
2013-02-17 07:56:50 +00:00
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
2013-11-28 08:54:21 +00:00
ld de, StringBuffer1
2013-02-17 07:56:50 +00:00
ld c, 18
2013-11-28 08:54:21 +00:00
.copy
2013-02-17 07:56:50 +00:00
ld a, [hli]
ld [de], a
inc de
dec c
2013-11-28 08:54:21 +00:00
jr nz, .copy
2013-02-17 07:56:50 +00:00
pop bc
pop de
pop hl
ret
2013-11-28 08:54:21 +00:00
; 0x1ca8c3
2013-02-17 07:56:50 +00:00
INCLUDE "data/landmarks.asm"
2013-02-17 07:56:50 +00:00
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