Add support for colourise/tint translation like SLADE 3's.

This commit is contained in:
Gaerzi 2017-03-05 20:42:36 +01:00 committed by Christoph Oelckers
parent b53b6e1f77
commit 3256a3ec46
4 changed files with 23 additions and 1 deletions

18
parse.c
View file

@ -2526,10 +2526,12 @@ static void LeadingHudMessage(void)
// arglist: arg | arglist arg
// arg: range = replacement
// range: exp : exp
// replacement: palrep | colorrep
// replacement: palrep | colorrep | desatrep | colouriserep | tintrep
// palrep: exp : exp
// colorrep: [exp,exp,exp]:[exp,exp,exp]
// desatrep: %colorrep
// colouriserep: #[exp,exp,exp]
// tintrep: @exp[exp,exp,exp]
//==========================================================================
static void LeadingCreateTranslation(void)
@ -2556,6 +2558,18 @@ static void LeadingCreateTranslation(void)
translationcode = PCD_TRANSLATIONRANGE3;
TK_NextTokenMustBe(TK_LBRACKET, ERR_MISSING_LBRACKET);
}
else if (tk_Token == TK_NUMBERSIGN)
{
translationcode = PCD_TRANSLATIONRANGE4;
TK_NextTokenMustBe(TK_LBRACKET, ERR_MISSING_LBRACKET);
}
else if (tk_Token == TK_ATSIGN)
{
translationcode = PCD_TRANSLATIONRANGE5;
TK_NextToken();
EvalExpression();
TK_TokenMustBe(TK_LBRACKET, ERR_MISSING_LBRACKET);
}
else
{
translationcode = PCD_TRANSLATIONRANGE2;
@ -2581,6 +2595,8 @@ static void LeadingCreateTranslation(void)
}
TK_NextToken();
}
if (translationcode == PCD_TRANSLATIONRANGE4 || translationcode == PCD_TRANSLATIONRANGE5)
break;
if(j == 2)
{
TK_TokenMustBe(TK_COLON, ERR_MISSING_COLON);

View file

@ -448,6 +448,8 @@ typedef enum
PCD_STRCPYTOSCRIPTCHRANGE,
PCD_LSPEC5EX,
PCD_LSPEC5EXRESULT,
PCD_TRANSLATIONRANGE4,
PCD_TRANSLATIONRANGE5,
PCODE_COMMAND_COUNT
} pcd_t;

View file

@ -1342,6 +1342,9 @@ static void ProcessSpecialToken(void)
case '#':
tk_Token = TK_NUMBERSIGN;
break;
case '@':
tk_Token = TK_ATSIGN;
break;
case '^':
if(Chr == '=')
{

View file

@ -136,6 +136,7 @@ typedef enum
TK_ENDREGION, // 'endregion' [mxd]
TK_KILL, // 'kill' [JM]
TK_REOPEN, // 'reopen' [Nash]
TK_ATSIGN, // '@'
} tokenType_t;
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------