summaryrefslogtreecommitdiff
path: root/engine/overworld/tileset_header.asm
diff options
context:
space:
mode:
authorDaniel Harding <33dannye@gmail.com>2020-05-20 20:17:30 -0500
committerGitHub <noreply@github.com>2020-05-20 20:17:30 -0500
commit500d99c258145d233af8d14cdb5c6e0200dfc1d8 (patch)
tree7dbe7b152dde8a6e9b56664b5b8cdfc0d6be1253 /engine/overworld/tileset_header.asm
parentb8954732a3eaa3a784a6e3eaaa68977a9ccd9816 (diff)
parent33456b8fb28ef547a54d04d22baa2313b72fdb1d (diff)
Merge pull request #50 from dannye/master
merge pokered
Diffstat (limited to 'engine/overworld/tileset_header.asm')
-rw-r--r--engine/overworld/tileset_header.asm51
1 files changed, 51 insertions, 0 deletions
diff --git a/engine/overworld/tileset_header.asm b/engine/overworld/tileset_header.asm
new file mode 100644
index 00000000..05061651
--- /dev/null
+++ b/engine/overworld/tileset_header.asm
@@ -0,0 +1,51 @@
+LoadTilesetHeader:
+ call GetPredefRegisters
+ push hl
+ ld d, 0
+ ld a, [wCurMapTileset]
+ add a
+ add a
+ ld e, a
+ ld hl, Tilesets
+ add hl, de
+ add hl, de
+ add hl, de
+ ld de, wTilesetBank
+ ld bc, $b
+ call CopyData
+ ld a, [hl]
+ ld [hTilesetType], a
+ xor a
+ ld [$ffd8], a
+ pop hl
+ ld a, [wCurMapTileset]
+ push hl
+ push de
+ ld hl, DungeonTilesets
+ ld de, $1
+ call IsInArray
+ pop de
+ pop hl
+ jr c, .notDungeonTileset
+ ld a, [wCurMapTileset]
+ ld b, a
+ ld a, [hPreviousTileset]
+ cp b
+ jr z, .done
+.notDungeonTileset
+ ld a, [wDestinationWarpID]
+ cp $ff
+ jr z, .done
+ call LoadDestinationWarpPosition
+ ld a, [wYCoord]
+ and $1
+ ld [wYBlockCoord], a
+ ld a, [wXCoord]
+ and $1
+ ld [wXBlockCoord], a
+.done
+ ret
+
+INCLUDE "data/dungeon_tilesets.asm"
+
+INCLUDE "data/tileset_headers.asm"