1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-20 10:33:57 +00:00

Left edge clippping for compiled sprites

This commit is contained in:
David Schmenk 2024-09-11 11:35:23 -07:00
parent b19f7d6d60
commit d70ae2ec1e
2 changed files with 34 additions and 30 deletions

View File

@ -209,7 +209,7 @@ asm _clipX#0
CMP TMPL ; < DST_WIDTH?
BCC VISX ; YEP, FULLY VISIBLE
LDA TMPL ; CLIP WIDTH TO DST_WIDTH
SEC
;SEC
SBC ESTKL-1,X
STA ESTKL-3,X ; WIDTH = DST_WIDTH - X
VISX LDA #$00 ; FULLY VISIBLE
@ -255,7 +255,7 @@ asm _clipY#0
CMP TMPL ; < DST_HEIGHT
BCC VISY ; YEP, FULLY VISIBLE
LDA TMPL ; CLIP HEIGHT TO DST_HEIGHT
SEC
;SEC
SBC ESTKL-2,X
STA ESTKL-4,X ; HEIGHT = DST_HEIGHT - Y
VISY LDA #$00 ; FULLY VISIBLE
@ -984,7 +984,6 @@ asm _clipYMemBl7Scr
JSR $E000 ; CLIPY
BCS RETS7M ; CLIPPED AWAY
BEQ +
BNE +
TAY
- CLC ; ADVANCE TO SRC Y SCANLINE
LDA ESTKL-6,X ; SRCSPAN

View File

@ -51,11 +51,11 @@ def compileSprite#0
end
def dcgrTest#0
word i, j, k, ok7, om7, inci, incj, inck
word backblk, backspan, backw7
word backblk, backspan, backw7, backofst
word restrblk, restrspan, restrw7, restrw
byte mode
mode = 1
mode = 2
setlineplot(@dcgrPlotScr)
setlinespans(@dcgrHLinScr, @dcgrVLinScr)
for i = 0 to 191 step 2
@ -80,39 +80,44 @@ def dcgrTest#0
dcgrScrBl7Mem(0, 170, backw7, 16, backblk, backspan)
restrblk, restrspan, restrw7 = dcgrAllocBl7Mem(16, 16)
restrw = restrw7 * 7
while ^$C000 < 128
ok7, om7 = divmod(k, 7)
dcgrMemBl7Mem(0, 0, restrw7, 16, backblk + ok7 * 4, backspan, restrw7, 16, restrblk, restrspan)
if mode
if om7 < 0; om7 = 6+om7; fin
dcgrOpMem(OP_AND)
dcgrMemBl7Mem(0, 0, sprite7width, 16, sprite7mask[om7], sprite7span, restrw7, 16, restrblk, restrspan)
dcgrOpMem(OP_XOR)
dcgrMemBl7Mem(0, 0, sprite7width, 16, sprite7[om7], sprite7span, restrw7, 16, restrblk, restrspan)
dcgrOpMem(OP_SRC)
if k < 0
dcgrColor(DCLR_WHITE)
dcgrHLinMem(0, restrw - 1, 0, restrblk, restrspan)
dcgrHLinMem(0, restrw - 1, 15, restrblk, restrspan)
dcgrVLinMem(0, 15, 0, restrblk, restrspan)
dcgrVLinMem(0, 15, restrw - 1, restrblk, restrspan)
fin
else
dcgrPixMem(om7 + 2, 0, 16, 16, @sprite, restrw, 16, restrblk, restrspan)
while mode
if ^$C000 >= 128
mode = (^$C010 & $7F) - '0'
fin
dcgrMemBl7Scr(ok7, 170, restrw7, 16, restrblk, restrspan)
if k < 0; getc; fin
ok7, om7 = divmod(k, 7)
when mode
is 1
dcgrPixScr(i, j, 16, 16, @sprite)
is 2
if k < 0 and om7 // Handle off left edge special case
ok7--
om7 = 7 + om7
fin
dcgrMemBl7Mem(0, 0, restrw7, 16, backblk + (ok7 << 2), backspan, restrw7, 16, restrblk, restrspan)
dcgrOpMem(OP_AND)
dcgrMemBl7Mem(0, 0, sprite7width, 16, sprite7mask[om7], sprite7span, restrw7, 16, restrblk, restrspan)
dcgrOpMem(OP_XOR)
dcgrMemBl7Mem(0, 0, sprite7width, 16, sprite7[om7], sprite7span, restrw7, 16, restrblk, restrspan)
dcgrOpMem(OP_SRC)
dcgrMemBl7Scr(ok7, 170, restrw7, 16, restrblk, restrspan)
break
is 3
dcgrPixScr(i, j, 16, 16, @sprite)
is 4
dcgrMemBl7Mem(0, 0, restrw7, 16, backblk + (ok7 << 2), backspan, restrw7, 16, restrblk, restrspan)
dcgrPixMem(om7 + 2, 0, 16, 16, @sprite, restrw, 16, restrblk, restrspan)
dcgrMemBl7Scr(ok7, 170, restrw7, 16, restrblk, restrspan)
break
is 5
dcgrPixScr(i, j, 16, 16, @sprite)
wend
if k > 136 or k < -16; inck = -inck; fin
k = k + inck
//dcgrPixScr(i, j, 16, 16, @sprite)
if i > 102 or i < 23; inci = -inci; fin
i = i + inci
if j > 145 or j < 32; incj = -incj; fin
j = j + incj
mode = !mode
loop
^$C010
getc
end
dcgrMode(0)