2018-06-24 17:10:37 -07:00
|
|
|
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
|
2016-05-04 08:46:23 -07:00
|
|
|
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
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
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
|
2016-05-04 08:46:23 -07:00
|
|
|
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
|
|
|
|
|
2017-12-14 20:00:54 -08:00
|
|
|
INCLUDE "data/maps/landmarks.asm"
|
2013-02-16 23:56:50 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
RegionCheck:
|
2014-04-30 20:44:44 -07: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 14:39:09 -08:00
|
|
|
ld a, [wMapGroup]
|
2014-04-30 20:44:44 -07:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMapNumber]
|
2014-04-30 20:44:44 -07:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
2020-03-15 14:26:10 -07:00
|
|
|
cp LANDMARK_FAST_SHIP ; S.S. Aqua
|
2014-04-30 20:44:44 -07:00
|
|
|
jr z, .johto
|
2020-03-15 14:26:10 -07:00
|
|
|
cp LANDMARK_SPECIAL
|
2014-04-30 20:44:44 -07:00
|
|
|
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]
|
2014-04-30 20:44:44 -07:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBackupMapNumber]
|
2014-04-30 20:44:44 -07:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
|
|
|
|
.checkagain
|
|
|
|
cp KANTO_LANDMARK
|
|
|
|
jr c, .johto
|
|
|
|
|
|
|
|
; Victory Road area is considered to be Johto.
|
2020-03-15 14:26:10 -07:00
|
|
|
cp LANDMARK_VICTORY_ROAD
|
2014-04-30 20:44:44 -07:00
|
|
|
jr c, .kanto
|
|
|
|
|
|
|
|
.johto
|
2018-01-11 09:00:01 -08:00
|
|
|
ld e, JOHTO_REGION
|
2014-04-30 20:44:44 -07:00
|
|
|
ret
|
|
|
|
.kanto
|
2018-01-11 09:00:01 -08:00
|
|
|
ld e, KANTO_REGION
|
2014-04-30 20:44:44 -07:00
|
|
|
ret
|