mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-11-23 03:33:11 +00:00
Fix masking bug in sprite pre-calc
This commit is contained in:
parent
54474bbe5f
commit
9d401a5861
@ -586,7 +586,7 @@ SPRITE_PLANE_SPAN equ VBUFF_STRIDE_BYTES ; 52
|
|||||||
; X = sprite index
|
; X = sprite index
|
||||||
_PrecalcAllSpriteInfo
|
_PrecalcAllSpriteInfo
|
||||||
lda _Sprites+SPRITE_ID,x
|
lda _Sprites+SPRITE_ID,x
|
||||||
and #$2E00
|
and #$3E00
|
||||||
xba
|
xba
|
||||||
sta _Sprites+SPRITE_DISP,x ; use bits 9 through 13 for full dispatch
|
sta _Sprites+SPRITE_DISP,x ; use bits 9 through 13 for full dispatch
|
||||||
|
|
||||||
|
@ -114,9 +114,12 @@ _MarkDirtySprite
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0007
|
and #$0007
|
||||||
clc
|
pha
|
||||||
adc _Sprites+SPRITE_CLIP_HEIGHT,y
|
|
||||||
|
lda _Sprites+SPRITE_CLIP_HEIGHT,y ; Nominal value between 0 and 16+7 = 23 = 10111
|
||||||
dec
|
dec
|
||||||
|
clc
|
||||||
|
adc 1,s
|
||||||
and #$0018
|
and #$0018
|
||||||
sta AreaIndex
|
sta AreaIndex
|
||||||
|
|
||||||
@ -135,13 +138,17 @@ _MarkDirtySprite
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0003
|
and #$0003
|
||||||
clc
|
sta 1,s
|
||||||
adc _Sprites+SPRITE_CLIP_WIDTH,y
|
|
||||||
|
lda _Sprites+SPRITE_CLIP_WIDTH,y ; max width = 8 = 0x08
|
||||||
dec
|
dec
|
||||||
and #$000C
|
clc
|
||||||
lsr
|
adc 1,s
|
||||||
|
lsr ; max value = 4 = 0x04
|
||||||
|
and #$0006
|
||||||
ora AreaIndex
|
ora AreaIndex
|
||||||
sta AreaIndex
|
sta AreaIndex
|
||||||
|
pla
|
||||||
|
|
||||||
; Calculate the modified origin address for the sprite. We need to look at the sprite flip bits
|
; Calculate the modified origin address for the sprite. We need to look at the sprite flip bits
|
||||||
; to determine which of the four sprite stamps is the correct one to use. Then, offset that origin
|
; to determine which of the four sprite stamps is the correct one to use. Then, offset that origin
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
_DrawSpriteSheet
|
_DrawSpriteSheet
|
||||||
DISP_VFLIP equ $0004 ; hard code these because they are internal values
|
DISP_VFLIP equ $0004 ; hard code these because they are internal values
|
||||||
DISP_HFLIP equ $0002
|
DISP_HFLIP equ $0002
|
||||||
DISP_MASK equ $00F9
|
DISP_MASK equ $0018 ; Isolate the size bits
|
||||||
|
|
||||||
phx
|
phx
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user