mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
P_LoadRawSideDefs2 colormap cleanup (merge ogl and software to one block)
This commit is contained in:
parent
e33ed45b7b
commit
574a591d43
1 changed files with 7 additions and 75 deletions
|
@ -1474,82 +1474,17 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
// Perhaps we should just call it instead of doing the calculations here.
|
||||
if (rendermode == render_soft || rendermode == render_none)
|
||||
{
|
||||
if (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#')
|
||||
{
|
||||
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
msd->bottomtexture);
|
||||
sd->toptexture = sd->bottomtexture = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1)
|
||||
sd->toptexture = 0;
|
||||
else
|
||||
sd->toptexture = num;
|
||||
if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1)
|
||||
sd->midtexture = 0;
|
||||
else
|
||||
sd->midtexture = num;
|
||||
if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1)
|
||||
sd->bottomtexture = 0;
|
||||
else
|
||||
sd->bottomtexture = num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (
|
||||
((rendermode == render_soft || rendermode == render_none) && (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#'))
|
||||
#ifdef HWRENDER
|
||||
else
|
||||
{
|
||||
// for now, full support of toptexture only
|
||||
if ((msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6])
|
||||
|| (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]))
|
||||
|| (msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6])
|
||||
|| (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char *col;
|
||||
|
||||
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
sec->extra_colormap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
msd->bottomtexture);
|
||||
sd->toptexture = sd->bottomtexture = 0;
|
||||
#define HEX2INT(x) (x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||
#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0)
|
||||
sec->extra_colormap = &extra_colormaps[sec->midmap];
|
||||
|
||||
if (msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6])
|
||||
{
|
||||
col = msd->toptexture;
|
||||
|
||||
sec->extra_colormap->rgba =
|
||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||
|
||||
// alpha
|
||||
if (msd->toptexture[7])
|
||||
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
||||
else
|
||||
sec->extra_colormap->rgba += (25 << 24);
|
||||
}
|
||||
else
|
||||
sec->extra_colormap->rgba = 0;
|
||||
|
||||
if (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])
|
||||
{
|
||||
col = msd->bottomtexture;
|
||||
|
||||
sec->extra_colormap->fadergba =
|
||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||
|
||||
// alpha
|
||||
if (msd->bottomtexture[7])
|
||||
sec->extra_colormap->fadergba += (ALPHA2INT(col[7]) << 24);
|
||||
else
|
||||
sec->extra_colormap->fadergba += (25 << 24);
|
||||
}
|
||||
else
|
||||
sec->extra_colormap->fadergba = 0x19000000; // default alpha, (25 << 24)
|
||||
#undef ALPHA2INT
|
||||
#undef HEX2INT
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1557,12 +1492,10 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
sd->toptexture = 0;
|
||||
else
|
||||
sd->toptexture = num;
|
||||
|
||||
if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1)
|
||||
sd->midtexture = 0;
|
||||
else
|
||||
sd->midtexture = num;
|
||||
|
||||
if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1)
|
||||
sd->bottomtexture = 0;
|
||||
else
|
||||
|
@ -1570,7 +1503,6 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case 413: // Change music
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue