aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld/tilesets.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-03 09:38:52 -0400
committerGitHub <noreply@github.com>2020-07-03 09:38:52 -0400
commitc85050497c1bd062e9cd40bf5b32fa3beca366cc (patch)
tree9593ddd3ab820223ab580d5fc0ae133b485b8315 /engine/overworld/tilesets.asm
parentActually run .travis/webhook.sh (diff)
parentAdd engine/movie/oak_speech/ subdirectory (diff)
downloadpokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.gz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.xz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.zip
Merge pull request #256 from Rangi42/master
Add subdirectories to engine/ similar to pokecrystal
Diffstat (limited to 'engine/overworld/tilesets.asm')
-rw-r--r--engine/overworld/tilesets.asm60
1 files changed, 60 insertions, 0 deletions
diff --git a/engine/overworld/tilesets.asm b/engine/overworld/tilesets.asm
new file mode 100644
index 00000000..6e33974f
--- /dev/null
+++ b/engine/overworld/tilesets.asm
@@ -0,0 +1,60 @@
+LoadTilesetHeader:
+ call GetPredefRegisters
+ push hl
+ ld d, 0
+ ld a, [wCurMapTileset]
+ add a
+ add a
+ ld b, a
+ add a
+ add b ; a = tileset * 12
+ jr nc, .noCarry
+ inc d
+.noCarry
+ ld e, a
+ ld hl, Tilesets
+ add hl, de
+ ld de, wTilesetBank
+ ld c, $b
+.copyTilesetHeaderLoop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .copyTilesetHeaderLoop
+ 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, .asm_c797
+ ld a, [wCurMapTileset]
+ ld b, a
+ ld a, [hPreviousTileset]
+ cp b
+ jr z, .done
+.asm_c797
+ 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"