mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-01-14 10:29:48 +00:00
Fix sprite VBUFF offset calculation
This commit is contained in:
parent
e0912c8956
commit
56bfdc4236
@ -123,7 +123,6 @@ EvtLoop
|
|||||||
bne :not_q
|
bne :not_q
|
||||||
brl Exit
|
brl Exit
|
||||||
:not_q
|
:not_q
|
||||||
brl EvtLoop
|
|
||||||
|
|
||||||
cmp #'d'
|
cmp #'d'
|
||||||
bne :not_d
|
bne :not_d
|
||||||
@ -182,10 +181,10 @@ EvtLoop
|
|||||||
lda vsync
|
lda vsync
|
||||||
beq :no_vsync
|
beq :no_vsync
|
||||||
:vsyncloop jsl GetVerticalCounter ; 8-bit value
|
:vsyncloop jsl GetVerticalCounter ; 8-bit value
|
||||||
cmp ScreenY1
|
cmp ScreenY0
|
||||||
bcc :vsyncloop
|
bcc :vsyncloop
|
||||||
sec
|
sec
|
||||||
sbc ScreenY1
|
sbc ScreenY0
|
||||||
cmp #8
|
cmp #8
|
||||||
bcs :vsyncloop ; Wait until we're within the top 8 scanlines
|
bcs :vsyncloop ; Wait until we're within the top 8 scanlines
|
||||||
lda #1
|
lda #1
|
||||||
|
@ -114,12 +114,12 @@ _MarkDirtySprite
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0007
|
and #$0007
|
||||||
pha
|
sta tmp0 ; save to adjust sprite origin
|
||||||
|
|
||||||
lda _Sprites+SPRITE_CLIP_HEIGHT,y ; Nominal value between 0 and 16+7 = 23 = 10111
|
lda _Sprites+SPRITE_CLIP_HEIGHT,y ; Nominal value between 0 and 16+7 = 23 = 10111
|
||||||
dec
|
dec
|
||||||
clc
|
clc
|
||||||
adc 1,s
|
adc tmp0
|
||||||
and #$0018
|
and #$0018
|
||||||
sta AreaIndex
|
sta AreaIndex
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ _MarkDirtySprite
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0003
|
and #$0003
|
||||||
sta 1,s
|
sta tmp1 ; save to adjust sprite origin
|
||||||
|
|
||||||
lda _Sprites+SPRITE_CLIP_WIDTH,y ; max width = 8 = 0x08
|
lda _Sprites+SPRITE_CLIP_WIDTH,y ; max width = 8 = 0x08
|
||||||
dec
|
dec
|
||||||
clc
|
clc
|
||||||
adc 1,s
|
adc tmp1
|
||||||
lsr ; max value = 4 = 0x04
|
lsr ; max value = 4 = 0x04
|
||||||
and #$0006
|
and #$0006
|
||||||
ora AreaIndex
|
ora AreaIndex
|
||||||
@ -160,6 +160,12 @@ _MarkDirtySprite
|
|||||||
lda :stamp_step,x
|
lda :stamp_step,x
|
||||||
clc
|
clc
|
||||||
adc _Sprites+VBUFF_ADDR,y
|
adc _Sprites+VBUFF_ADDR,y
|
||||||
|
sec
|
||||||
|
sbc tmp1 ; Subtract the horizontal within-tile displacement
|
||||||
|
asl tmp0
|
||||||
|
ldx tmp0
|
||||||
|
sec
|
||||||
|
sbc :vbuff_mul,x
|
||||||
sta VBuffOrigin
|
sta VBuffOrigin
|
||||||
lda #^TileStore
|
lda #^TileStore
|
||||||
sta tmp1
|
sta tmp1
|
||||||
@ -174,6 +180,7 @@ _MarkDirtySprite
|
|||||||
dw mdsOut,mdsOut,mdsOut,mdsOut
|
dw mdsOut,mdsOut,mdsOut,mdsOut
|
||||||
|
|
||||||
:stamp_step dw 0,12,24,36
|
:stamp_step dw 0,12,24,36
|
||||||
|
:vbuff_mul dw 0,52,104,156,208,260,312,364
|
||||||
; Dispatch to the calculated sizing
|
; Dispatch to the calculated sizing
|
||||||
|
|
||||||
; Begin a list of subroutines to cover all of the valid sprite size combinations. This is all unrolled code,
|
; Begin a list of subroutines to cover all of the valid sprite size combinations. This is all unrolled code,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user