- Added desaturation translation support to ACC. This is the same as the % syntax introduced

by DECORATE. Note that the values in the color range are fixed point numbers. i.e. You must
  use 1.0 and not 1. This is in keeping with the existing convention.

SVN r3879 (trunk)
This commit is contained in:
Randy Heit 2012-09-20 02:26:58 +00:00
parent 14d9aee65c
commit 9af2df3096
3 changed files with 16 additions and 2 deletions

16
parse.c
View file

@ -2473,6 +2473,7 @@ static void LeadingHudMessage(void)
// replacement: palrep | colorrep
// palrep: exp : exp
// colorrep: [exp,exp,exp]:[exp,exp,exp]
// desatrep: %colorrep
//==========================================================================
static void LeadingCreateTranslation(void)
@ -2484,6 +2485,8 @@ static void LeadingCreateTranslation(void)
PC_AppendCmd(PCD_STARTTRANSLATION);
while (tk_Token == TK_COMMA)
{
pcd_t translationcode;
TK_NextToken();
EvalExpression(); // Get first palette entry in range
TK_TokenMustBe(TK_COLON, ERR_MISSING_COLON);
@ -2492,6 +2495,15 @@ static void LeadingCreateTranslation(void)
TK_TokenMustBe(TK_ASSIGN, ERR_MISSING_ASSIGN);
TK_NextToken();
if(tk_Token == TK_PERCENT)
{
translationcode = PCD_TRANSLATIONRANGE3;
TK_NextTokenMustBe(TK_LBRACKET, ERR_MISSING_LBRACKET);
}
else
{
translationcode = PCD_TRANSLATIONRANGE2;
}
if(tk_Token == TK_LBRACKET)
{ // Replacement is color range
int i, j;
@ -2520,7 +2532,6 @@ static void LeadingCreateTranslation(void)
TK_NextToken();
}
}
PC_AppendCmd(PCD_TRANSLATIONRANGE2);
}
else
{ // Replacement is palette range
@ -2528,8 +2539,9 @@ static void LeadingCreateTranslation(void)
TK_TokenMustBe(TK_COLON, ERR_MISSING_COLON);
TK_NextToken();
EvalExpression();
PC_AppendCmd(PCD_TRANSLATIONRANGE1);
translationcode = PCD_TRANSLATIONRANGE1;
}
PC_AppendCmd(translationcode);
}
PC_AppendCmd(PCD_ENDTRANSLATION);
TK_TokenMustBe(TK_RPAREN, ERR_MISSING_RPAREN);

View file

@ -475,6 +475,7 @@ static char *PCDNames[PCODE_COMMAND_COUNT] =
"PCD_PUSHFUNCTION", // from Eternity
"PCD_CALLSTACK", // from Eternity
"PCD_SCRIPTWAITNAMED",
"PCD_TRANSLATIONRANGE3",
};
// CODE --------------------------------------------------------------------

View file

@ -424,6 +424,7 @@ typedef enum
PCD_PUSHFUNCTION, // from Eternity
PCD_CALLSTACK, // from Eternity
PCD_SCRIPTWAITNAMED,
PCD_TRANSLATIONRANGE3,
PCODE_COMMAND_COUNT
} pcd_t;