shithub: pokered

ref: 929c7f6f7d62b4b22e1de2003b3df1943268321c
dir: /engine/overworld/set_blackout_map.asm/

View raw version
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"