mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-01-13 03:30:56 +00:00
Fix sprite VBUFF offset calculation
This commit is contained in:
parent
e0912c8956
commit
56bfdc4236
@ -123,7 +123,6 @@ EvtLoop
|
||||
bne :not_q
|
||||
brl Exit
|
||||
:not_q
|
||||
brl EvtLoop
|
||||
|
||||
cmp #'d'
|
||||
bne :not_d
|
||||
@ -182,10 +181,10 @@ EvtLoop
|
||||
lda vsync
|
||||
beq :no_vsync
|
||||
:vsyncloop jsl GetVerticalCounter ; 8-bit value
|
||||
cmp ScreenY1
|
||||
cmp ScreenY0
|
||||
bcc :vsyncloop
|
||||
sec
|
||||
sbc ScreenY1
|
||||
sbc ScreenY0
|
||||
cmp #8
|
||||
bcs :vsyncloop ; Wait until we're within the top 8 scanlines
|
||||
lda #1
|
||||
|
@ -114,12 +114,12 @@ _MarkDirtySprite
|
||||
|
||||
txa
|
||||
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
|
||||
dec
|
||||
clc
|
||||
adc 1,s
|
||||
adc tmp0
|
||||
and #$0018
|
||||
sta AreaIndex
|
||||
|
||||
@ -138,12 +138,12 @@ _MarkDirtySprite
|
||||
|
||||
txa
|
||||
and #$0003
|
||||
sta 1,s
|
||||
sta tmp1 ; save to adjust sprite origin
|
||||
|
||||
lda _Sprites+SPRITE_CLIP_WIDTH,y ; max width = 8 = 0x08
|
||||
dec
|
||||
clc
|
||||
adc 1,s
|
||||
adc tmp1
|
||||
lsr ; max value = 4 = 0x04
|
||||
and #$0006
|
||||
ora AreaIndex
|
||||
@ -160,6 +160,12 @@ _MarkDirtySprite
|
||||
lda :stamp_step,x
|
||||
clc
|
||||
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
|
||||
lda #^TileStore
|
||||
sta tmp1
|
||||
@ -174,6 +180,7 @@ _MarkDirtySprite
|
||||
dw mdsOut,mdsOut,mdsOut,mdsOut
|
||||
|
||||
:stamp_step dw 0,12,24,36
|
||||
:vbuff_mul dw 0,52,104,156,208,260,312,364
|
||||
; Dispatch to the calculated sizing
|
||||
|
||||
; 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