You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
866 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. INCLUDE "hardware.inc"
  2. INCLUDE "png/map/intro.inc"
  3. SECTION "BG Data", WRAM0
  4. BG_COLLISION_DATA:: dw
  5. BG_MAP_WIDTH:: db
  6. BG_MAP_HEIGHT:: db
  7. SECTION "BG Code", ROM0
  8. MACRO update_map_info
  9. ld hl, BG_COLLISION_DATA
  10. ld a, HIGH(\1)
  11. ld [hl+], a
  12. ld a, LOW(\1)
  13. ld [hl+], a
  14. ld a, \2
  15. ld [hl+], a
  16. ld a, \3
  17. ld [hl+], a
  18. ENDM
  19. BG_Init::
  20. ; copy map
  21. ld e, intro_HEIGHT
  22. ld bc, _SCRN0
  23. ld hl, intro_MAP
  24. .copy_map_row:
  25. ld d, intro_WIDTH
  26. call memcpy
  27. dec e
  28. jr z, .done
  29. ld d, 32 - intro_WIDTH
  30. .skip:
  31. ; skip over trailing part in vram
  32. inc c
  33. jr nz, .nocarry
  34. inc b
  35. .nocarry:
  36. dec d
  37. jr nz, .skip
  38. jr .copy_map_row
  39. .done:
  40. ; copy tiles
  41. ld hl, intro_TILES
  42. ld bc, _VRAM
  43. ld d, intro_NUM_TILES
  44. call memcpy
  45. update_map_info intro_COLLISION, intro_WIDTH, intro_HEIGHT
  46. ret