diff --git a/src/r_data.c b/src/r_data.c index 529507e9a..949a842cc 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1819,8 +1819,17 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) // Pack rgba values into combined var // OpenGL also uses this instead of lighttables for rendering - rgba = cr + (cg << 8) + (cb << 16) + (ca << 24); - fadergba = cfr + (cfg << 8) + (cfb << 16) + (cfa << 24); + rgba = R_PutRgbaRGBA(cr, cg, cb, ca); + fadergba = R_PutRgbaRGBA(cfr, cfg, cfb, cfa); + + // Did we just make a default colormap? +#ifdef EXTRACOLORMAPLUMPS + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog, LUMPERROR)) + return NULL; +#else + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog)) + return NULL; +#endif // Did we just make a default colormap? #ifdef EXTRACOLORMAPLUMPS diff --git a/src/r_data.h b/src/r_data.h index ee497d155..d980e9c56 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -133,6 +133,13 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap); #define R_GetRgbaG(rgba) ((rgba >> 8) & 0xFF) #define R_GetRgbaB(rgba) ((rgba >> 16) & 0xFF) #define R_GetRgbaA(rgba) ((rgba >> 24) & 0xFF) +#define R_GetRgbaRGB(rgba) (rgba & 0xFFFFFF) +#define R_PutRgbaR(r) (r) +#define R_PutRgbaG(g) (g << 8) +#define R_PutRgbaB(b) (b << 16) +#define R_PutRgbaA(a) (a << 24) +#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b)) +#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a)) extern INT32 numtextures;