mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-11-26 07:49:17 +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
|
||||
_PrecalcAllSpriteInfo
|
||||
lda _Sprites+SPRITE_ID,x
|
||||
and #$2E00
|
||||
and #$3E00
|
||||
xba
|
||||
sta _Sprites+SPRITE_DISP,x ; use bits 9 through 13 for full dispatch
|
||||
|
||||
|
@ -114,9 +114,12 @@ _MarkDirtySprite
|
||||
|
||||
txa
|
||||
and #$0007
|
||||
clc
|
||||
adc _Sprites+SPRITE_CLIP_HEIGHT,y
|
||||
pha
|
||||
|
||||
lda _Sprites+SPRITE_CLIP_HEIGHT,y ; Nominal value between 0 and 16+7 = 23 = 10111
|
||||
dec
|
||||
clc
|
||||
adc 1,s
|
||||
and #$0018
|
||||
sta AreaIndex
|
||||
|
||||
@ -135,13 +138,17 @@ _MarkDirtySprite
|
||||
|
||||
txa
|
||||
and #$0003
|
||||
clc
|
||||
adc _Sprites+SPRITE_CLIP_WIDTH,y
|
||||
sta 1,s
|
||||
|
||||
lda _Sprites+SPRITE_CLIP_WIDTH,y ; max width = 8 = 0x08
|
||||
dec
|
||||
and #$000C
|
||||
lsr
|
||||
clc
|
||||
adc 1,s
|
||||
lsr ; max value = 4 = 0x04
|
||||
and #$0006
|
||||
ora AreaIndex
|
||||
sta AreaIndex
|
||||
pla
|
||||
|
||||
; 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
|
||||
|
@ -4,7 +4,7 @@
|
||||
_DrawSpriteSheet
|
||||
DISP_VFLIP equ $0004 ; hard code these because they are internal values
|
||||
DISP_HFLIP equ $0002
|
||||
DISP_MASK equ $00F9
|
||||
DISP_MASK equ $0018 ; Isolate the size bits
|
||||
|
||||
phx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user