Change bit-format of scratch sprite table.

Now each sprite's bits count as: "1 = large" and "1 = enabled", which is
more intuitive.
This commit is contained in:
Colin McMillen 2015-05-30 12:02:25 -04:00
parent 48db4aca58
commit 25a2fb20ab

View File

@ -510,8 +510,7 @@ UpdateWorld:
; Set priority bits so that the sprite is drawn in front. ; Set priority bits so that the sprite is drawn in front.
lda #%00110000 lda #%00110000
sta $0103 sta $0103
; Clear x-MSB so that the sprite is displayed. lda #%11000000 ; Enable large sprite.
lda #%01000000
sta spriteTableScratchStart sta spriteTableScratchStart
; Move shot coords and copy into sprite table. ; Move shot coords and copy into sprite table.
@ -548,7 +547,7 @@ UpdateShot:
sta $0112, X sta $0112, X
; Update secondary sprite table. ; Update secondary sprite table.
lda #%01000000 lda #%11000000
sta spriteTableScratchStart + 4, Y sta spriteTableScratchStart + 4, Y
jmp ShotDone jmp ShotDone
@ -593,6 +592,10 @@ FillSecondarySpriteTable:
; This function is meant to be called after UpdateWorld, and packs those ; This function is meant to be called after UpdateWorld, and packs those
; bytes into the actual bitfield that the OAM wants for the secondary ; bytes into the actual bitfield that the OAM wants for the secondary
; sprite table. ; sprite table.
;
; The expected format of every byte in the scratch sprite table is:
; sx------ s = size (0 = small, 1 = large)
; x = flipped high x-coordinate (so 1 behaves like "enable").
ldx #0 ; Index into input table. ldx #0 ; Index into input table.
ldy #0 ; Index into output table. ldy #0 ; Index into output table.
- -
@ -608,10 +611,8 @@ FillSecondarySpriteTable:
sta $00 sta $00
inx inx
.endr .endr
; TODO(mcmillen): change the semantics of the scratch table so that
; "1" = "big"?
lda $00 lda $00
eor #$FF eor #%01010101
sta spriteTable2Start, Y sta spriteTable2Start, Y
iny iny
cpx #numSprites cpx #numSprites