mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Apply crosshair RGB values to 8-bit crosshair tile instead of nearest color in the palette if we're using Polymost
git-svn-id: https://svn.eduke32.com/eduke32@943 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
19ac7da999
commit
2a090515e2
3 changed files with 18 additions and 4 deletions
|
@ -2005,6 +2005,7 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
// tinting happens only to hightile textures, and only if the texture we're
|
// tinting happens only to hightile textures, and only if the texture we're
|
||||||
// rendering isn't for the same palette as what we asked for
|
// rendering isn't for the same palette as what we asked for
|
||||||
if (!(hictinting[globalpal].f&4))
|
if (!(hictinting[globalpal].f&4))
|
||||||
|
{
|
||||||
if (pth && (pth->flags & 2))
|
if (pth && (pth->flags & 2))
|
||||||
{
|
{
|
||||||
if (pth->palnum != globalpal)
|
if (pth->palnum != globalpal)
|
||||||
|
@ -2021,6 +2022,14 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// hack: this is for drawing the 8-bit crosshair recolored in polymost
|
||||||
|
else if (globalpal == (MAXPALOOKUPS>>1))
|
||||||
|
{
|
||||||
|
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||||
|
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
||||||
|
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bglColor4f(pc[0],pc[1],pc[2],pc[3]);
|
bglColor4f(pc[0],pc[1],pc[2],pc[3]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3368,6 +3368,7 @@ static void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
|
||||||
extern int getclosestcol(int r, int g, int b);
|
extern int getclosestcol(int r, int g, int b);
|
||||||
palette_t crosshair_colors = { 255, 255, 255, 0 };
|
palette_t crosshair_colors = { 255, 255, 255, 0 };
|
||||||
palette_t default_crosshair_colors = { 0, 0, 0, 0 };
|
palette_t default_crosshair_colors = { 0, 0, 0, 0 };
|
||||||
|
int crosshair_sum;
|
||||||
|
|
||||||
void GetCrosshairColor(void)
|
void GetCrosshairColor(void)
|
||||||
{
|
{
|
||||||
|
@ -3408,10 +3409,9 @@ void SetCrosshairColor(int r, int g, int b)
|
||||||
{
|
{
|
||||||
char *ptr = (char *)waloff[CROSSHAIR];
|
char *ptr = (char *)waloff[CROSSHAIR];
|
||||||
int i, ii;
|
int i, ii;
|
||||||
static int sum;
|
|
||||||
|
|
||||||
if (default_crosshair_colors.f == 0 || sum == r+(g<<1)+(b<<2)) return;
|
if (default_crosshair_colors.f == 0 || crosshair_sum == r+(g<<1)+(b<<2)) return;
|
||||||
sum = r+(g<<1)+(b<<2);
|
crosshair_sum = r+(g<<1)+(b<<2);
|
||||||
crosshair_colors.r = r;
|
crosshair_colors.r = r;
|
||||||
crosshair_colors.g = g;
|
crosshair_colors.g = g;
|
||||||
crosshair_colors.b = b;
|
crosshair_colors.b = b;
|
||||||
|
@ -3422,7 +3422,10 @@ void SetCrosshairColor(int r, int g, int b)
|
||||||
ptr = (char *)waloff[CROSSHAIR];
|
ptr = (char *)waloff[CROSSHAIR];
|
||||||
}
|
}
|
||||||
|
|
||||||
i = getclosestcol(crosshair_colors.r>>2, crosshair_colors.g>>2, crosshair_colors.b>>2);
|
if (getrendermode() < 3)
|
||||||
|
i = getclosestcol(crosshair_colors.r>>2, crosshair_colors.g>>2, crosshair_colors.b>>2);
|
||||||
|
else i = getclosestcol(63, 63, 63); // use white in GL so we can tint it to the right color
|
||||||
|
|
||||||
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
|
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
|
||||||
while (ii > 0)
|
while (ii > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -874,6 +874,7 @@ static int osdcmd_give(const osdfuncparm_t *parm)
|
||||||
void onvideomodechange(int newmode)
|
void onvideomodechange(int newmode)
|
||||||
{
|
{
|
||||||
char *pal;
|
char *pal;
|
||||||
|
extern int crosshair_sum;
|
||||||
|
|
||||||
if (newmode)
|
if (newmode)
|
||||||
{
|
{
|
||||||
|
@ -895,6 +896,7 @@ void onvideomodechange(int newmode)
|
||||||
|
|
||||||
setbrightness(ud.brightness>>2, pal, 0);
|
setbrightness(ud.brightness>>2, pal, 0);
|
||||||
restorepalette = 1;
|
restorepalette = 1;
|
||||||
|
crosshair_sum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int osdcmd_usemousejoy(const osdfuncparm_t *parm)
|
static int osdcmd_usemousejoy(const osdfuncparm_t *parm)
|
||||||
|
|
Loading…
Reference in a new issue