metasprites.s (1575B)
1 .include "global.s" 2 3 .title "Metasprites" 4 .module Metasprites 5 6 .area _DATA 7 8___current_metasprite:: 9 .ds 0x02 10___current_base_tile:: 11 .ds 0x01 12 13 .area _INITIALIZED 14___render_shadow_OAM:: 15 .ds 0x01 16 17 .area _INITIALIZER 18 .db #>_shadow_OAM 19 20 .area _CODE 21 22; uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) 23 24___move_metasprite:: 25 ldhl sp, #4 26 ld a, (hl-) 27 ld b, a 28 ld a, (hl-) 29 ld c, a 30 ld a, (hl) 31 cp #40 32 jr nc, 3$ 33 34 add a 35 add a 36 ld e, a 37 38 ld hl, #___current_metasprite 39 ld a, (hl+) 40 ld h, (hl) 41 ld l, a 42 43 ld a, (___render_shadow_OAM) 44 ld d, a 451$: 46 ld a, (hl+) ; dy 47 cp #0x80 48 jr z, 2$ 49 add b 50 ld b, a 51 ld (de), a 52 inc e 53 54 ld a, (hl+) ; dx 55 add c 56 ld c, a 57 ld (de), a 58 inc e 59 60 ld a, (___current_base_tile) 61 add (hl) ; tile 62 inc hl 63 ld (de), a 64 inc e 65 66 ld a, (hl+) ; props 67 ld (de), a 68 inc e 69 70 ld a, e 71 cp #160 72 jr c, 1$ 732$: 74 ld a, e 75 srl a 76 srl a 77 ldhl sp, #2 783$: 79 sub (hl) 80 ld e, a 81 82 ret