Create a new struct for hictinting that uses a uint16_t for flags.r

git-svn-id: https://svn.eduke32.com/eduke32@6215 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-21 13:46:44 +00:00
parent 84c913d04c
commit 70245fc4f1
8 changed files with 41 additions and 26 deletions

View file

@ -1276,8 +1276,8 @@ extern int32_t glrendmode;
#endif
void hicinit(void);
// effect bitset: 1 = greyscale, 2 = invert
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect);
typedef uint16_t polytintflags_t;
void hicsetpalettetint(int32_t palnum, char r, char g, char b, polytintflags_t effect);
// flags bitset: 1 = don't compress
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut,
float xscale, float yscale, float specpower, float specfactor, char flags);

View file

@ -18,7 +18,12 @@ typedef struct hicreplc_t {
char palnum, flags;
} hicreplctyp;
extern palette_t hictinting[MAXPALOOKUPS];
typedef struct {
polytintflags_t f;
uint8_t r, g, b;
} polytint_t;
extern polytint_t hictinting[MAXPALOOKUPS];
extern hicreplctyp *hicreplc[MAXTILES];
extern int32_t hicinitcounter;

View file

@ -224,9 +224,9 @@ typedef struct pthtyp_t
int16_t picnum;
uint16_t flags; // see pthtyp_flags
polytintflags_t effects;
char palnum;
char shade;
char effects;
char skyface;
} pthtyp;
@ -240,7 +240,7 @@ EDUKE32_STATIC_ASSERT(TO_PTH_NOTRANSFIX(DAMETH_TRANS1) == 0);
EDUKE32_STATIC_ASSERT(TO_PTH_NOTRANSFIX(DAMETH_MASKPROPS) == 0);
extern void gloadtile_art(int32_t,int32_t,int32_t,int32_t,int32_t,pthtyp *,int32_t);
extern int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t,char);
extern int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t,polytintflags_t);
extern int32_t globalnoeffect;
extern int32_t drawingskybox;

View file

@ -13,7 +13,7 @@
#include "baselayer.h"
palette_t hictinting[MAXPALOOKUPS];
polytint_t hictinting[MAXPALOOKUPS];
hicreplctyp *hicreplc[MAXTILES];
int32_t hicinitcounter = 0;
@ -118,7 +118,7 @@ void hicinit(void)
// palette shifts on true-colour textures and only true-colour textures.
// effect bitset: 1 = greyscale, 2 = invert
//
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect)
void hicsetpalettetint(int32_t palnum, char r, char g, char b, polytintflags_t effect)
{
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return;
if (!hicinitcounter) hicinit();
@ -282,7 +282,7 @@ int32_t hicclearsubst(int32_t picnum, int32_t palnum)
#include "compat.h"
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect)
void hicsetpalettetint(int32_t palnum, char r, char g, char b, polytintflags_t effect)
{
UNREFERENCED_PARAMETER(palnum);
UNREFERENCED_PARAMETER(r);

View file

@ -719,7 +719,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
}
else
{
char const effect = hicfxmask(pal);
polytintflags_t const effect = hicfxmask(pal);
// CODEDUP: gloadtile_hi

View file

@ -1100,10 +1100,11 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
if (!fullbrightloadingpass && tintpalnum >= 0)
{
uint8_t const r = hictinting[tintpalnum].r;
uint8_t const g = hictinting[tintpalnum].g;
uint8_t const b = hictinting[tintpalnum].b;
uint8_t const effect = hictinting[tintpalnum].f;
polytint_t const & tint = hictinting[tintpalnum];
polytintflags_t const effect = tint.f;
uint8_t const r = tint.r;
uint8_t const g = tint.g;
uint8_t const b = tint.b;
if (effect & HICTINT_GRAYSCALE)
{
@ -1221,7 +1222,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
}
int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr,
int32_t dameth, pthtyp *pth, int32_t doalloc, char effect)
int32_t dameth, pthtyp *pth, int32_t doalloc, polytintflags_t effect)
{
if (!hicr) return -1;

View file

@ -8878,7 +8878,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
static int32_t osdcmd_tint(const osdfuncparm_t *parm)
{
int32_t i;
palette_t *p;
polytint_t *p;
if (parm->numparms==1)
{
@ -8891,10 +8891,9 @@ static int32_t osdcmd_tint(const osdfuncparm_t *parm)
}
else if (parm->numparms==0)
{
palette_t notint = { 0xFF, 0xFF, 0xFF, 0x00 };
OSD_Printf("Hightile tintings:\n");
for (i=0,p=&hictinting[0]; i<=M32_MAXPALOOKUPS; i++,p++)
if (Bmemcmp(&hictinting[i], &notint, 4))
if (p->r != 255 || p->g != 255 || p->b != 255 || p->f != 0)
OSD_Printf("pal %d: rgb %3d %3d %3d f %d\n", i, p->r, p->g, p->b, p->f);
}
else if (parm->numparms>=2)

View file

@ -167,8 +167,11 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
#ifdef USE_OPENGL
// XXX: this makes us also load all hightile textures tinted with the crosshair color!
Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t));
hictinting[CROSSHAIR_PAL].f = HICTINT_USEONART | HICTINT_GRAYSCALE;
polytint_t & crosshairtint = hictinting[CROSSHAIR_PAL];
crosshairtint.r = CrosshairColors.r;
crosshairtint.g = CrosshairColors.g;
crosshairtint.b = CrosshairColors.b;
crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE;
#endif
invalidatetile(CROSSHAIR, -1, -1);
}
@ -856,21 +859,28 @@ void G_DisplayRest(int32_t smoothratio)
// this takes care of fullscreen tint for OpenGL
if (getrendermode() >= REND_POLYMOST)
{
polytint_t & fstint = hictinting[MAXPALOOKUPS-1];
if (pp->palette == WATERPAL)
{
static const palette_t wp = { 224, 192, 255, 0 };
Bmemcpy(&hictinting[MAXPALOOKUPS-1], &wp, sizeof(palette_t));
fstint.r = 224;
fstint.g = 192;
fstint.b = 255;
fstint.f = 0;
}
else if (pp->palette == SLIMEPAL)
{
static const palette_t sp = { 208, 255, 192, 0 };
Bmemcpy(&hictinting[MAXPALOOKUPS-1], &sp, sizeof(palette_t));
fstint.r = 208;
fstint.g = 255;
fstint.b = 192;
fstint.f = 0;
}
else
{
hictinting[MAXPALOOKUPS-1].r = 255;
hictinting[MAXPALOOKUPS-1].g = 255;
hictinting[MAXPALOOKUPS-1].b = 255;
fstint.r = 255;
fstint.g = 255;
fstint.b = 255;
fstint.f = 0;
}
}
#endif // USE_OPENGL