summaryrefslogtreecommitdiff
path: root/engine/events/set_blackout_map.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/events/set_blackout_map.asm')
-rw-r--r--engine/events/set_blackout_map.asm25
1 files changed, 25 insertions, 0 deletions
diff --git a/engine/events/set_blackout_map.asm b/engine/events/set_blackout_map.asm
new file mode 100644
index 00000000..14f0ba28
--- /dev/null
+++ b/engine/events/set_blackout_map.asm
@@ -0,0 +1,25 @@
+SetLastBlackoutMap:
+; Set the map to return to when
+; blacking out or using Teleport or Dig.
+; Safari rest houses don't count.
+
+ push hl
+ ld hl, SafariZoneRestHouses
+ ld a, [wCurMap]
+ ld b, a
+.loop
+ ld a, [hli]
+ cp -1
+ jr z, .notresthouse
+ cp b
+ jr nz, .loop
+ jr .done
+
+.notresthouse
+ ld a, [wLastMap]
+ ld [wLastBlackoutMap], a
+.done
+ pop hl
+ ret
+
+INCLUDE "data/rest_house_maps.asm"