more work on animated sprites

This commit is contained in:
alpine9000
2016-04-18 18:43:51 +10:00
parent 60c409ab07
commit dcf1eea88b
3 changed files with 36 additions and 18 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
</layer>
<layer name="items" width="100" height="8">
<data encoding="base64" compression="zlib">
eJxjYBgFo2AU4AKOjMTJgdjI2AmPvlFAW4Ar7NHji1T9o2BwAHxxNwpGwSgYBaNgaAAAFGIDHA==
eJxjYBgFo2AUjIKhA5wYUfmOjNjVESs/CugHQHGBHH9OjJjxOQpGwSgYBaNg+AMAVHkB0w==
</data>
</layer>
</map>
+10 -7
View File
@@ -53,11 +53,12 @@ Reset:
MainLoop:
MOVE.W #$0024,BPLCON2(a6)
SetupBoardLoop:
add.l #1,frameCount
move.l frameCount,d6
move.l #FOREGROUND_SCROLL_PIXELS*15,foregroundScrollPixels
;; move.l #FOREGROUND_SCROLL_PIXELS*15,foregroundScrollPixels
move.l #FOREGROUND_SCROLL_PIXELS,foregroundScrollPixels
;; jsr WaitVerticalBlank
bsr HoriScrollPlayfield
jsr SwitchBuffers ; takes bitplane pointer offset in d0
@@ -65,8 +66,9 @@ SetupBoardLoop:
move.w #1,moving
bsr Update
bsr RenderNextForegroundFrame
bsr RenderNextBackgroundFrame
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS,frameCount
;; bsr RenderNextBackgroundFrame
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS*15,frameCount
;; cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS,frameCount
bge .gotoGameLoop
bra SetupBoardLoop
@@ -78,7 +80,8 @@ GameLoop:
add.l #1,frameCount
move.l frameCount,d6
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS+25,d6
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS*15+25,d6
;; cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS+25,d6
bne .c1
move.w #(DMAF_SPRITE|DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
jsr InitialisePig
@@ -246,7 +249,7 @@ RenderForegroundTile_NoAnim:
add.l d0,a0
lea tilemap,a1
add.w (a2),a1 ; source tile
add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(256-(16*4))/4)+BITPLANE_WIDTH_BYTES-8,a0
add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(256-(16*8)+32)/4)+BITPLANE_WIDTH_BYTES-FOREGROUND_PLAYAREA_RIGHT_MARGIN_BYTES,a0
jsr BlitTile
rts
@@ -339,7 +342,7 @@ Level3InterruptHandler:
.verticalBlank:
move.w #INTF_VERTB,INTREQ(a6) ; clear interrupt bit
add.l #1,verticalBlankCount
jsr SetupSpriteData
jsr SetupSpriteData
.checkCopper:
move.w INTREQR(a6),d0
and.w #INTF_COPER,d0
+25 -10
View File
@@ -10,7 +10,7 @@ ScrollItemSprites:
SetupItemSpriteData:
move.l currentItemSprite,a0
cmp.w #11<<3,itemIndex
cmp.w #13<<3,itemIndex
ble .dontResetIndex
move.l #0,itemIndex
.dontResetIndex:
@@ -24,7 +24,6 @@ SetupItemSpriteData:
lsr.l #3,d0
mulu.w #64+12,d0
add.l d0,a0
add.w #1,itemIndex
move.w itemLagX,d0
move.w itemX,itemLagX
add.w #32,d0
@@ -33,27 +32,30 @@ SetupItemSpriteData:
move.b d1,3(a0) ;spriteControl
lsr.l #1,d0
move.b d0,1(a0) ;spriteHStart
move.w itemY,d0
move.w itemLagY,d0
move.w itemY,itemLagY
move.b d0,(a0) ;spriteVStart
move.w itemYEnd,d0
move.w itemLagYEnd,d0
move.w itemYEnd,itemLagYEnd
move.b d0,2(a0) ;spriteVStop
.c1:
move.l a0,SPR2PTH(a6)
move.l a0,SPR2PTH(a6)
add.w #1,itemIndex
rts
RenderItemSprite:
;; d2 - y tile index ?
movem.l d2-d3,-(sp)
move.l foregroundScrollX,d0
lsr.w #FOREGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
andi.w #$f,d0
cmp.b #15,d0
cmp.b #$f,d0
bne .dontAddSprite
move.l a2,a3
add.l mapSize,a3
cmpi.w #0,(a3)
beq .dontAddSprite
move.l #spriteCoin1,currentItemSprite
move.l #deadSprite,currentItemSprite
move.w #337,itemX
mulu.w #16,d2
move.w #255-12,d3
@@ -61,7 +63,8 @@ RenderItemSprite:
move.w d3,itemY
add.w #16,d3
move.w d3,itemYEnd
move.w #0,itemIndex
;; move.w #0,itemIndex
move.l #spriteCoin1,currentItemSprite
.dontAddSprite:
movem.l (sp)+,d2-d3
rts
@@ -74,16 +77,24 @@ itemLagX:
dc.w 0
itemY:
dc.w 0
itemLagY:
dc.w 0
itemYEnd:
dc.w 0
itemLagYEnd:
dc.w 0
itemIndex:
dc.w 4
dc.w 0
spriteCoin1:
dc.w 0,0
dc.w 0,0
incbin "out/sprite_coin1.bin"
dc.l 0
dc.w 0,0
dc.w 0,0
incbin "out/sprite_coin1.bin"
dc.l 0
spriteCoin2:
dc.w 0,0
dc.w 0,0
@@ -114,6 +125,10 @@ spriteCoin7:
dc.w 0,0
incbin "out/sprite_coin7.bin"
dc.l 0
dc.w 0,0
dc.w 0,0
incbin "out/sprite_coin7.bin"
dc.l 0
spriteCoin8:
dc.w 0,0
dc.w 0,0