summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home.asm27
-rw-r--r--home/map.asm8
-rwxr-xr-xhome/region.asm32
-rw-r--r--wram.asm8
4 files changed, 42 insertions, 33 deletions
diff --git a/home.asm b/home.asm
index b6ca4562..0ddd8f15 100644
--- a/home.asm
+++ b/home.asm
@@ -75,32 +75,7 @@ Unreferenced_CheckFieldDebug::
INCLUDE "home/sprite_updates.asm"
INCLUDE "home/string.asm"
-
-IsInJohto::
- ld a, [wMapGroup]
- ld b, a
- ld a, [wMapNumber]
- ld c, a
- call GetWorldMapLocation
- cp $5e
- jr z, .asm_2ff9
- cp $0
- jr nz, .asm_2ff5
- ld a, [wd9f6]
- ld b, a
- ld a, [wd9f7]
- ld c, a
- call GetWorldMapLocation
-.asm_2ff5
- cp $2e
- jr nc, .asm_2ffb
-.asm_2ff9
- xor a
- ret
-
-.asm_2ffb
- ld a, $1
- ret
+INCLUDE "home/region.asm"
Function2ffe:: ; 2ffe (0:2ffe)
push hl
diff --git a/home/map.asm b/home/map.asm
index ebdd00ff..53b4c295 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -589,7 +589,7 @@ Function230f:: ; 230f (0:230f)
ld a, [hli]
cp $ff
jr nz, .asm_232b
- ld hl, wd9f5
+ ld hl, wBackupWarpNumber
ld a, [hli]
.asm_232b
pop bc
@@ -976,11 +976,11 @@ RestoreFacingAfterWarp::
BackUpWarp:: ; 2596 (0:2596)
ld a, [wPrevWarpNumber]
- ld [wd9f5], a
+ ld [wBackupWarpNumber], a
ld a, [wPrevMapGroup]
- ld [wd9f6], a
+ ld [wBackupMapGroup], a
ld a, [wPrevMapNumber]
- ld [wd9f7], a
+ ld [wBackupMapNumber], a
ret
GetCoordOfUpperLeftCorner:: ; 25a9 (0:25a9)
diff --git a/home/region.asm b/home/region.asm
new file mode 100755
index 00000000..e6391fb4
--- /dev/null
+++ b/home/region.asm
@@ -0,0 +1,32 @@
+IsInJohto::
+; Return 0 if the player is in Johto, and 1 in Kanto.
+
+ ld a, [wMapGroup]
+ ld b, a
+ ld a, [wMapNumber]
+ ld c, a
+ call GetWorldMapLocation
+
+ cp FAST_SHIP
+ jr z, .Johto
+
+ cp SPECIAL_MAP
+ jr nz, .CheckRegion
+
+ ld a, [wBackupMapGroup]
+ ld b, a
+ ld a, [wBackupMapNumber]
+ ld c, a
+ call GetWorldMapLocation
+
+.CheckRegion:
+ cp KANTO_LANDMARK
+ jr nc, .Kanto
+
+.Johto:
+ xor a
+ ret
+
+.Kanto:
+ ld a, 1
+ ret \ No newline at end of file
diff --git a/wram.asm b/wram.asm
index 0c6d12c1..373d0d63 100644
--- a/wram.asm
+++ b/wram.asm
@@ -3553,9 +3553,11 @@ wMapData::
wVisitedSpawns:: ds 4 ; flag_array NUM_SPAWNS ; d9ee
warp_struct wDig ; d9f2
-wd9f5:: ds 1 ; d9f5
-wd9f6:: ds 1 ; d9f6
-wd9f7:: ds 1 ; d9f7
+
+wBackupWarpNumber:: db ; d9f5
+wBackupMapGroup:: db ; d9f6
+wBackupMapNumber:: db ; d9f7
+
wd9f8:: ds 1 ; d9f8
wd9f9:: ds 1 ; d9f9
wd9fa:: ds 1 ; d9fa