From 8a78835811c21c6b9fe065610b695d51102ddb28 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Sun, 1 May 2016 16:00:28 +1000 Subject: [PATCH] auto scroll --- 028.bs/assets/panel.pal | 6 +++--- 028.bs/constants.i | 3 ++- 028.bs/game1.s | 41 +++++++++++++++++++++++++++++++---------- 028.bs/player.s | 13 ++++++++++--- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/028.bs/assets/panel.pal b/028.bs/assets/panel.pal index 77e6679..3dac105 100644 --- a/028.bs/assets/panel.pal +++ b/028.bs/assets/panel.pal @@ -1,13 +1,13 @@ -238 187 153 255 +000 153 238 255 051 136 136 255 255 255 255 255 255 238 187 255 255 255 221 255 068 187 170 255 -000 000 000 255 +000 034 051 255 170 238 238 255 255 221 000 255 -000 034 051 255 +238 187 153 255 255 136 000 255 000 068 119 255 085 221 204 255 diff --git a/028.bs/constants.i b/028.bs/constants.i index fcfd13c..24d35d9 100644 --- a/028.bs/constants.i +++ b/028.bs/constants.i @@ -8,7 +8,7 @@ PLAYER_BOTTOM_Y equ $e4+16 PLAYER_TOP_Y equ (PLAYER_BOTTOM_Y-(7*16)) PLAYER_JUMP_PIXELS equ 8 PLAYER_JUMP_SHIFT_CONVERT equ 3 ; x = x / PLAYER_JUMP_PIXELS -PLAYER_CHECK_MISS_PIXELS equ 6 +PLAYER_CHECK_MISS_PIXELS equ 10 PLAYER_PAUSE_PIXELS equ 12 PLAYER_MOVE_PIXELS equ 2 PLAYER_SPRITE_VERTICAL_BYTES equ ((16*4)+12) @@ -22,6 +22,7 @@ FOREGROUND_SCROLL_PIXELS equ 16 FOREGROUND_PLAYAREA_WIDTH_WORDS equ 24 FOREGROUND_PLAYAREA_RIGHT_MARGIN_BYTES equ 12 FOREGROUND_PLAYAREA_HEIGHT_WORDS equ 8 +FOREGROUND_MOVING_COUNTER equ 50 BACKGROUND_SCROLL_SHIFT_CONVERT equ 4 BACKGROUND_SCROLL_TILE_INDEX_CONVERT equ 3 diff --git a/028.bs/game1.s b/028.bs/game1.s index a0984eb..0a9e606 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -4,8 +4,9 @@ xdef pathwayRenderPending xdef pathwayXIndex - + xdef pathwayFadeCount xdef pathwayClearPending + xdef InstallTilePalette xdef copperList xdef mpanelCopperList @@ -94,7 +95,8 @@ Reset: move.l startPathwayMapPtr,pathwayMapPtr move.w #0,pathwayRenderPending move.w #0,pathwayClearPending - move.w #0,moving + move.w #0,moving + move.w #-2*FOREGROUND_MOVING_COUNTER,movingCounter move.l #playareaFade,playareaFadePtr move.l #panelFade,panelFadePtr move.l #flagsFade,flagsFadePtr @@ -198,7 +200,25 @@ GameLoop: move.w #0,moving .s2: - jsr ProcessJoystick + jsr ProcessJoystick + if 0 + btst.b #0,joystick + bne .setMoving + endif + cmp.w #PLAYER_INITIAL_X+16*3,spriteX + bge .setMoving + addq.w #1,movingCounter + cmp.w #FOREGROUND_MOVING_COUNTER,movingCounter + bge .setMoving + bra .notMoving +.setMoving: + move.w #0,movingCounter + move.w #1,moving +.notMoving: + + + + bsr Update bsr RenderNextForegroundFrame jsr RenderNextBackgroundFrame @@ -211,7 +231,6 @@ GameLoop: cmp.w #0,pathwayRenderPending beq .dontRenderPathway - jsr InstallTilePalette jsr RenderPathway .dontRenderPathway: @@ -412,9 +431,8 @@ RenderNextForegroundFrame: rts RenderPathway: - move.w #0,pathwayFadeCount - sub.w #1,pathwayRenderPending move.w pathwayXIndex,d5 ; x index + ;;sub.w #1,pathwayRenderPending .loopX: move.w #6,d6 ; y index move.w #0,d7 ; number of rows without a pathway @@ -454,12 +472,13 @@ RenderPathway: .next: dbra d6,.loopY add.w #1,d5 - cmp.w #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2)-1,d5 ; don't render pathways off the play area - beq .skip + cmp.w #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2)-0,d5 ; don't render pathways off the play area + beq .pathwayNotComplete bra .loopX - .skip: - + sub.w #1,pathwayRenderPending + rts +.pathwayNotComplete: rts @@ -1338,6 +1357,8 @@ frameCount: dc.l 0 verticalBlankCount: dc.l 0 +movingCounter: + dc.w 0 moving: dc.w 0 pathwayRenderPending: diff --git a/028.bs/player.s b/028.bs/player.s index a7ffe9d..0e14ef6 100644 --- a/028.bs/player.s +++ b/028.bs/player.s @@ -14,6 +14,7 @@ xdef spriteLagX xdef spriteY + xdef spriteX PLAYER_INSTALL_COLOR_PALETTE equ 0 PLAYER_SPRITE_DATA equ 4 @@ -33,7 +34,7 @@ InitialisePlayer: HidePlayer: - move.w #$f000,spriteX + move.w #$7000,spriteX rts @@ -134,7 +135,7 @@ UpdatePlayer: .notLeft: cmp.w #$cf,spriteX blt .noScroll - move.w #1,moving + ;; move.w #1,moving .noScroll: rts @@ -234,6 +235,10 @@ InstallTankColorPalette: CheckPlayerMiss: + ;; check if player has fallen off the left side of the play area + cmpi.w #PLAYER_INITIAL_X-15,spriteX + blt .doBigBang + cmp.w #PLAYER_CHECK_MISS_PIXELS,spriteR beq .check cmp.w #PLAYER_CHECK_MISS_PIXELS,spriteU @@ -241,7 +246,7 @@ CheckPlayerMiss: cmp.w #PLAYER_CHECK_MISS_PIXELS,spriteD beq .check cmp.w #PLAYER_CHECK_MISS_PIXELS,spriteL - beq .check + beq .check rts .check: @@ -308,6 +313,8 @@ CheckPlayerMiss: cmp.w #$1e00,d0 blt .dontRenderPathway move.w #2,pathwayRenderPending + move.w #0,pathwayFadeCount + jsr InstallTilePalette .dontRenderPathway: cmp.w #$f02,d0