mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
CON: Add getclosestcol command, which finds the closest palette index given
getclosestcol <return> <color> <limit> <color> is encoded the same as PROJ_FLASH_COLOR. <limit> is the index of the last palette color that should be considered. Use 255 for the whole palette, 254 to exclude the transparent color, 239 to exclude Duke 3D's fullbrights, etc. git-svn-id: https://svn.eduke32.com/eduke32@6259 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ffc7de9911
commit
517517a1bb
3 changed files with 12 additions and 0 deletions
|
@ -574,6 +574,7 @@ const char *keyw[] =
|
|||
"divscale", // 400
|
||||
"scalevar", // 401
|
||||
"undefinegamefunc", // 402
|
||||
"getclosestcol", // 403
|
||||
"<null>"
|
||||
};
|
||||
#endif
|
||||
|
@ -4078,6 +4079,7 @@ DO_DEFSTATE:
|
|||
continue;
|
||||
|
||||
case CON_CLAMP:
|
||||
case CON_GETCLOSESTCOL:
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(2);
|
||||
continue;
|
||||
|
|
|
@ -1136,6 +1136,7 @@ enum ScriptKeywords_t
|
|||
CON_DIVSCALE, // 400
|
||||
CON_SCALEVAR, // 401
|
||||
CON_UNDEFINEGAMEFUNC, // 402
|
||||
CON_GETCLOSESTCOL, // 403
|
||||
CON_END
|
||||
};
|
||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||
|
|
|
@ -4890,6 +4890,15 @@ finish_qsprintf:
|
|||
}
|
||||
continue;
|
||||
|
||||
case CON_GETCLOSESTCOL:
|
||||
insptr++;
|
||||
{
|
||||
tw = *insptr++;
|
||||
int32_t const rgb = Gv_GetVarX(*insptr++);
|
||||
Gv_SetVarX(tw, getclosestcol_lim(rgb & 0xFF, (rgb >> 8) & 0xFF, (rgb >> 16) & 0xFF, Gv_GetVarX(*insptr++)));
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_INV:
|
||||
if ((aGameVars[*(insptr + 1)].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) == 0)
|
||||
aGameVars[*(insptr + 1)].global = -aGameVars[*(insptr + 1)].global;
|
||||
|
|
Loading…
Reference in a new issue