From 6c64e77fe6b0b62d4c01df87bc548b7e1ed10fc7 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Sat, 30 Apr 2016 12:08:01 +1000 Subject: [PATCH] restart at last safe column --- 028.bs/Makefile | 12 ++++++------ 028.bs/foreground.tmx | 4 ++-- 028.bs/game1.s | 43 ++++++++++++++++++++++++++++--------------- 028.bs/player.s | 22 ++++++++++++++++++---- 4 files changed, 54 insertions(+), 27 deletions(-) diff --git a/028.bs/Makefile b/028.bs/Makefile index f0a55c5..2113540 100644 --- a/028.bs/Makefile +++ b/028.bs/Makefile @@ -50,16 +50,13 @@ IMAGES=foreground.png \ IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin)) -VASM_EXTRA_ARGS= +VASM_EXTRA_ARGS=-DTIMING_TEST=0 #SYMBOL_INFO=-M LINKER_OPTIONS=-T link.script.x include ../shared/base.mk -#out/%.bin: out/%.sized.png -# $(IMAGECON) --input $< $(IMAGECON_ARGS) --quantize --colors 8 --output-bitplanes --output-palette-asm --output-grey-palette --output-palette $(DITHER) --output out/$* - out/foreground.bin: assets/assets.png $(IMAGECON) --use-palette=assets/foreground.pal --input $< $(IMAGECON_ARGS) --colors 8 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-grey-palette --output-palette --output-png --output-copperlist --output out/foreground sed -i '' "1s/.*/ dc.w COLOR00,\$$$(BACKGROUND_COLOR)/" out/foreground-copper-list.s @@ -84,14 +81,12 @@ out/sprite_pig-%.bin: out/sprite_pig-%.png out/sprite_robot-%.bin: out/sprite_robot-%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_robot-$* --palette-offset 16 --use-palette=assets/robot.pal - out/sprite_fallingPig-%.bin: out/sprite_fallingPig-%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_fallingPig-$* --palette-offset 16 --use-palette=assets/pig.pal out/sprite_fallingRobot-%.bin: out/sprite_fallingRobot-%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_fallingRobot-$* --palette-offset 16 --use-palette=assets/robot.pal - out/sprite_coin%.bin: out/sprite_coin%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_coin$* --palette-offset 20 --use-palette=assets/coin.pal @@ -145,3 +140,8 @@ out/background-map.s: background.tmx out/main.o: $(IMAGEDATA) out/background-map.s out/foreground-map.s Makefile link.script.x out/playarea_fade.s out/flags_fade.s out/panelFade.s out/tileFade.s +setuptiming: + $(eval VASM_EXTRA_ARGS="-DTIMING_TEST=1") + echo $(VASM_EXTRA_ARGS) + +timing: setuptiming all diff --git a/028.bs/foreground.tmx b/028.bs/foreground.tmx index 1d19dce..b2711d6 100644 --- a/028.bs/foreground.tmx +++ b/028.bs/foreground.tmx @@ -8,7 +8,7 @@ - eJxjZ2BgsGTEjtlH5eguZwekmYBYDAs9Kkd/OS0c8qNyAyNHSXxWkqlvVA5//tiNJ86WUxDXo3L0zR+jcrTJH4MtjYxkucHY5hvJcgD2C1M0 + eJxjZ2BgsGTEjtlH5eguZwekmYBYDAs9Kkd/OS0c8qNyAyNHSXxWkqlvVA5//tiNJ86WUxDXo3L0zR+jcrTJH4MtjYxkOWkG3G0wWsgNxjbmYJIDAGX6U4Q= @@ -16,7 +16,7 @@ eJxjYBgFo2AUkAvOA/HHgXbECAbo4c/KyMDADcQngWxjIK3LCKFHAW0BLJwlgfgxlA8DsDhBByB1o3mH/gAUF6w48sRonNAf3AVieTxlFCw/wcqzUTAKhgsAAErmDLs= - + eJxjYBgFgw04MuLnE1JPCDgRqZ5YdcMdgMKX2DBGV+dKhD6QHucREtbUSFOwMMYVJy6MqGph6lxItJtU9SMduDISjhv0vERK3oLZQW0wlMs5kNuRMQiQU3/A1LiRERbk6KEmICX+Bktck1pnu1NRPal2j4JRQCsAAIdJC5A= diff --git a/028.bs/game1.s b/028.bs/game1.s index 308bf3f..565658f 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -20,14 +20,16 @@ xdef foregroundOnscreen xdef foregroundOffscreen xdef foregroundScrollX - xdef map - xdef pathwayMap - xdef itemsMap + + xdef foregroundMapPtr + xdef pathwayMapPtr + xdef startForegroundMapPtr + xdef startPathwayMapPtr + xdef mapSize xdef moving xdef foregroundScrollPixels -TIMING_TEST equ 0 byteMap: dc.l Entry @@ -77,6 +79,8 @@ Entry: Reset: + move.l startForegroundMapPtr,foregroundMapPtr + move.l startPathwayMapPtr,pathwayMapPtr move.w #0,pathwayRenderPending move.w #0,moving move.l #playareaFade,playareaFadePtr @@ -351,7 +355,7 @@ ResetBigBangPattern: RenderNextForegroundFrame: - lea map,a2 + move.l foregroundMapPtr,a2 move.l foregroundScrollX,d0 lsr.l #FOREGROUND_SCROLL_TILE_INDEX_CONVERT,d0 lsr.l #1,d0 @@ -379,7 +383,7 @@ RenderPathway: move.w #6,d6 ; y index move.w #0,d7 ; number of rows without a pathway .loopY: - lea pathwayMap,a2 + move.l pathwayMapPtr,a2 bsr GetMapTile move.l d0,a2 move.w (a2),d0 @@ -427,7 +431,7 @@ ClearPathway: .loopX: move.w #6,d6 ; y index .loopY: - lea map,a2 ; todo: this will be too slow, it will render too many tiles + move.l foregroundMapPtr,a2 ;; todo: this will be too slow, it will render too many tiles bsr GetMapTile move.l d0,a2 move.w (a2),d0 @@ -465,8 +469,8 @@ ClearPathway: RenderMapTile: ;; d5 - x map index ;; d6 - y map index - - lea map,a2 + + move.l foregroundMapPtr,a2 bsr GetMapTile move.l d0,a2 move.w (a2),d0 @@ -526,7 +530,7 @@ GetMapTile: RenderNextForegroundPathwayFrame: - lea pathwayMap,a2 + move.l pathwayMapPtr,a2 move.l foregroundScrollX,d0 lsr.l #FOREGROUND_SCROLL_TILE_INDEX_CONVERT,d0 lsr.l #1,d0 @@ -607,7 +611,7 @@ BigBang: jsr SwitchBuffers jsr UpdatePlayerFallingAnimation - lea map,a2 + move.l foregroundMapPtr,a2 move.l foregroundScrollX,d0 lsr.l #FOREGROUND_SCROLL_TILE_INDEX_CONVERT,d0 lsr.l #1,d0 @@ -651,7 +655,7 @@ ClearForegroundTile3: sub.l d0,d0 move.w (a2),d0 add.l d0,a1 - lea map,a3 + move.l foregroundMapPtr,a3 add.l #FOREGROUND_PLAYAREA_WIDTH_WORDS*FOREGROUND_PLAYAREA_HEIGHT_WORDS,a3 move.l (a4),d1 cmp.l #10,d1 @@ -677,7 +681,7 @@ ClearForegroundTile: sub.l d0,d0 move.w (a4),d0 add.l d0,a1 - lea map,a3 + move.l foregroundMapPtr,a3 add.l #FOREGROUND_PLAYAREA_WIDTH_WORDS*FOREGROUND_PLAYAREA_HEIGHT_WORDS,a3 cmp.l a3,a2 ; don't clear until the full play area has scrolled in blt .s3 @@ -1214,14 +1218,23 @@ mpanel: pathwayMap: include "out/pathway-map.s" dc.w $FFFF -map: +foregroundMap: include "out/foreground-map.s" dc.w $FFFF itemsMap: include "out/items-indexes.s" dc.w $FFFF mapSize: - dc.l itemsMap-map + dc.l itemsMap-foregroundMap +foregroundMapPtr: + dc.l 0 +pathwayMapPtr: + dc.l 0 +startForegroundMapPtr: + dc.l foregroundMap +startPathwayMapPtr: + dc.l pathwayMap + foregroundScrollPixels: diff --git a/028.bs/player.s b/028.bs/player.s index be802e2..c2cf3a6 100644 --- a/028.bs/player.s +++ b/028.bs/player.s @@ -241,8 +241,8 @@ CheckPlayerMiss: rts .check: - lea pathwayMap,a2 - lea map,a3 + move.l pathwayMapPtr,a2 + move.l foregroundMapPtr,a3 ;; calculate the a2 offset of the top right tile based on foreground scroll move.l foregroundScrollX,d0 @@ -281,14 +281,15 @@ CheckPlayerMiss: ;; a2 now points at the pathway tile under the sprite move.w (a2),d0 - + bsr CheckDirection cmp.w #$78e,d0 bge .noBigBang ;; a3 now points at the tile under the sprite - move.w (a3),d0 + move.w (a3),d0 + cmp.w #$78e,d0 bge .noBigBang @@ -309,6 +310,19 @@ CheckPlayerMiss: bra .dontClearPathway .clearPathway: move.w #2,pathwayClearPending + + + move.l #PLAYER_BOTTOM_Y,d0 + sub.w spriteY,d0 + lsr.w #4,d0 ; y columns + move.w #FOREGROUND_PLAYAREA_HEIGHT_WORDS-1,d1 + sub.l d0,d1 + mulu.w #2,d1 + sub.l d1,a3 + sub.l d1,a2 + move.l a3,startForegroundMapPtr + move.l a2,startPathwayMapPtr + .dontClearPathway: rts