mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-30 22:50:51 +00:00
Merge branch 'colormap-overhaul' into colormap-overhaul-fade
This commit is contained in:
commit
947f1162e0
2 changed files with 34 additions and 2 deletions
35
src/r_data.c
35
src/r_data.c
|
@ -1901,6 +1901,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
|||
extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend,
|
||||
boolean subR, boolean subG, boolean subB, boolean subA,
|
||||
boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA,
|
||||
boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog,
|
||||
boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha,
|
||||
boolean lighttable)
|
||||
{
|
||||
|
@ -1917,7 +1918,10 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex
|
|||
|
||||
INT16 red, green, blue, alpha;
|
||||
|
||||
///////////////////
|
||||
// base rgba
|
||||
///////////////////
|
||||
|
||||
red = max(min(
|
||||
R_GetRgbaR(exc_augend->rgba)
|
||||
+ (subR ? -1 : 1) // subtract R
|
||||
|
@ -1941,7 +1945,10 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex
|
|||
|
||||
exc_augend->rgba = R_PutRgbaRGBA(red, green, blue, alpha);
|
||||
|
||||
// fade rgba
|
||||
///////////////////
|
||||
// fade/dark rgba
|
||||
///////////////////
|
||||
|
||||
red = max(min(
|
||||
R_GetRgbaR(exc_augend->fadergba)
|
||||
+ (subFadeR ? -1 : 1) // subtract R
|
||||
|
@ -1961,12 +1968,36 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex
|
|||
, 255), 0);
|
||||
|
||||
alpha = useAltAlpha ? altFadeAlpha : R_GetRgbaA(exc_addend->fadergba);
|
||||
if (alpha == 25)
|
||||
if (alpha == 25 && !useAltAlpha && !R_GetRgbaRGB(exc_addend->fadergba))
|
||||
alpha = 0; // HACK: fadergba A defaults at 25, so don't add anything in this case
|
||||
alpha = max(min(R_GetRgbaA(exc_augend->fadergba) + (subFadeA ? -1 : 1) * alpha, 25), 0);
|
||||
|
||||
exc_augend->fadergba = R_PutRgbaRGBA(red, green, blue, alpha);
|
||||
|
||||
///////////////////
|
||||
// parameters
|
||||
///////////////////
|
||||
|
||||
exc_augend->fadestart = max(min(
|
||||
exc_augend->fadestart
|
||||
+ (subFadeStart ? -1 : 1) // subtract fadestart
|
||||
* exc_addend->fadestart
|
||||
, 31), 0);
|
||||
|
||||
exc_augend->fadeend = max(min(
|
||||
exc_augend->fadeend
|
||||
+ (subFadeEnd ? -1 : 1) // subtract fadeend
|
||||
* (exc_addend->fadeend == 31 && !exc_addend->fadestart ? 0 : exc_addend->fadeend)
|
||||
// HACK: fadeend defaults to 31, so don't add anything in this case
|
||||
, 31), 0);
|
||||
|
||||
if (!ignoreFog) // overwrite fog with new value
|
||||
exc_augend->fog = exc_addend->fog;
|
||||
|
||||
///////////////////
|
||||
// put it together
|
||||
///////////////////
|
||||
|
||||
if (!(exc = R_GetColormapFromList(exc_augend)))
|
||||
{
|
||||
exc_augend->colormap = lighttable ? R_CreateLightTable(exc_augend) : NULL;
|
||||
|
|
|
@ -128,6 +128,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3);
|
|||
extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend,
|
||||
boolean subR, boolean subG, boolean subB, boolean subA,
|
||||
boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA,
|
||||
boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog,
|
||||
boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha,
|
||||
boolean lighttable);
|
||||
#ifdef EXTRACOLORMAPLUMPS
|
||||
|
|
Loading…
Reference in a new issue