diff --git a/028.bs/assets/assets.png b/028.bs/assets/assets.png index a9d3293..9a44527 100644 Binary files a/028.bs/assets/assets.png and b/028.bs/assets/assets.png differ diff --git a/028.bs/assets/items.png b/028.bs/assets/items.png index 6120ce2..7bb4868 100644 Binary files a/028.bs/assets/items.png and b/028.bs/assets/items.png differ diff --git a/028.bs/bee-palette.s b/028.bs/bee-palette.s new file mode 100644 index 0000000..7116d85 --- /dev/null +++ b/028.bs/bee-palette.s @@ -0,0 +1,4 @@ + move.w #$000,COLOR24(a6) + move.w #$f00,COLOR25(a6) + move.w #$0f0,COLOR26(a6) + move.w #$00f,COLOR27(a6) diff --git a/028.bs/constants.i b/028.bs/constants.i index 54afde0..f6e79b0 100644 --- a/028.bs/constants.i +++ b/028.bs/constants.i @@ -52,24 +52,30 @@ ITEM_SPRITE_NUM_VERTICAL_SPRITES equ 6 ITEM_SPRITE_VERTICAL_BYTES equ ((ITEM_SPRITE_HEIGHT*4)+4) ITEM_SPRITE_BYTES equ (ITEM_SPRITE_NUM_VERTICAL_SPRITES*ITEM_SPRITE_VERTICAL_BYTES)+4 ITEM_SPRITE_VSTART equ 149 -ITEM_NUM_SLOTS equ (8*3) +ITEM_NUM_BEES equ 2 +ITEM_NUM_SLOTS equ ((8*3)+ITEM_NUM_BEES) ITEM_SPRITE_HORIZONTAL_START_PIXELS equ 32 ITEM_SPRITE_Y_COLLISION_OFFSET equ 1 + +ITEM_SPRITE_BEE_INDEX equ 24 ITEM_SPRITE_ARROW_INDEX equ 16 ITEM_SPRITE_COINB_INDEX equ 8 ;item control struct offsets ITEM_X equ 0 -ITEM_LAGX equ 2 +ITEM_Y_OFFSET equ 2 ITEM_Y equ 4 ITEM_SPRITE equ 6 ITEM_INDEX equ 8 ITEM_SPRITE_ENABLED equ 10 ITEM_SPRITE_ADDRESS equ 12 ITEM_STRUCT_SIZE equ 16 + ITEM_STRUCT_MULU_SHIFT equ 4 ITEM_NUM_COIN_ANIMS equ 7 +ITEM_Y_OFFSET_SHIFT_CONVERT equ 1 +BEE_COLLIDE_SIZE equ 5 BIGBANG_ANIM_DELAY equ 4 BIGBANG_POST_DELAY equ 15 diff --git a/028.bs/game1.s b/028.bs/game1.s index 0d10f06..1a632f2 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -242,6 +242,8 @@ GameLoop: Update: jsr UpdatePlayer + jsr VerticalScrollBees + jsr DetectBeeCollisions .backgroundUpdates: add.l #BACKGROUND_SCROLL_PIXELS,backgroundScrollX @@ -250,6 +252,7 @@ Update: beq .skipForegroundUpdates ;; ---- Foreground updates ---------------------------------------- .foregroundUpdates: + move.l foregroundScrollX,d0 lsr.l #FOREGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels andi.l #$f,d0 @@ -260,7 +263,7 @@ Update: add.l d0,foregroundScrollX jsr ScrollSprites - + move.l foregroundScrollX,d0 lsr.l #FOREGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels andi.l #$f,d0 @@ -630,7 +633,6 @@ Level3InterruptHandler: InstallSpriteColorPalette: jsr InstallPlayerColorPalette include "out/sprite_coin-1-palette.s" - include "out/sprite_arrow-1-palette.s" rts diff --git a/028.bs/items.s b/028.bs/items.s index 03db444..562d68e 100644 --- a/028.bs/items.s +++ b/028.bs/items.s @@ -9,13 +9,51 @@ xdef InitialiseItems xdef SwitchItemSpriteBuffers xdef PrepareItemSpriteData + xdef VerticalScrollBees + xdef DetectBeeCollisions DeleteItemSprite: move.w #0,ITEM_SPRITE(a1) move.w #0,ITEM_X(a1) - move.w #0,ITEM_LAGX(a1) + move.w #0,ITEM_Y_OFFSET(a1) move.w ITEM_Y(a1),d2 rts + +VerticalScrollBees: + lea item25,a1 + move.w #ITEM_NUM_BEES-1,d6 +.loop: + cmp.w #0,ITEM_SPRITE(a1) + beq .done + move.w ITEM_Y(a1),d4 + mulu.w #ITEM_SPRITE_SPACING,d4 + add.w #ITEM_SPRITE_VSTART,d4 + lsl.w #ITEM_Y_OFFSET_SHIFT_CONVERT,d4 + move.w ITEM_Y_OFFSET(a1),d0 + add.w d0,d4 + cmp.w #1,beeMovingDown + bne .up +.down: + add.w #1,d0 + bra .c1 +.up: + sub.w #1,d0 +.c1: + move.w d0,ITEM_Y_OFFSET(a1) + cmp.w #(ITEM_SPRITE_VSTART+(16*5))<= r2.x+w + ble .skip + + move.w d2,d6 + add.w #BEE_COLLIDE_SIZE,d6 + cmp.w d3,d6 ; r1.x+w <= r2.x + ble .skip + + move.w d4,d6 + add.w #BEE_COLLIDE_SIZE,d6 + cmp.w d5,d6 ; r1.y >= r2.y+h + ble .skip + + move.w d5,d6 + add.w #BEE_COLLIDE_SIZE,d6 + cmp.w d4,d6 ; r1.y+h < r2.y + ble .skip + + bsr DeleteItemSprite + jmp BigBang +.skip: + add.w #ITEM_STRUCT_SIZE,a1 + dbra d7,.loop + rts + + RenderCoinScore: lea coinCounterText,a1 move.w #31,d0 @@ -95,7 +186,6 @@ ResetItems: .loop1: move.w #0,ITEM_SPRITE(a1) move.w #0,ITEM_X(a1) - move.w #0,ITEM_LAGX(a1) move.w ITEM_Y(a1),d2 add.l #ITEM_STRUCT_SIZE,a1 ; multiply by 16 (item control structure size) dbra d1,.loop1 @@ -112,7 +202,6 @@ SwitchItemSpriteBuffers: move.w d1,d0 lea item1,a1 .loop: - move.w ITEM_X(a1),ITEM_LAGX(a1) adda.l #ITEM_STRUCT_SIZE,a1 dbra d1,.loop rts @@ -124,6 +213,7 @@ PrepareItemSpriteData: move.l #deadSprite,sprite2Pointer move.l #deadSprite,sprite3Pointer move.l #deadSprite,sprite4Pointer + move.l #deadSprite,sprite5Pointer rts .enableSprites: @@ -137,6 +227,7 @@ SetupItemSpriteData: move.l sprite2Pointer,SPR2PTH(a6) move.l sprite3Pointer,SPR3PTH(a6) move.l sprite4Pointer,SPR4PTH(a6) + move.l sprite5Pointer,SPR5PTH(a6) cmp.w #0,spriteBufferIndex beq .zero move.w #0,spriteBufferIndex @@ -157,7 +248,7 @@ _SetupItemSpriteData: cmpi.w #0,ITEM_SPRITE_ENABLED(a1) beq .spriteIsNotEnabled - + move.w ITEM_Y(a1),d2 move.l ITEM_SPRITE_ADDRESS(a1),a0 @@ -182,7 +273,6 @@ _SetupItemSpriteData: add.l d2,a0 move.w ITEM_X(a1),d0 - ;; move.w ITEM_LAGX(a1),d0 lsr.w #FOREGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels add.w #ITEM_SPRITE_HORIZONTAL_START_PIXELS,d0 @@ -192,9 +282,25 @@ _SetupItemSpriteData: lsr.l #1,d0 move.b d0,1(a0) ;spriteHStart + move.w ITEM_Y_OFFSET(a1),d1 + cmp.w #0,d1 + ;; beq .noYOffset + + move.w ITEM_Y(a1),d0 + mulu.w #16,d0 + lsr.w #ITEM_Y_OFFSET_SHIFT_CONVERT,d1 + add.w d1,d0 + add.w #ITEM_SPRITE_VSTART,d0 + move.b d0,(a0) ; spriteVStart + add.w #ITEM_SPRITE_HEIGHT,d0 + move.b d0,2(a0) ; spriteVStart + +.noYOffset: .c1: sub.l d2,a0 ;#1*ITEM_SPRITE_VERTICAL_BYTES,a0 + cmp.b #ITEM_SPRITE_BEE_INDEX,d4 + bge .beeSprite cmp.b #ITEM_SPRITE_ARROW_INDEX,d4 bge .arrowSprite cmp.b #ITEM_SPRITE_COINB_INDEX,d4 @@ -207,6 +313,15 @@ _SetupItemSpriteData: bra .done .arrowSprite: move.l a0,sprite4Pointer + cmp.w #0,ITEM_X(a1) + beq .done + bsr InstallArrowPalette + bra .done +.beeSprite: + move.l a0,sprite5Pointer + cmp.w #0,ITEM_X(a1) + beq .done + bsr InstallBeePalette bra .done .done: @@ -243,8 +358,8 @@ GetSpriteSlot: move.w #336< - eJztld0OwiAMheHRlE1R5yRR3/9VlESSjgD9ARcu+C7Z6Wl7ejGlBj1x1PyaA7HGaV6PoLsKZsI896JFP59vKWOjt1qJP/S4IB63yp1Mg0ykHpS6J6IJGVOyhrebMvol857Tx5Tu9arIOjeXFMo+0ize3+/zL2sLtC6qg/dwjDsGZoIW9qTo74TdesXvF8+P5WkJN+FwQmokni36r4l3bNYSKT+pJ/c/wc3wXND/+x61PDqfb9CODwNcEqE= + eJztlUsOgzAMRMnRCrRAv5FaNnD/e1SRqORG8S9OKQveBilMxvZYgqra2RK1S59PyHngQLyDeEfXwHo5C/Uaz7UoUS/kS2XcuG9tjj/0GBiPi3GmpkAmuR6Se09G88lYkjXcXbs85+jeFfFphTNS+3oZssb6ykUyjyWL45J1D7Q+ugf34RV7hDU4YE2J/sZoxpW/WRrCfHH/XJ69YCcaTo7+P+V4auunuCfOMa2ElJ/V81d0f9yHlcfG+9spxxtPYBLK diff --git a/028.bs/macros.i b/028.bs/macros.i index 6768cfe..b58e9f9 100644 --- a/028.bs/macros.i +++ b/028.bs/macros.i @@ -84,7 +84,7 @@ ItemControl: macro \1: .itemX: dc.w 0 -.itemLagX: +.itemYOffset: dc.w 0 .itemY: dc.w 0 diff --git a/028.bs/player.s b/028.bs/player.s index 56666c3..6ff0b32 100644 --- a/028.bs/player.s +++ b/028.bs/player.s @@ -250,7 +250,6 @@ SetupSpriteData: jsr SetupItemSpriteData move.l #deadSprite,SPR1PTH(a6) ; unused - could only use if sprite resused player sprite palette - move.l #deadSprite,SPR5PTH(a6) ; unused - we only allow one arrow per line per screen move.l #deadSprite,SPR6PTH(a6) ; unused - incompatible with oversize playfield data fetch move.l #deadSprite,SPR7PTH(a6) ; unused - incompatible with oversize playfield data fetch rts diff --git a/028.bs/sound.s b/028.bs/sound.s index ac672ca..2ac5c92 100644 --- a/028.bs/sound.s +++ b/028.bs/sound.s @@ -15,6 +15,7 @@ PlayNextSound: xdef PlayChachingSound xdef PlayWhooshSound xdef PlayYaySound + xdef PlayZapSound PlayJumpSound: lea jump(pc),a1 @@ -64,7 +65,17 @@ PlayYaySound: move.w #64,AUD3VOL(a6) move.w #(endYay-yay)/2,AUD3LEN(a6) ;Set length in words move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) - rts + rts + +PlayZapSound: + KillSound + lea zap,a1 + move.l a1,AUD3LCH(a6) + move.w #124,AUD3PER(a6) + move.w #64,AUD3VOL(a6) + move.w #(endZap-zap)/2,AUD3LEN(a6) ;Set length in words + move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) + rts align 4 jump: @@ -85,7 +96,12 @@ endWhoosh: align 4 yay: incbin "out/yay.raw" -endYay: +endYay: +zap: + ;; incbin "out/zap.raw" + incbin "out/yay.raw" +endZap: + align 4 align 2 emptySound: diff --git a/tools/imagecon/palette.c b/tools/imagecon/palette.c index 5df0a90..9b4df20 100644 --- a/tools/imagecon/palette.c +++ b/tools/imagecon/palette.c @@ -76,12 +76,12 @@ palette_output(imagecon_image_t* ic, char* outFilename) paletteGreyPaletteFP = file_openWrite("%s-grey.pal", outFilename); paletteGreyTableFP = file_openWrite("%s-grey-table.s", outFilename); paletteGreyCopperFP = file_openWrite("%s-grey-copper.s", outFilename); - fprintf(paletteGreyFP, "\tmovem.l d0-a6,-(sp)\n\tlea CUSTOM,a6\n"); + // fprintf(paletteGreyFP, "\tmovem.l d0-a6,-(sp)\n\tlea CUSTOM,a6\n"); } if (config.outputPaletteAsm) { paletteAsmFP = file_openWrite("%s-palette.s", outFilename); - fprintf(paletteAsmFP, "\tmovem.l d0-a6,-(sp)\n\tlea CUSTOM,a6\n"); + // fprintf(paletteAsmFP, "\tmovem.l d0-a6,-(sp)\n\tlea CUSTOM,a6\n"); } if (config.verbose) { @@ -106,12 +106,12 @@ palette_output(imagecon_image_t* ic, char* outFilename) } } if (paletteAsmFP) { - fprintf(paletteAsmFP, "\tlea COLOR%02d(a6),a0\n\tmove.w #$%03x,(a0)\n", i+config.paletteOffset, RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b)); + fprintf(paletteAsmFP, "\tmove.w #$%03x,COLOR%02d(a6)\n", RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b), i+config.paletteOffset); } if (paletteGreyFP) { // TODO: this is for compat, can be better unsigned grey = ((RGB24TORGB12(ic->palette[i].r) + RGB24TORGB12(ic->palette[i].g) + RGB24TORGB12(ic->palette[i].b))/3); - fprintf(paletteGreyFP, "\tlea COLOR%02d(a6),a0\n\tmove.w #$%03x,(a0)\n", i, grey << 8 | grey << 4 | grey); + fprintf(paletteGreyFP, "\tmove.w #$%03x,COLOR%02d(a6)\n", grey << 8 | grey << 4 | grey, i); grey = (((ic->palette[i].r) + (ic->palette[i].g) + (ic->palette[i].b))/3); fprintf(paletteGreyPaletteFP, "%03d %03d %03d 255\n", grey, grey, grey); } @@ -150,7 +150,7 @@ palette_output(imagecon_image_t* ic, char* outFilename) } if (paletteGreyFP) { - fprintf(paletteGreyFP, "\tmovem.l (sp)+,d0-a6\n"); + // fprintf(paletteGreyFP, "\tmovem.l (sp)+,d0-a6\n"); fclose(paletteGreyFP); } @@ -160,7 +160,7 @@ palette_output(imagecon_image_t* ic, char* outFilename) } if (paletteAsmFP) { - fprintf(paletteAsmFP, "\tmovem.l (sp)+,d0-a6\n"); + // fprintf(paletteAsmFP, "\tmovem.l (sp)+,d0-a6\n"); fclose(paletteFP); }