diff --git a/source/build/include/build.h b/source/build/include/build.h index bdd437a53..fb04849d7 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -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); diff --git a/source/build/include/hightile.h b/source/build/include/hightile.h index 1375062f5..71fcfa260 100644 --- a/source/build/include/hightile.h +++ b/source/build/include/hightile.h @@ -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; diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index f692bf796..661ad2675 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -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; diff --git a/source/build/src/hightile.cpp b/source/build/src/hightile.cpp index 49f014140..cad3688ca 100644 --- a/source/build/src/hightile.cpp +++ b/source/build/src/hightile.cpp @@ -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); diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 54bee9970..631d708ce 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -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 diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 9686083d7..827a6c057 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -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; diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 9a6c46e0b..8b5c861fe 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -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], ¬int, 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) diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 6b8f46edc..7919bf620 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -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