tileset_header.asm 877 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. LoadTilesetHeader:
  2. call GetPredefRegisters
  3. push hl
  4. ld d, 0
  5. ld a, [wCurMapTileset]
  6. add a
  7. add a
  8. ld b, a
  9. add a
  10. add b ; a = tileset * 12
  11. jr nc, .noCarry
  12. inc d
  13. .noCarry
  14. ld e, a
  15. ld hl, Tilesets
  16. add hl, de
  17. ld de, wTilesetBank
  18. ld c, $b
  19. .copyTilesetHeaderLoop
  20. ld a, [hli]
  21. ld [de], a
  22. inc de
  23. dec c
  24. jr nz, .copyTilesetHeaderLoop
  25. ld a, [hl]
  26. ld [hTilesetType], a
  27. xor a
  28. ld [$ffd8], a
  29. pop hl
  30. ld a, [wCurMapTileset]
  31. push hl
  32. push de
  33. ld hl, DungeonTilesets
  34. ld de, $1
  35. call IsInArray
  36. pop de
  37. pop hl
  38. jr c, .asm_c797
  39. ld a, [wCurMapTileset]
  40. ld b, a
  41. ld a, [hPreviousTileset]
  42. cp b
  43. jr z, .done
  44. .asm_c797
  45. ld a, [wDestinationWarpID]
  46. cp $ff
  47. jr z, .done
  48. call LoadDestinationWarpPosition
  49. ld a, [wYCoord]
  50. and $1
  51. ld [wYBlockCoord], a
  52. ld a, [wXCoord]
  53. and $1
  54. ld [wXBlockCoord], a
  55. .done
  56. ret
  57. INCLUDE "data/dungeon_tilesets.asm"
  58. INCLUDE "data/tileset_headers.asm"