From 548f02eea14ab963fa2e4519740c927bef2ae3f5 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Tue, 11 Sep 2018 17:30:43 -0400 Subject: [PATCH] Extra macros R_GetRgbaRGB; R_PutRgbaR/G/B/A/RGB/RGBA --- src/r_data.c | 4 ++-- src/r_data.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index 529507e9a..e0899e4cf 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1819,8 +1819,8 @@ 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 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;