2018-06-25 00:10:37 +00:00
|
|
|
GetLandmarkCoords:
|
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
|
2016-05-04 15:46:23 +00:00
|
|
|
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
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
GetLandmarkName::
|
2018-01-23 22:39:09 +00:00
|
|
|
; Copy the name of landmark e to wStringBuffer1.
|
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
|
2016-05-04 15:46:23 +00:00
|
|
|
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
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
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
|
|
|
|
|
2017-12-15 04:00:54 +00:00
|
|
|
INCLUDE "data/maps/landmarks.asm"
|
2013-02-17 07:56:50 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
RegionCheck:
|
2014-05-01 03:44:44 +00:00
|
|
|
; 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 22:39:09 +00:00
|
|
|
ld a, [wMapGroup]
|
2014-05-01 03:44:44 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapNumber]
|
2014-05-01 03:44:44 +00:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
2020-03-15 21:26:10 +00:00
|
|
|
cp LANDMARK_FAST_SHIP ; S.S. Aqua
|
2014-05-01 03:44:44 +00:00
|
|
|
jr z, .johto
|
2020-03-15 21:26:10 +00:00
|
|
|
cp LANDMARK_SPECIAL
|
2014-05-01 03:44:44 +00:00
|
|
|
jr nz, .checkagain
|
|
|
|
|
|
|
|
; In a special map, get the backup map group / map id
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBackupMapGroup]
|
2014-05-01 03:44:44 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBackupMapNumber]
|
2014-05-01 03:44:44 +00:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
|
|
|
|
.checkagain
|
|
|
|
cp KANTO_LANDMARK
|
|
|
|
jr c, .johto
|
|
|
|
|
|
|
|
; Victory Road area is considered to be Johto.
|
2020-03-15 21:26:10 +00:00
|
|
|
cp LANDMARK_VICTORY_ROAD
|
2014-05-01 03:44:44 +00:00
|
|
|
jr c, .kanto
|
|
|
|
|
|
|
|
.johto
|
2018-01-11 17:00:01 +00:00
|
|
|
ld e, JOHTO_REGION
|
2014-05-01 03:44:44 +00:00
|
|
|
ret
|
|
|
|
.kanto
|
2018-01-11 17:00:01 +00:00
|
|
|
ld e, KANTO_REGION
|
2014-05-01 03:44:44 +00:00
|
|
|
ret
|