Mapster32: introduce DEF command "2dcolidxrange <col> <idx> <idxend>".

<col> is the editorcolor[] starting index
<idx> is the actual color index start
<idxend> is the actual color index end

So, editor colors from <col> onward will be mapped to
[<idx> .. min(<idxend>, 255)].

Takes precedence over '2dcol'.

git-svn-id: https://svn.eduke32.com/eduke32@5427 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-11-14 23:40:57 +00:00
parent 5e61b28ebc
commit eb863ef1dc
2 changed files with 19 additions and 3 deletions

View file

@ -81,7 +81,7 @@ enum scripttoken_t
T_ORIGSIZEX,T_ORIGSIZEY,
T_UNDEFMODEL,T_UNDEFMODELRANGE,T_UNDEFMODELOF,T_UNDEFTEXTURE,T_UNDEFTEXTURERANGE,
T_ALPHAHACK,T_ALPHAHACKRANGE,
T_SPRITECOL,T_2DCOL,
T_SPRITECOL,T_2DCOL,T_2DCOLIDXRANGE,
T_FOGPAL,
T_LOADGRP,
T_DUMMYTILE,T_DUMMYTILERANGE,
@ -367,6 +367,7 @@ static int32_t defsparser(scriptfile *script)
{ "alphahackrange", T_ALPHAHACKRANGE },
{ "spritecol", T_SPRITECOL },
{ "2dcol", T_2DCOL },
{ "2dcolidxrange", T_2DCOLIDXRANGE },
{ "fogpal", T_FOGPAL },
{ "loadgrp", T_LOADGRP },
{ "dummytile", T_DUMMYTILE },
@ -570,6 +571,18 @@ static int32_t defsparser(scriptfile *script)
}
}
break;
case T_2DCOLIDXRANGE: // NOTE: takes precedence over 2dcol, see InitCustomColors()
{
int32_t col, idx, idxend;
if (scriptfile_getnumber(script,&col)) break;
if (scriptfile_getnumber(script,&idx)) break;
if (scriptfile_getnumber(script,&idxend)) break;
while ((unsigned)col < 256 && idx <= idxend)
editorcolors[col++] = idx++;
}
break;
case T_FOGPAL:
{
int32_t p,r,g,b;

View file

@ -7890,8 +7890,11 @@ static void InitCustomColors(void)
for (i = 0; i<256; i++)
{
edcol = (palette_t *)&vgapal16[4*i];
editorcolors[i] = getclosestcol_lim(edcol->b,edcol->g,edcol->r, 239);
if (editorcolors[i] == 0)
{
edcol = (palette_t *)&vgapal16[4*i];
editorcolors[i] = getclosestcol_lim(edcol->b,edcol->g,edcol->r, 239);
}
}
}