summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2014-05-01 22:43:19 -0500
committerBryan Bishop <kanzure@gmail.com>2014-05-01 22:43:19 -0500
commit6fbb99786f73b0ba198dec8530088aba46734304 (patch)
tree4bbaf274cad5e78e4f4098b785cad1a8242fde90 /engine
parent0e29ab2428e0f0dfb8bd7442d1010acaad285cd8 (diff)
parent7e4744fdaf9ec1a9d260a2e7717af3023a49d326 (diff)
Merge pull request #248 from yenatch/master
Trainer card graphics, Kanto Special stats, unused item constants, mobile adapter lib
Diffstat (limited to 'engine')
-rw-r--r--engine/landmarks.asm37
1 files changed, 37 insertions, 0 deletions
diff --git a/engine/landmarks.asm b/engine/landmarks.asm
index 1d050da77..28c0d60a9 100644
--- a/engine/landmarks.asm
+++ b/engine/landmarks.asm
@@ -255,3 +255,40 @@ UndergroundName: db "UNDERGROUND@"
BattleTowerName: db "BATTLE", $1f, "TOWER@"
SpecialMapName: db "SPECIAL@"
+
+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
+