From 5065c1be6014bde2253afc5f2e777c9806618eb4 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Sat, 28 May 2016 17:02:06 +1000 Subject: [PATCH] cleanup --- 028.bs/constants.i | 2 +- 028.bs/counter.s | 9 +++++++++ 028.bs/game1.s | 48 ++++++---------------------------------------- 028.bs/items.s | 4 ++-- 028.bs/macros.i | 20 +++++++++++++++++++ 028.bs/pickups.s | 45 +++++++++++++++++++++++++++---------------- 028.bs/player.s | 8 ++++---- 7 files changed, 70 insertions(+), 66 deletions(-) diff --git a/028.bs/constants.i b/028.bs/constants.i index 9dea502..beab1af 100644 --- a/028.bs/constants.i +++ b/028.bs/constants.i @@ -1,4 +1,4 @@ - +SKIPPED_FRAMES_DISPLAY equ 1 MPANEL_COPPER_WAIT equ $9ad1 ; controls the vertical position of the message panel PLAYER_MOVE_UP equ 1 diff --git a/028.bs/counter.s b/028.bs/counter.s index e818179..ed6e053 100644 --- a/028.bs/counter.s +++ b/028.bs/counter.s @@ -1,4 +1,5 @@ xdef RenderCounter + xdef RenderCounterAtY xdef ResetCounter xdef IncrementCounter xdef DecrementCounter @@ -14,6 +15,14 @@ RenderCounter: jsr DrawText8 rts +RenderCounterAtY: + ;; d0.w x position + ;; d1.w y position + ;; a1.l text + lea panel,a0 + jsr DrawText8 + rts + RenderNumber4: ;; d0.l number ;; d1.w x position diff --git a/028.bs/game1.s b/028.bs/game1.s index 9961387..e3cb59d 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -185,22 +185,7 @@ FadeInLoop: GameLoop: - move.l verticalBlankCount,d0 - move.l frameCount,d1 - cmp.l d1,d0 - beq .noSkippedFrames - addq #1,d0 - cmp.l d1,d0 - beq .noSkippedFrames - move.l frameCount,verticalBlankCount - lea skippedFramesCounterText,a0 - jsr IncrementCounter - lea skippedFramesCounterText,a1 - if 1 - move.w #275,d0 - jsr RenderCounter - endif -.noSkippedFrames: + RenderSkippedFramesCounter add.l #1,frameCount jsr WaitVerticalBlank bsr HoriScrollPlayfield @@ -233,13 +218,6 @@ GameLoop: jsr CheckPlayerMiss bsr RenderNextForegroundFrame jsr RenderNextBackgroundFrame - - if 0 - jsr RenderPlayerScore - move.w #$0f0,COLOR00(a6) - jsr RenderPlayerScore - move.w #$0,COLOR00(a6) - endif cmp.w #0,pathwayClearPending beq .dontClearPathway @@ -254,8 +232,8 @@ GameLoop: jsr PlayNextSound jsr PrepareItemSpriteData - jsr FlashPickup + bra GameLoop @@ -468,7 +446,6 @@ RenderNextForegroundFrame: add.l #1,d3 cmp.l #FOREGROUND_PLAYAREA_HEIGHT_WORDS,d3 blt .loop - ;; jsr PrepareItemSpriteData rts @@ -483,9 +460,6 @@ RenderForegroundTile: move.w (a2),d0 add.w (a2),a1 ; source tile add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(256-(16*8)+32)/4)+BITPLANE_WIDTH_BYTES-FOREGROUND_PLAYAREA_RIGHT_MARGIN_BYTES,a0 - cmp.w #$ffff,d0 - ;; beq stopScrolling - lea animIndex,a4 move.l d2,d1 lsl.l #2,d1 @@ -535,7 +509,6 @@ BigBang: jsr SwitchBuffers jsr UpdatePlayerFallingAnimation jsr PrepareItemSpriteData - move.l foregroundMapPtr,a2 move.l foregroundScrollX,d0 @@ -551,8 +524,7 @@ BigBang: move.l foregroundOffscreen,a0 add.l d0,a0 lea foregroundTilemap,a1 - add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(256-(16*8)+32)/4)+BITPLANE_WIDTH_BYTES-FOREGROUND_PLAYAREA_RIGHT_MARGIN_BYTES,a0 - + add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(256-(16*8)+32)/4)+BITPLANE_WIDTH_BYTES-FOREGROUND_PLAYAREA_RIGHT_MARGIN_BYTES,a0 move.l #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2)-0,d5 move.l #BIGBANG_ANIM_DELAY,d0 lea bigBangIndex,a4 @@ -569,6 +541,7 @@ BigBang: dbra d5,.loop1 bra .bigBangLoop + ClearForegroundTile3: ;; a4 - pointed to animation offset for tile lea foregroundTilemap,a1 @@ -607,8 +580,7 @@ ClearForegroundTile: cmp.l a3,a2 ; don't clear until the full play area has scrolled in blt .s3 sub.l #FOREGROUND_PLAYAREA_WIDTH_WORDS,a0 - lea deAnimIndex,a4 - + lea deAnimIndex,a4 move.l d2,d1 lsl.l #2,d1 add.l d1,a4 @@ -628,7 +600,7 @@ ClearForegroundTile: jsr BlitTile .s3: rts - + Level3InterruptHandler: movem.l d0-a6,-(sp) @@ -873,10 +845,6 @@ BlitCountdown: Level 12,"WHAT? WHAT?!",50,4*2,8,6,"NICE! LEVEL 10",A,98,1 - - ;; Level 10,"WHAT? WHAT?!",15,4*2,8,6,"YOU'RE GOOD, LEVEL 10",C - - ;; Level 7,"LEVEL 3",50,4*2,8,6,"3",C Palette A Palette B Palette C @@ -890,10 +858,6 @@ player1Text: dc.b "P1" dc.b 0 align 4 -player2Text: - dc.b "P2" - dc.b 0 - align 4 gameOverMessage: dc.b "GAME OVER" dc.b 0 diff --git a/028.bs/items.s b/028.bs/items.s index 8f5137a..2c1fa7d 100644 --- a/028.bs/items.s +++ b/028.bs/items.s @@ -82,12 +82,12 @@ DetectItemCollisions: rts .arrowCollision: bsr DeleteItemSprite - ;; jsr SpriteEnableAuto + ;; jsr SpriteEnableAuto jsr PickupArrow rts .clockCollision: bsr DeleteItemSprite - ;; jsr FreezeScrolling + ;; jsr FreezeScrolling jsr PickupClock rts .eyeCollision: diff --git a/028.bs/macros.i b/028.bs/macros.i index 4743c8b..86330dc 100644 --- a/028.bs/macros.i +++ b/028.bs/macros.i @@ -215,3 +215,23 @@ ResetScore: macro CompareScore: macro cmp.l #\1,__score endm + +RenderSkippedFramesCounter: macro + if SKIPPED_FRAMES_DISPLAY=1 + move.l verticalBlankCount,d0 + move.l frameCount,d1 + cmp.l d1,d0 + beq .noSkippedFrames + addq #1,d0 + cmp.l d1,d0 + beq .noSkippedFrames + move.l frameCount,verticalBlankCount + lea skippedFramesCounterText,a0 + jsr IncrementCounter + lea skippedFramesCounterText,a1 + move.w #SCREEN_WIDTH-(4*8),d0 + move.w #0,d1 + jsr RenderCounterAtY +.noSkippedFrames: + endif +endm \ No newline at end of file diff --git a/028.bs/pickups.s b/028.bs/pickups.s index 8c3596c..941bcc5 100644 --- a/028.bs/pickups.s +++ b/028.bs/pickups.s @@ -10,6 +10,11 @@ PICKUP_OFFSET equ (SCREEN_WIDTH_BYTES*PANEL_BIT_DEPTH*17)+(272/8) PICKUP_NUM_FLASHES equ 6 +PICKUP_DEBOUNCE_FRAMES equ 50 + +PICKUP_SAFE_TILE1 equ $f02 +PICKUP_SAFE_TILE2 equ $1682 + ResetPickupItem: macro move.w #0,pickup\1FlashCounter @@ -18,7 +23,8 @@ ResetPickupItem: macro bsr Show\1Pickup .\@skip: endm - + + ResetPickups: move.l #0,lastPickupFrameCount ResetPickupItem Arrow @@ -26,6 +32,7 @@ ResetPickups: ResetPickupItem Eye rts + InitialisePickups: move.w #0,hasEyePickup move.w #0,hasArrowPickup @@ -38,13 +45,12 @@ InitialisePickups: bsr HideClockPickup rts - + UsePickup: move.l frameCount,d0 sub.l lastPickupFrameCount,d0 - cmp.l #50,d0 + cmp.l #PICKUP_DEBOUNCE_FRAMES,d0 blt .done - move.l frameCount,lastPickupFrameCount cmp.w #0,hasEyePickup bne .useEye @@ -72,9 +78,9 @@ UsePickup: cmp.w #0,a0 beq .done move.w (a0),d0 - cmp.w #$f02,d0 ; dont active on safe columns + cmp.w #PICKUP_SAFE_TILE1,d0 ; dont active on safe columns beq .done - cmp.w #$1682,d0 ; dont active on safe zones + cmp.w #PICKUP_SAFE_TILE2,d0 ; dont active on safe zones beq .done PlaySound Whoosh move.w #0,hasArrowPickup @@ -83,7 +89,7 @@ UsePickup: bra .done .done: rts - + FlashItem: macro move.w pickup\1FlashCounter,d0 @@ -109,7 +115,8 @@ FlashItem: macro sub.w #1,pickup\1FlashCounter .\@skip: endm - + + FlashPickup: cmp.w #0,flashCount bgt .skip @@ -135,48 +142,57 @@ PickupItem: macro .\@done: endm + PickupClock: PickupItem Clock,FreezeScrolling rts + PickupEye: PickupItem Eye,RevealPathway rts - + + PickupArrow: PickupItem Arrow,SpriteEnableAuto rts - + + ShowEyePickup: move.w #0,d0 move.w #0,d1 bsr BlitPickup rts + HideEyePickup: move.w #0,d0 move.w #1,d1 bsr BlitPickup rts - + + ShowClockPickup: move.w #1,d0 move.w #0,d1 bsr BlitPickup rts + HideClockPickup: move.w #1,d0 move.w #1,d1 bsr BlitPickup rts + ShowArrowPickup: move.w #2,d0 move.w #0,d1 bsr BlitPickup rts + HideArrowPickup: move.w #2,d0 move.w #1,d1 @@ -210,6 +226,7 @@ BlitPickup: move.w #(14*PANEL_BIT_DEPTH)<<6|(1),BLTSIZE(a6) rts + hasClockPickup: dc.w 0 hasEyePickup: @@ -222,16 +239,10 @@ pickupEyeFlashCounter: dc.w 0 pickupClockFlashCounter: dc.w 0 - lastPickupFrameCount: dc.l 0 - flashCount: dc.w 0 -revealMessageText: - dc.b "SHOW ME THE BOARD!" - dc.b 0 - align 4 pickups: incbin "out/pickups.bin" diff --git a/028.bs/player.s b/028.bs/player.s index 3950297..5b19e71 100644 --- a/028.bs/player.s +++ b/028.bs/player.s @@ -11,21 +11,21 @@ xdef ScrollSprites xdef RenderPlayerScore xdef PreRenderColumnsRemaining - xdef deadSprite ; used in items xdef UpdatePlayerFallingAnimation xdef InstallPlayerColorPalette xdef SelectNextPlayerSprite xdef SpriteEnableAuto + xdef deadSprite ; used in items xdef spriteLagX xdef spriteY xdef spriteX + xdef spriteCurrentPathwayTile xdef playerXColumn - xdef playerXColumnLastSafe - + xdef playerXColumnLastSafe xdef playerLevelPausePixels xdef playerLevelMissPixels - xdef spriteCurrentPathwayTile + PLAYER_INSTALL_COLOR_PALETTE equ 0 PLAYER_SPRITE_DATA equ 4