sprite animation testing
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.

60 lines
1.1KB

  1. ;----------------
  2. ; Animation Subs
  3. ;----------------
  4. SECTION "Animation Variables", HRAM
  5. hCameraX: dw
  6. hCameraY: dw
  7. hWorkingX: dw
  8. hWorkingY: dw
  9. hWorkingScreenX: db
  10. hWorkingScreenY: db
  11. hWorkingState: db
  12. hWorkingCounter: db
  13. hWorkingData: dw
  14. hWorkingTile: dw
  15. hWorkingEnd:
  16. SECTION "Animations Subs", ROM0
  17. ; RenderActor:
  18. ; takes a pointer to an actor struct
  19. ; and renders it to shadow OAM, advancinc
  20. ; the animation frame and constructing
  21. ; each frame as needed.
  22. ; initial input:
  23. ; [hl] <- start of Actor Struct in WRAM
  24. ; output:
  25. ; an oam object for each line in the frame data,
  26. ; copied to shadowOAM (wShadowOAM)
  27. RenderActor::
  28. ; load world X and Y to temp RAM
  29. ld a, [hli]
  30. ld [hWorkingX], a
  31. ld a, [hli]
  32. ld [hWorkingX+1], a
  33. ld a, [hli]
  34. ld [hWorkingY], a
  35. ld a, [hli]
  36. ld [hWorkingY+1], a
  37. ; done loading X and Y
  38. ; figure out if within 256 of camera
  39. ; ---------
  40. ; first compare upper byte of XXYY
  41. ; if this is more than 1 away, break
  42. ld a, [hCameraX]
  43. ld b, a
  44. ld a, [hWorkingX]
  45. ; b = camera byte
  46. ; a = actor byte
  47. ; work out if actor minus camera is <= 1
  48. sub b
  49. ; ---------
  50. .skipRendering