Use R_AddColormaps method in 447 relative calc
This commit is contained in:
parent
0fb594ad58
commit
54669a6cc8
87
src/p_spec.c
87
src/p_spec.c
|
@ -3258,79 +3258,20 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;)
|
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;)
|
||||||
{
|
{
|
||||||
if (line->flags & ML_EFFECT3) // relative calc
|
if (line->flags & ML_EFFECT3) // relative calc
|
||||||
{
|
sectors[secnum].extra_colormap = R_AddColormaps(
|
||||||
if (sectors[secnum].extra_colormap) // does nothing without an existing colormap
|
sectors[secnum].extra_colormap, line->frontsector->extra_colormap,
|
||||||
{
|
line->flags & ML_EFFECT1, // subtract R
|
||||||
extracolormap_t *target_colormap = R_CopyColormap(sectors[secnum].extra_colormap, false);
|
line->flags & ML_NOCLIMB, // subtract G
|
||||||
extracolormap_t *source_colormap = line->frontsector->extra_colormap ? line->frontsector->extra_colormap
|
line->flags & ML_EFFECT2, // subtract B
|
||||||
: R_GetDefaultColormap();
|
false, // subtract A (no flag for this, just pass negative alpha)
|
||||||
|
line->flags & ML_EFFECT1, // subtract FadeR
|
||||||
INT16 red, green, blue, alpha;
|
line->flags & ML_NOCLIMB, // subtract FadeG
|
||||||
|
line->flags & ML_EFFECT2, // subtract FadeB
|
||||||
// base rgba
|
false, // subtract FadeA (no flag for this, just pass negative alpha)
|
||||||
red = max(min(
|
line->flags & ML_DONTPEGBOTTOM,
|
||||||
R_GetRgbaR(target_colormap->rgba)
|
(line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].textureoffset >> FRACBITS) : 0,
|
||||||
+ ((line->flags & ML_EFFECT1) ? -1 : 1) // subtract R
|
(line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].rowoffset >> FRACBITS) : 0,
|
||||||
* R_GetRgbaR(source_colormap->rgba)
|
true);
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
green = max(min(
|
|
||||||
R_GetRgbaG(target_colormap->rgba)
|
|
||||||
+ ((line->flags & ML_NOCLIMB) ? -1 : 1) // subtract G
|
|
||||||
* R_GetRgbaG(source_colormap->rgba)
|
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
blue = max(min(
|
|
||||||
R_GetRgbaB(target_colormap->rgba)
|
|
||||||
+ ((line->flags & ML_EFFECT2) ? -1 : 1) // subtract B
|
|
||||||
* R_GetRgbaB(source_colormap->rgba)
|
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
alpha = (line->flags & ML_DONTPEGBOTTOM) ? // front (or back!) X offset; needed to subtract A
|
|
||||||
(sides[line->sidenum[line->sidenum[1] != 0xFFFF ? 1 : 0]].textureoffset >> FRACBITS)
|
|
||||||
: R_GetRgbaA(source_colormap->rgba);
|
|
||||||
alpha = max(min(R_GetRgbaA(target_colormap->rgba) + alpha, 25), 0);
|
|
||||||
|
|
||||||
target_colormap->rgba = R_PutRgbaRGBA(red, green, blue, alpha);
|
|
||||||
|
|
||||||
// fade rgba
|
|
||||||
red = max(min(
|
|
||||||
R_GetRgbaR(target_colormap->fadergba)
|
|
||||||
+ ((line->flags & ML_EFFECT1) ? -1 : 1) // subtract R
|
|
||||||
* R_GetRgbaR(source_colormap->fadergba)
|
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
green = max(min(
|
|
||||||
R_GetRgbaG(target_colormap->fadergba)
|
|
||||||
+ ((line->flags & ML_NOCLIMB) ? -1 : 1) // subtract G
|
|
||||||
* R_GetRgbaG(source_colormap->fadergba)
|
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
blue = max(min(
|
|
||||||
R_GetRgbaB(target_colormap->fadergba)
|
|
||||||
+ ((line->flags & ML_EFFECT2) ? -1 : 1) // subtract B
|
|
||||||
* R_GetRgbaB(source_colormap->fadergba)
|
|
||||||
, 255), 0);
|
|
||||||
|
|
||||||
alpha = (line->flags & ML_DONTPEGBOTTOM) ? // front (or back!) Y offset; needed to subtract A
|
|
||||||
(sides[line->sidenum[line->sidenum[1] != 0xFFFF ? 1 : 0]].rowoffset >> FRACBITS)
|
|
||||||
: R_GetRgbaA(source_colormap->fadergba);
|
|
||||||
if (alpha == 25)
|
|
||||||
alpha = 0; // HACK: fadergba A defaults at 25, so don't add anything in this case
|
|
||||||
alpha = max(min(R_GetRgbaA(target_colormap->fadergba) + alpha, 25), 0);
|
|
||||||
|
|
||||||
target_colormap->fadergba = R_PutRgbaRGBA(red, green, blue, alpha);
|
|
||||||
|
|
||||||
if (!(sectors[secnum].extra_colormap = R_GetColormapFromList(target_colormap)))
|
|
||||||
{
|
|
||||||
target_colormap->colormap = R_CreateLightTable(target_colormap);
|
|
||||||
R_AddColormapToList(target_colormap);
|
|
||||||
sectors[secnum].extra_colormap = target_colormap;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
memset(target_colormap, 0, sizeof(*target_colormap));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
sectors[secnum].extra_colormap = line->frontsector->extra_colormap;
|
sectors[secnum].extra_colormap = line->frontsector->extra_colormap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue