From 6a4ff347da8cda7340cea1a783b25006904702b1 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 10 Jun 2023 22:37:29 -0400 Subject: [PATCH] sb: fix blue/orange sprite to have pseudo transparency --- games/sb/TODO | 32 +++++++++++++++++++------------- games/sb/hgr_sprite_big.s | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/games/sb/TODO b/games/sb/TODO index ca0df978..534e85f6 100644 --- a/games/sb/TODO +++ b/games/sb/TODO @@ -1,5 +1,14 @@ -Title -+ ? +Strongbadzone: ++ Implement rest of audio ++ Ball movement logic. Is actually just 2D + -> Collision detect with head. Decrement count, play sound + -> Collision detect with player ++ Do the color mask (different blacks) ++ Animate side walls + -> This is going to involve fancy memory management ++ Faster hgr copy? ++ Optimize sprite size ++ Allow lowercase keyboard (see duck code) Duck: + Implement throwing @@ -8,21 +17,18 @@ Duck: + Implement easter eggs + Exit back to main title -Rat: -+ ? -Strongbadzone: -+ Get audio -+ Ball movement logic. Is actually just 2D -+ Check bounds on person -+ Do the color mask (different blacks) -+ Animate side walls -+ Faster hgr copy? -+ Optimize sprite size -+ Allow lowercase keyboard (see duck code) Cliff: + Everything Jump + Everything + +Rat: ++ Done? + +Title ++ Done? + + diff --git a/games/sb/hgr_sprite_big.s b/games/sb/hgr_sprite_big.s index 9a8d0d2f..e25645eb 100644 --- a/games/sb/hgr_sprite_big.s +++ b/games/sb/hgr_sprite_big.s @@ -3,6 +3,9 @@ ;=========================================== ; can handle sprites bigger than a 256 byte page + ; Note this is optimized for blue/orange sprites + ; it treats black0 as transparent + ; SPRITE in INL/INH ; Location at SPRITE_X SPRITE_Y @@ -66,8 +69,10 @@ big_sprite_inner_loop: big_sprite_smc1: lda $f000,X ; load sprite data + beq big_sprite_transparent sta (GBASL),Y ; store to screen +big_sprite_transparent: inx ; increment sprite offset ; if > 1 page @@ -146,7 +151,20 @@ osprite_inner_loop: osprite_smc1: lda $f000,X ; load sprite data + bne osprite_not_transparent + + ; we can't just skip if 0 because we might shift a bit in + ; from previous byte + + plp + bcs osprite_oops + clc + php + bcc osprite_transparent_done + +osprite_not_transparent: plp ; restore carry from last +osprite_oops: rol ; rotate in carry asl ; one more time, bit6 in carry php ; save on stack @@ -155,6 +173,8 @@ osprite_smc1: sta (GBASL),Y ; store to screen + +osprite_transparent_done: inx ; increment sprite offset ; if > 1 page