mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Palette stuff... hijack hictinting[MAXPALOOKUPS-1] for use as a tint control on all hightile assets. This way, NVG and underwater tinting in Polymost doesn't interfere with the ps[].pals tinting that palfrom sets in the CONs.
git-svn-id: https://svn.eduke32.com/eduke32@384 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9fc9365e2f
commit
ccb93c19d8
6 changed files with 65 additions and 16 deletions
|
@ -1390,6 +1390,13 @@ static int md3draw (md3model *m, spritetype *tspr)
|
|||
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
||||
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
||||
if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255)
|
||||
{
|
||||
pc[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0;
|
||||
pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0;
|
||||
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
||||
}
|
||||
|
||||
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0;
|
||||
if (m->usesalpha) //Sprites with alpha in texture
|
||||
{
|
||||
|
@ -2477,7 +2484,7 @@ mdmodel *mdload (const char *filnam)
|
|||
switch (B_LITTLE32(i))
|
||||
{
|
||||
case 0x32504449:
|
||||
initprintf("Warning: model '%s' is version IDP2; wanted version IDP3\n",filnam);
|
||||
// initprintf("Warning: model '%s' is version IDP2; wanted version IDP3\n",filnam);
|
||||
vm = (mdmodel*)md2load(fil,filnam); break; //IDP2
|
||||
case 0x33504449:
|
||||
vm = (mdmodel*)md3load(fil); break; //IDP3
|
||||
|
|
|
@ -1508,12 +1508,23 @@ void drawpoly (double *dpx, double *dpy, long n, long method)
|
|||
}
|
||||
// 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
|
||||
if (pth && (pth->flags & 2) && (pth->palnum != globalpal)) {
|
||||
// apply tinting for replaced textures
|
||||
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
||||
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
||||
if (pth && (pth->flags & 2))
|
||||
{
|
||||
if (pth->palnum != globalpal)
|
||||
{
|
||||
// apply tinting for replaced textures
|
||||
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
||||
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
||||
}
|
||||
if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255)
|
||||
{
|
||||
pc[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0;
|
||||
pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0;
|
||||
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
||||
}
|
||||
}
|
||||
|
||||
bglColor4f(pc[0],pc[1],pc[2],pc[3]);
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ void playanm(char *fn,char t)
|
|||
char *animbuf;
|
||||
unsigned char *palptr;
|
||||
long i, j, length=0, numframes=0;
|
||||
|
||||
int32 handle=-1;
|
||||
|
||||
// return;
|
||||
|
@ -242,14 +243,14 @@ void playanm(char *fn,char t)
|
|||
tempbuf[j+3] = 0;
|
||||
*/
|
||||
j = i*3;
|
||||
tempbuf[j+0] = (palptr[j+0]>>2);
|
||||
tempbuf[j+1] = (palptr[j+1]>>2);
|
||||
tempbuf[j+2] = (palptr[j+2]>>2);
|
||||
animpal[j+0] = (palptr[j+0]>>2);
|
||||
animpal[j+1] = (palptr[j+1]>>2);
|
||||
animpal[j+2] = (palptr[j+2]>>2);
|
||||
}
|
||||
|
||||
//setpalette(0L,256L,tempbuf);
|
||||
//setbrightness(ud.brightness>>2,tempbuf,2);
|
||||
setgamepalette(&ps[myconnectindex],tempbuf,2);
|
||||
setgamepalette(&ps[myconnectindex],animpal,2);
|
||||
|
||||
ototalclock = totalclock + 10;
|
||||
|
||||
|
@ -263,7 +264,7 @@ void playanm(char *fn,char t)
|
|||
handleevents();
|
||||
getpackets();
|
||||
if (restorepalette == 1)
|
||||
setgamepalette(&ps[myconnectindex],tempbuf,2);
|
||||
setgamepalette(&ps[myconnectindex],animpal,2);
|
||||
}
|
||||
|
||||
if (t == 10) ototalclock += 14;
|
||||
|
|
|
@ -572,7 +572,7 @@ extern char restorepalette;
|
|||
|
||||
extern short buttonstat;
|
||||
extern long cachecount;
|
||||
extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768];
|
||||
extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768];
|
||||
extern char cachedebug,earthquaketime;
|
||||
extern char networkmode;
|
||||
extern char lumplockbyte[11];
|
||||
|
|
|
@ -70,7 +70,7 @@ static struct strllist
|
|||
*CommandPaths = NULL, *CommandGrps = NULL;
|
||||
|
||||
char confilename[BMAX_PATH] = {"EDUKE.CON"}, boardfilename[BMAX_PATH] = {0};
|
||||
char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768];
|
||||
char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768];
|
||||
char firstdemofile[80] = { '\0' };
|
||||
int display_bonus_screen = 1, userconfiles = 0;
|
||||
|
||||
|
@ -210,6 +210,7 @@ void setgamepalette(struct player_struct *player, char *pal, int set)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (getrendermode() < 3)
|
||||
{
|
||||
// 8-bit mode
|
||||
|
@ -227,8 +228,16 @@ void setgamepalette(struct player_struct *player, char *pal, int set)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (pal != titlepal && pal != drealms && pal != endingpal && pal != animpal)
|
||||
pal = palette;
|
||||
setbrightness(ud.brightness>>2, pal, set);
|
||||
}
|
||||
#else
|
||||
if (!(pal == palette || pal == waterpal || pal == slimepal || pal == drealms || pal == titlepal || pal == endingpal || pal == animpal))
|
||||
pal = palette;
|
||||
|
||||
setbrightness(ud.brightness>>2, pal, set);
|
||||
#endif
|
||||
player->palette = pal;
|
||||
}
|
||||
|
||||
|
@ -3205,13 +3214,20 @@ void displayrest(long smoothratio)
|
|||
|
||||
pp = &ps[screenpeek];
|
||||
|
||||
#if defined(USE_OPENGL) && defined(POLYMOST)
|
||||
// this takes care of fullscreen tint for OpenGL
|
||||
if (getrendermode() >= 3)
|
||||
{
|
||||
#if 0
|
||||
if (pp->palette == waterpal) tintr=0,tintg=0,tintb=63,tintf=8;
|
||||
else if (pp->palette == slimepal) tintr=20,tintg=63,tintb=20,tintf=8;
|
||||
#else
|
||||
if (pp->palette == waterpal) { hictinting[MAXPALOOKUPS-1].r = 192; hictinting[MAXPALOOKUPS-1].g = 192; hictinting[MAXPALOOKUPS-1].b = 255; }
|
||||
else if (pp->palette == slimepal) { hictinting[MAXPALOOKUPS-1].r = 208; hictinting[MAXPALOOKUPS-1].g = 255; hictinting[MAXPALOOKUPS-1].b = 224; }
|
||||
else { hictinting[MAXPALOOKUPS-1].r = 255; hictinting[MAXPALOOKUPS-1].g = 255; hictinting[MAXPALOOKUPS-1].b = 255; }
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
// this does pain tinting etc from the CON
|
||||
if (pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0
|
||||
{
|
||||
|
@ -8959,6 +8975,11 @@ void Logo(void)
|
|||
{
|
||||
handleevents();
|
||||
getpackets();
|
||||
if (restorepalette)
|
||||
{
|
||||
setgamepalette(&ps[myconnectindex],ps[myconnectindex].palette,0);
|
||||
restorepalette = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
KB_ClearKeysDown(); // JBF
|
||||
|
@ -9036,6 +9057,11 @@ void Logo(void)
|
|||
OnEvent(EVENT_LOGO, -1, screenpeek, -1);
|
||||
handleevents();
|
||||
getpackets();
|
||||
if (restorepalette)
|
||||
{
|
||||
setgamepalette(&ps[myconnectindex],ps[myconnectindex].palette,0);
|
||||
restorepalette = 0;
|
||||
}
|
||||
nextpage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -701,10 +701,14 @@ void onvideomodechange(int newmode)
|
|||
{
|
||||
if (ps[screenpeek].palette == palette ||
|
||||
ps[screenpeek].palette == waterpal ||
|
||||
ps[screenpeek].palette == titlepal ||
|
||||
ps[screenpeek].palette == animpal ||
|
||||
ps[screenpeek].palette == endingpal ||
|
||||
ps[screenpeek].palette == drealms ||
|
||||
ps[screenpeek].palette == slimepal)
|
||||
pal = palette;
|
||||
else
|
||||
pal = ps[screenpeek].palette;
|
||||
else
|
||||
pal = palette;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue