From: karri Date: Wed, 14 Nov 2012 19:08:24 +0000 (+0000) Subject: Add edge parameter X-Git-Tag: V2.14~139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7cda393a82eba33d88d784bb05b348303e4f1f87;p=cc65 Add edge parameter git-svn-id: svn://svn.cc65.org/cc65/trunk@5935 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/sp65/lynxsprite.c b/src/sp65/lynxsprite.c index f86c14f55..adce53fca 100644 --- a/src/sp65/lynxsprite.c +++ b/src/sp65/lynxsprite.c @@ -113,6 +113,18 @@ static unsigned GetActionPointY (const Collection* A) } } +static unsigned GetEdgeIndex (const Collection* A) +/* Return the sprite mode from the attribute collection A */ +{ + /* Get index for edge color in shaped mode */ + const char* EdgeIndex = GetAttrVal (A, "edge"); + if (EdgeIndex) { + return atoi(EdgeIndex); + } else { + return 0; + } +} + static char OutBuffer[512]; /* The maximum size is 508 pixels */ static unsigned char OutIndex; @@ -133,12 +145,12 @@ static void AssembleByte(unsigned bits, char val) byte <<= bit_counter; OutBuffer[OutIndex++] = byte; if (!OutIndex) { - Error ("ASprite is too large for the Lynx"); + Error ("Sprite is too large for the Lynx"); } if (byte & 0x1) { OutBuffer[OutIndex++] = byte; if (!OutIndex) { - Error ("BSprite is too large for the Lynx"); + Error ("Sprite is too large for the Lynx"); } } } @@ -150,7 +162,7 @@ static void AssembleByte(unsigned bits, char val) byte <<= bit_counter; OutBuffer[OutIndex++] = byte; if (!OutIndex) { - Error ("ASprite is too large for the Lynx"); + Error ("Sprite is too large for the Lynx"); } } return; @@ -363,6 +375,10 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A) unsigned OX, OY; char ColorBits; char ColorMask; + char EdgeIndex; + + /* Get EdgeIndex */ + EdgeIndex = GetEdgeIndex (A); /* Action point of the sprite */ OX = GetActionPointX (A); @@ -417,7 +433,7 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A) /* Fetch next bit into byte buffer */ LineBuffer[i] = GetPixel (B, X, Y).Index & ColorMask; - if (LineBuffer[i]) { + if (LineBuffer[i] != EdgeIndex) { LastOpaquePixel = i; } ++i; @@ -451,7 +467,7 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A) /* Fetch next bit into byte buffer */ LineBuffer[i] = GetPixel (B, X, Y).Index & ColorMask; - if (LineBuffer[i]) { + if (LineBuffer[i] != EdgeIndex) { LastOpaquePixel = i; } ++i; @@ -485,7 +501,7 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A) /* Fetch next bit into byte buffer */ LineBuffer[i] = GetPixel (B, X, Y).Index & ColorMask; - if (LineBuffer[i]) { + if (LineBuffer[i] != EdgeIndex) { LastOpaquePixel = i; } ++i; @@ -509,7 +525,7 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A) /* Fetch next bit into byte buffer */ LineBuffer[i] = GetPixel (B, X, Y).Index & ColorMask; - if (LineBuffer[i]) { + if (LineBuffer[i] != EdgeIndex) { LastOpaquePixel = i; } ++i;