From 8def0bd2aa1f184e558016d7d63179c322a8f5a4 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Sat, 14 May 2016 16:44:13 +1000 Subject: [PATCH] simple menu screen --- 028.bs/Makefile | 19 ++- 028.bs/P6112-Options.i | 2 +- 028.bs/P6112-Play.s | 1 + 028.bs/assets/font8x85.pal | 32 ++++ 028.bs/blitmtext85.s | 117 +++++++++++++++ 028.bs/game1.s | 81 ++++------ 028.bs/menu.s | 297 +++++++++++++++++++++++++++++++++++++ 028.bs/splash.s | 14 +- tools/imagecon/imagecon.c | 10 +- tools/imagecon/imagecon.h | 1 + tools/imagecon/palette.c | 5 + 11 files changed, 513 insertions(+), 66 deletions(-) create mode 100644 028.bs/assets/font8x85.pal create mode 100644 028.bs/blitmtext85.s create mode 100644 028.bs/menu.s diff --git a/028.bs/Makefile b/028.bs/Makefile index 41c2643..f248f4d 100644 --- a/028.bs/Makefile +++ b/028.bs/Makefile @@ -11,7 +11,7 @@ BASE_ADDRESS=4000 # note: this must be high enough not to conflict with MFMbufE BOOTBLOCK_ASM=alpine_bootblock.s -OBJS=out/init.o out/utils.o out/image.o out/blit.o out/joystick.o out/player.o out/items.o out/blitmtext.o out/blittext.o out/music.o out/P6112-Play.o out/splash.o out/background.o out/sound.o out/trackloader.o out/disk.o out/counter.o out/map.o out/message.o +OBJS=out/init.o out/utils.o out/image.o out/blit.o out/joystick.o out/player.o out/items.o out/blitmtext.o out/blitmtext85.o out/blittext.o out/music.o out/P6112-Play.o out/splash.o out/background.o out/sound.o out/trackloader.o out/disk.o out/counter.o out/map.o out/message.o out/menu.o IMAGES=foreground.png \ background.png \ @@ -66,7 +66,9 @@ IMAGES=foreground.png \ sprite_fallingTank-3.png \ sprite_fallingTank-4.png \ font8x8.png\ - splash.png + font8x85.png\ + splash.png\ + splashSave.png IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin)) @@ -177,8 +179,18 @@ out/sprite_arrow%.png: assets/assets.png out/font%.bin: assets/font%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/font$* --colors=16 --use-palette assets/mpanel.pal --full-color-palette-file --output-mask --transparent-color=0,0,0 --output-png +out/font8x85.bin: assets/font8x8.png + $(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/font8x85 --colors=32 --use-palette assets/font8x85.pal --full-color-palette-file --output-mask --transparent-color=0,0,0 --output-png + +out/splashSave.bin: assets/splash.png out/splash.bin + ../tools/croppa/out/croppa --input=assets/splash.png --output=out/splashSave.png --width=96 --height=64 --rows=1 --cols=1 --dx=0 --dy=0 --x=112 --y=150 + $(IMAGECON) --input out/splashSave.png $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/splashSave --colors=32 --output-copperlist --full-color-palette-file --use-palette=out/splash.pal + out/splash.bin: assets/splash.png - $(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/splash --colors=32 --full-color-palette-file --output-png --output-copperlist + $(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/splash --colors=32 --output-copperlist --full-color-palette-file + +out/menu-palette.s: assets/splash.png + $(IMAGECON) --input $< $(IMAGECON_ARGS) --output-palette-asm --output-palette --output out/menu --colors=32 --output-copperlist --full-color-palette-file --darken=0.55 out/%_playarea_fade.s: out/%_bottom_section_playarea.pal ../tools/fade/out/fade ../tools/fade/out/fade --from-grey --to=out/$*_bottom_section_playarea.pal --output=$*_playarea > out/$*_playarea_fade.s @@ -225,6 +237,7 @@ out/yay.raw: assets/yay.wav out/main.o: $(IMAGEDATA) \ out/levelA_foreground-map.s out/levelB_foreground-map.s \ out/background-map.s Makefile link.script.x\ + out/menu-palette.s\ out/paletteA_playarea_fade.s out/paletteA_flags_fade.s out/paletteA_foreground-palette-table.s out/paletteA_tileFade.s\ out/paletteB_playarea_fade.s out/paletteB_flags_fade.s out/paletteB_foreground-palette-table.s out/paletteB_tileFade.s\ out/panelFade.s out/jump.raw out/falling.raw out/chaching.raw out/whoosh.raw out/yay.raw diff --git a/028.bs/P6112-Options.i b/028.bs/P6112-Options.i index 827e4ae..0a81abd 100644 --- a/028.bs/P6112-Options.i +++ b/028.bs/P6112-Options.i @@ -39,7 +39,7 @@ p61system=0 ;1=system-friendly. Use for DOS/Workbench programs. p61exec =0 ;0 if execbase is destroyed, such as in a trackmo. -p61fade =0 ;enable channel volume fading from your demo +p61fade =1 ;enable channel volume fading from your demo if SFX=1 channels=3 ;<4 for game sound effects in the higher channels. Incompatible diff --git a/028.bs/P6112-Play.s b/028.bs/P6112-Play.s index 20ab6d5..e36beaf 100644 --- a/028.bs/P6112-Play.s +++ b/028.bs/P6112-Play.s @@ -1,6 +1,7 @@ include "P6112-Options.i" xdef P61_Init xdef P61_Music + xdef P61_Master ; #-----+-----------------------------------------# ; |Name:| P6112 - Optimized Player 6.1 Playroutine| ; +-----+-----------------------------------------+ diff --git a/028.bs/assets/font8x85.pal b/028.bs/assets/font8x85.pal new file mode 100644 index 0000000..4ba471f --- /dev/null +++ b/028.bs/assets/font8x85.pal @@ -0,0 +1,32 @@ +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +000 000 000 255 +255 255 255 255 \ No newline at end of file diff --git a/028.bs/blitmtext85.s b/028.bs/blitmtext85.s new file mode 100644 index 0000000..10c2a63 --- /dev/null +++ b/028.bs/blitmtext85.s @@ -0,0 +1,117 @@ + include "includes.i" + xdef DrawMaskedText85 + +BLIT_LF_MINTERM equ $ca ; cookie cut +BLIT_WIDTH_WORDS equ 2 ; blit 2 words to allow shifting +BLIT_WIDTH_BYTES equ 4 +FONT_HEIGHT equ 8 +FONT_WIDTH equ 8 +FONTMAP_WIDTH_BYTES equ 32 +_SCREEN_BIT_DEPTH equ 5 +_BITPLANE_WIDTH_BYTES equ 320/8 + +DrawMaskedText85: + ;; a0 - bitplane + ;; a1 - text + ;; d0 - xpos + ;; d1 - ypos + movem.l d0-d7/a0-a4,-(sp) + WaitBlitter + + ;; blitter config that is shared for every character + move.w #BC0F_SRCA|BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value (masked version) + move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo (only used for masked version) + move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTBMOD(a6) ; B modulo + move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTCMOD(a6) ; C modulo + move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTDMOD(a6) ; D modulo + mulu.w #_BITPLANE_WIDTH_BYTES*_SCREEN_BIT_DEPTH,d1 ; ypos bytes + move.w #$0000,BLTALWM(a6) ; mask out extra word used for shifting + move.w #$ffff,BLTADAT(a6) ; preload source mask so only BLTA?WM mask is used + move.l a1,a3 ; character pointer + move.l #font8x85,a5 ; font pointer + move.l #fontMask,d7 ; font mask pointer + move.w #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT,d3 ; bytes per font line +.loop: + clr.l d2 + move.b (a3)+,d2 ; get next character + cmp.b #0,d2 ; 0 terminates the string + beq .done + move.l a0,a4 ; bitplane pointer + bsr DrawChar8 ; draw it + add.l #FONT_WIDTH,d0 ; increment the x position + bra .loop +.done: + movem.l (sp)+,d0-d7/a0-a4 + rts + +DrawChar8: + ;; kills d2,d4,d5,a1,a2,a4 + ;; d0 - xpos + ;; d1 - ypos bytes + ;; d2* - char + ;; d3 - bytes per font line + ;; d6 - bltcon0 value + ;; a4* - bitplane + ;; a5 - #font + ;; d7 - #fontMask + + sub.w #' ',d2 ; index = char - ' ' + move.w d2,d5 + lsr.w #5,d5 ; char / 32 = fontmap line + andi.w #$1f,d2 ; char index in line (char index - start of line index) + add.l #1,d5 ; while we have a weird font image, ' ' starts on second line + move.l a5,a1 ; #font + mulu.w d3,d5 ; d5 *= #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT + move.l d7,a2 ; #fontMask + add.w d5,a2 ; add y offset in lines to fontMask address + add.w d5,a1 ; add y offset in lines to font address + add.w d2,a1 ; add offset into font + add.l d2,a2 ; add offset into mask + +.blitChar8: + ;; kills a4,d2,d4,d5 + ;; d0 - xpos + ;; d1 - ypos bytes + ;; d2.0 - odd character = 1, even character = 0 + ;; d3 - bytes per font line + ;; d6 - bltcon0 value + ;; a4 - display + ;; a1 - object + ;; a2 - mask + + move.l d0,d4 ; xpos + move.l d0,d5 ; xpos + lsr.w #3,d4 ; d4 = xpos bytes + + WaitBlitter + + btst #0,d2 ; check if odd or even char + beq .evenChar ; +.oddChar + subq #8,d5 ; offset the x position for the odd character + move.w #$00FF,BLTAFWM(a6) ; select the second (odd) character in the word + subq #1,a4 ; move the destination pointer left by one byte + bra .continue +.evenChar: + move.w #$FF00,BLTAFWM(a6) ; select the first character in the word +.continue: + ;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d5 + swap d5 ; d5 << 12 + lsr.l #4,d5 ; + move.w d5,BLTCON1(A6) ; set the shift bits 12-15, bits 00-11 cleared + move.l a2,BLTAPTH(a6) ; mask bitplane + move.l a1,BLTBPTH(a6) ; source bitplane + or.w d6,d5 ; d5 = BLTCON0 value + move.w d5,BLTCON0(a6) ; set minterm, dma channel and shift + add.l d4,a4 ; dest += XPOS_BYTES + add.l d1,a4 ; dest += YPOS_BYTES + move.l a4,BLTCPTH(a6) ; background top left corner + move.l a4,BLTDPTH(a6) ; destination top left corner + + move.w #(FONT_HEIGHT*_SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit + rts + +font8x85: + incbin "out/font8x85.bin" +fontMask: + incbin "out/font8x85-mask.bin" \ No newline at end of file diff --git a/028.bs/game1.s b/028.bs/game1.s index 8502e2b..ac3a4de 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -27,6 +27,8 @@ xdef livesCounterText xdef panel + xdef nextLevelInstaller + xdef levelInstallers byteMap: dc.l Entry @@ -44,10 +46,10 @@ Entry: move.l a3,LVL3_INT_VECTOR jsr StartMusic - jsr ShowSplash - if SPLASH_USE_FOREGROUND=1 - jsr InstallBlackPalette - endif + jsr ShowSplash +MainMenu: + jsr ShowMenu + jsr BlueFill ;; d0 - fg bitplane pointer offset @@ -66,9 +68,9 @@ Entry: lea panel,a1 jsr PokePanelBitplanePointers - jsr InitialiseMessagePanel - - jsr ShowMessagePanel + jsr InitialiseMessagePanel + lea nullText,a1 + jsr Message jsr Init ; enable the playfield jsr InstallSpriteColorPalette @@ -279,25 +281,19 @@ Update: InitialiseNewGame: jsr InitialiseItems jsr InitialisePlayer - jsr InstallLevelA + jsr InstallNextLevel bra Reset GameOver: + move.l #levelInstallers,nextLevelInstaller lea gameOverMessage,a1 jsr Message jsr WaitForJoystick - bra InitialiseNewGame + bra MainMenu -LevelComplete: - PlaySound Yay - jsr ResetItems - jsr HidePlayer - jsr SelectNextPlayerSprite - move.l levelCompleteMessage,a1 - jsr Message - +InstallNextLevel: move.l nextLevelInstaller,a0 cmp.l #0,(a0) bne .dontResetLevelInstaller @@ -308,6 +304,17 @@ LevelComplete: jsr (a1) add.l #4,a0 move.l a0,nextLevelInstaller + rts + +LevelComplete: + PlaySound Yay + jsr ResetItems + jsr HidePlayer + jsr SelectNextPlayerSprite + move.l levelCompleteMessage,a1 + jsr Message + + bsr InstallNextLevel jsr WaitForJoystick @@ -673,33 +680,6 @@ InstallFlagsGreyPalette: dbra d0,.loop rts - if SPLASH_USE_FOREGROUND=1 -InstallBlackPalette: - move.w #$000,COLOR00(a6) - move.w #$000,COLOR01(a6) - move.w #$000,COLOR02(a6) - move.w #$000,COLOR03(a6) - move.w #$000,COLOR04(a6) - move.w #$000,COLOR05(a6) - move.w #$000,COLOR06(a6) - move.w #$000,COLOR07(a6) - move.w #$000,COLOR08(a6) - move.w #$000,COLOR09(a6) - move.w #$000,COLOR10(a6) - move.w #$000,COLOR11(a6) - move.w #$000,COLOR12(a6) - move.w #$000,COLOR13(a6) - move.w #$000,COLOR14(a6) - move.w #$000,COLOR15(a6) - move.w #$000,COLOR16(a6) - move.w #$000,COLOR17(a6) - move.w #$000,COLOR18(a6) - move.w #$000,COLOR19(a6) - move.w #$000,COLOR20(a6) - rts - endif - - InstallTilePalette: move.l tileFade,tileFadePtr lea playAreaCopperPalettePtr2,a1 @@ -806,6 +786,9 @@ InstallFlagGreyPalette: include "copper.i" +nullText: + dc.b 0 + align 4 player1Text: dc.b "P1" dc.b 0 @@ -919,22 +902,14 @@ levelInstallers: dc.l InstallLevelB dc.l 0 nextLevelInstaller: - dc.l levelInstallers+4 + dc.l levelInstallers panelFade: include "out/panelFade.s" - if SPLASH_USE_FOREGROUND=1 -foregroundBitplanes1: - incbin "out/splash.bin" -.endSplash - ds.b (IMAGESIZE*2)-(.endSplash-foregroundBitplanes1) - endif section .bss - if SPLASH_USE_FOREGROUND=0 foregroundBitplanes1: ds.b IMAGESIZE*2 - endif playAreaPalette: dc.l 0 playareaFade: diff --git a/028.bs/menu.s b/028.bs/menu.s new file mode 100644 index 0000000..4b14a5a --- /dev/null +++ b/028.bs/menu.s @@ -0,0 +1,297 @@ + include "includes.i" + + xdef ShowMenu + +SPLASH_COLOR_DEPTH equ 5 +SPLASH_SCREEN_WIDTH_BYTES equ 40 + +PLAY_COPPER_WORD equ $bad1 +MUSIC_COPPER_WORD equ PLAY_COPPER_WORD+$2000 +DIFFICULTY_COPPER_WORD equ PLAY_COPPER_WORD+$1000 + +MENU_SELECTED_TOP_COLOR equ $be0 ;$e71 +MENU_SELECTED_BOTTOM_COLOR equ $9d4 ;$fe7 +MENU_TEXT_COLOR equ $7ef + +ShowMenu: + lea CUSTOM,a6 + + jsr WaitVerticalBlank + ;; set up default palette + include "out/menu-palette.s" + + ;; set up playfield + move.w #(RASTER_Y_START<<8)|RASTER_X_START,DIWSTRT(a6) + move.w #((RASTER_Y_STOP-256)<<8)|(RASTER_X_STOP-256),DIWSTOP(a6) + + move.w #(RASTER_X_START/2-SCREEN_RES),DDFSTRT(a6) + move.w #(RASTER_X_START/2-SCREEN_RES)+(8*((SCREEN_WIDTH/16)-1)),DDFSTOP(a6) + + move.w #(SPLASH_COLOR_DEPTH<<12)|$200,BPLCON0(a6) + move.w #0,BPLCON1(a6) + move.w #SPLASH_SCREEN_WIDTH_BYTES*SPLASH_COLOR_DEPTH-SPLASH_SCREEN_WIDTH_BYTES,BPL1MOD(a6) + move.w #SPLASH_SCREEN_WIDTH_BYTES*SPLASH_COLOR_DEPTH-SPLASH_SCREEN_WIDTH_BYTES,BPL2MOD(a6) + + ;; poke bitplane pointers + lea splash,a1 + lea splashCopperListBplPtr(pc),a2 + moveq #SPLASH_COLOR_DEPTH-1,d0 +.bitplaneloop: + move.l a1,d1 + move.w d1,2(a2) + swap d1 + move.w d1,6(a2) + lea SPLASH_SCREEN_WIDTH_BYTES(a1),a1 ; bit plane data is interleaved + addq #8,a2 + dbra d0,.bitplaneloop + + ;; install copper list, then enable dma + lea splashCopperList(pc),a0 + move.l a0,COP1LC(a6) + + ;; jsr WaitVerticalBlank + move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6) + move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6) + + bsr RefreshDifficulty + bsr RenderMenu + +.wait: + jsr WaitVerticalBlank + jsr _ProcessJoystick + rts + + +RenderMenu: + lea splashSave,a0 + lea splash,a2 + add.l #(150*40*5)+((320-96)/16),a2 + + WaitBlitter + move.w #(BC0F_SRCA|BC0F_DEST|$f0),BLTCON0(A6) + move.w #0,BLTCON1(a6) + move.l #$ffffffff,BLTAFWM(a6) ;no masking of first/last word + move.w #0,BLTAMOD(a6) ;A modulo + move.w #(320-96)/8,BLTDMOD(a6) ;D modulo + move.l a0,BLTAPTH(a6) ;source graphic top left corner + move.l a2,BLTDPTH(a6) ;destination top left corner + move.w #((64*5)<<6)|(96/16),BLTSIZE(a6) + + lea menu,a1 + lea splash,a0 + move.w #(320/2)-(6*8)+4,d0 + move.w #150,d1 + jsr DrawMaskedText85 + lea difficulty,a1 + move.w #(320/2)-(6*8),d0 + add.w #16,d1 + jsr DrawMaskedText85 + lea music,a1 + add.w #16,d1 + jsr DrawMaskedText85 + lea credits,a1 + add.w #16,d1 + move.w #(320/2)-(6*8)+4,d0 + jsr DrawMaskedText85 + rts + +MenuUp: + cmp.w #PLAY_COPPER_WORD,selectedStartPtr + beq .done + PlaySound Jump + sub.w #$1000,selectedStartPtr + sub.w #$1000,selectedStartPtr2 + sub.w #$1000,selectedEndPtr +.done: + rts + +MenuDown: + cmp.w #$ead1,selectedStartPtr + beq .done + PlaySound Jump + add.w #$1000,selectedStartPtr + add.w #$1000,selectedStartPtr2 + add.w #$1000,selectedEndPtr +.done: + rts + +ToggleMusic: + eor.w #64,P61_Master + cmp.w #64,P61_Master + beq .musicOn +.musicOff: + lea musicOff,a0 + lea music,a1 + bsr StrCpy + bra .done +.musicOn: + lea musicOn,a0 + lea music,a1 + bsr StrCpy + bra .done +.done: + bsr RenderMenu + rts + +ToggleDifficulty: + cmp.l #levelInstallers,nextLevelInstaller + beq .currentlyEasy +.currentlyHard: + move.l #levelInstallers,nextLevelInstaller + bra RefreshDifficulty +.currentlyEasy: + move.l #levelInstallers+4,nextLevelInstaller + bra RefreshDifficulty +RefreshDifficulty: + cmp.l #levelInstallers,nextLevelInstaller + beq .easy +.hard: + lea difficultyHard,a0 + lea difficulty,a1 + bsr StrCpy + bra .done +.easy: + lea difficultyEasy,a0 + lea difficulty,a1 + bsr StrCpy + bra .done +.done: + bsr RenderMenu + rts + +ButtonPressed: + cmp.w #PLAY_COPPER_WORD,selectedStartPtr + beq .playButton + cmp.w #MUSIC_COPPER_WORD,selectedStartPtr + beq .musicButton + cmp.w #DIFFICULTY_COPPER_WORD,selectedStartPtr + beq .difficultyButton + bra .done +.difficultyButton: + bsr ToggleDifficulty + bra .done +.musicButton: + bsr ToggleMusic + bra .done +.done: + bra _ProcessJoystick +.playButton: + rts + +WaitForButtonRelease: +.joystickPressed: + jsr WaitVerticalBlank + jsr PlayNextSound + jsr ReadJoystick + btst.b #0,joystick + bne .joystickPressed + rts + +WaitForJoystickRelease: + move.b joystickpos,-(sp) +.wait: + jsr WaitVerticalBlank + jsr PlayNextSound + jsr ReadJoystick + move.b (sp),d0 + cmp.b joystickpos,d0 + beq .wait + move.b (sp)+,d7 + rts + + +_ProcessJoystick: + bsr WaitForButtonRelease +.wait: + jsr ReadJoystick + jsr WaitVerticalBlank + jsr PlayNextSound + btst.b #0,joystick + bne .pressed + cmp.b #1,joystickpos ; up + bne .notUp + bsr MenuUp + bsr WaitForJoystickRelease +.notUp: + cmp.b #5,joystickpos ; down + bne .notDown + bsr MenuDown + bsr WaitForJoystickRelease +.notDown: + bra .wait +.pressed: + bra ButtonPressed + rts + +StrCpy: + ;; a0 - src + ;; a1 - dest +.loop: + cmp.b #0,(a0) + beq .done + move.b (a0)+,(a1)+ + bra .loop +.done: + rts + +menu: + dc.b " PLAY NOW! " + dc.b 0 +difficulty: + dc.b "LEVEL - EASY" + dc.b 0 +music: + dc.b "MUSIC - ON " + dc.b 0 +credits: + dc.b " CREDITS " + dc.b 0 + align 4 + + +difficultyEasy: + dc.b "LEVEL - EASY" + dc.b 0 + +difficultyHard: + dc.b "LEVEL - HARD" + dc.b 0 + +musicOn: + dc.b "MUSIC - ON " + dc.b 0 +musicOff: + dc.b "MUSIC - OFF " + dc.b 0 + +splashCopperList: +splashCopperListBplPtr: + dc.w BPL1PTL,0 + dc.w BPL1PTH,0 + dc.w BPL2PTL,0 + dc.w BPL2PTH,0 + dc.w BPL3PTL,0 + dc.w BPL3PTH,0 + dc.w BPL4PTL,0 + dc.w BPL4PTH,0 + dc.w BPL5PTL,0 + dc.w BPL5PTH,0 + dc.w BPL6PTL,0 + dc.w BPL6PTH,0 + + dc.w COLOR31,MENU_TEXT_COLOR +selectedStartPtr: + dc.w PLAY_COPPER_WORD,$fffe + dc.w COLOR31,MENU_SELECTED_TOP_COLOR +selectedStartPtr2: + dc.w PLAY_COPPER_WORD+(($1000/4)*3),$fffe + dc.w COLOR31,MENU_SELECTED_BOTTOM_COLOR + +selectedEndPtr: + dc.w PLAY_COPPER_WORD+$1000,$fffe + dc.w COLOR31,MENU_TEXT_COLOR + + dc.l $fffffffe + +splashSave: + incbin "out/splashSave.bin" diff --git a/028.bs/splash.s b/028.bs/splash.s index 56b939c..b45d395 100644 --- a/028.bs/splash.s +++ b/028.bs/splash.s @@ -1,7 +1,8 @@ include "includes.i" xdef ShowSplash - + xdef splash + SPLASH_COLOR_DEPTH equ 5 SPLASH_SCREEN_WIDTH_BYTES equ 40 @@ -20,11 +21,7 @@ ShowSplash: move.w #SPLASH_SCREEN_WIDTH_BYTES*SPLASH_COLOR_DEPTH-SPLASH_SCREEN_WIDTH_BYTES,BPL2MOD(a6) ;; poke bitplane pointers - if SPLASH_USE_FOREGROUND=1 - lea foregroundBitplanes1,a1 - else lea splash(pc),a1 - endif lea splashCopperListBplPtr(pc),a2 moveq #SPLASH_COLOR_DEPTH-1,d0 .bitplaneloop: @@ -44,10 +41,13 @@ ShowSplash: ;; set up default palette include "out/splash-palette.s" + lea COLOR31(a6),a0 + move.w #$f00,(a0) + jsr WaitVerticalBlank move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6) move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6) - + .wait: jsr WaitVerticalBlank jsr WaitForJoystick @@ -70,7 +70,5 @@ splashCopperListBplPtr: dc.w BPL6PTH,0 dc.l $fffffffe - if SPLASH_USE_FOREGROUND=0 splash: incbin "out/splash.bin" - endif \ No newline at end of file diff --git a/tools/imagecon/imagecon.c b/tools/imagecon/imagecon.c index abda434..536caee 100644 --- a/tools/imagecon/imagecon.c +++ b/tools/imagecon/imagecon.c @@ -22,7 +22,8 @@ imagecon_config_t config = { .overridePalette = 0, .paletteOffset = 0, .maskTransparentColor = 0, - .fullColorPaletteFile = 0 + .fullColorPaletteFile = 0, + .darken = 0 }; @@ -51,6 +52,7 @@ usage() " --use-palette \n"\ " --full-color-palette-file\n"\ " --palette-offset \n"\ + " --darken \n"\ " --verbose\n", config.argv[0]); exit(1); } @@ -506,6 +508,7 @@ main(int argc, char **argv) {"output", required_argument, 0, 'o'}, {"colors", required_argument, 0, 'c'}, {"input", required_argument, 0, 'i'}, + {"darken", required_argument, 0, 'd'}, {"transparent-color", required_argument, 0, 't'}, {0, 0, 0, 0} }; @@ -529,6 +532,11 @@ main(int argc, char **argv) case 'p': config.overridePalette = optarg; break; + case 'd': + if (sscanf(optarg, "%f", &config.darken) != 1) { + abort_("invalid darken argument"); + } + break; case 'l': if (sscanf(optarg, "%d", &config.paletteOffset) != 1) { abort_("invalid palette offset"); diff --git a/tools/imagecon/imagecon.h b/tools/imagecon/imagecon.h index b82f4d2..f0807d2 100644 --- a/tools/imagecon/imagecon.h +++ b/tools/imagecon/imagecon.h @@ -44,6 +44,7 @@ typedef struct { int quantize; int outputPng; int verbose; + float darken; char** argv; } imagecon_config_t; diff --git a/tools/imagecon/palette.c b/tools/imagecon/palette.c index f962735..5df0a90 100644 --- a/tools/imagecon/palette.c +++ b/tools/imagecon/palette.c @@ -89,6 +89,11 @@ palette_output(imagecon_image_t* ic, char* outFilename) } for (int i = 0; i < (config.ehbMode ? ic->numColors/2 : ic->numColors); i++) { + if (config.darken != 0) { + ic->palette[i].r *= config.darken; + ic->palette[i].g *= config.darken; + ic->palette[i].b *= config.darken; + } if (config.verbose) { printf("%02d: hex=%03x r=%03d g=%03d b=%03d a=%03d\n", i , RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b), ic->palette[i].r, ic->palette[i].g, ic->palette[i].b, ic->palette[i].a); }