void WarpPalette (void) { int i,j; byte newpalette[768]; int basecolor[3]; basecolor[0] = 130; basecolor[1] = 80; basecolor[2] = 50; // pull the colors halfway to bright brown for (i=0 ; i<256 ; i++) { for (j=0 ; j<3 ; j++) { newpalette[i*3+j] = (host_basepal[i*3+j] + basecolor[j])/2; } } VID_ShiftPalette (newpalette); }
void V_UpdatePalette(void) { int i, j; qboolean newobj; byte *basepal; #ifdef __LIBRETRO__ unsigned short *pal_data; #else byte pal[768]; byte *newpal; #endif int r, g, b; qboolean force; V_CalcPowerupCshift(); newobj = false; for (i = 0; i < NUM_CSHIFTS; i++) { if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) { newobj = true; cl.prev_cshifts[i].percent = cl.cshifts[i].percent; } for (j = 0; j < 3; j++) if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j]) { newobj = true; cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j]; } } // drop the damage value cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150; if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0) cl.cshifts[CSHIFT_DAMAGE].percent = 0; // drop the bonus value cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100; if (cl.cshifts[CSHIFT_BONUS].percent <= 0) cl.cshifts[CSHIFT_BONUS].percent = 0; force = V_CheckGamma(); if (!newobj && !force) return; basepal = host_basepal; #ifdef __LIBRETRO__ pal_data = &palette_data[0]; #else newpal = pal; #endif for (i = 0; i < 256; i++) { r = basepal[0]; g = basepal[1]; b = basepal[2]; basepal += 3; for (j = 0; j < NUM_CSHIFTS; j++) { r += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[0] - r)) >> 8; g += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[1] - g)) >> 8; b += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[2] - b)) >> 8; } #ifdef __LIBRETRO__ *pal_data++ = PACK_RGB565(gammatable[r], gammatable[g], gammatable[b]); #else newpal[0] = r = gammatable[r]; newpal[1] = g = gammatable[g]; newpal[2] = b = gammatable[b]; newpal += 3; #endif } #ifndef __LIBRETRO__ VID_ShiftPalette(pal); #endif }
void V_UpdatePalette (void) { int i, j; qboolean new_ptr; byte *basepal, *newpal; byte pal[768]; int r,g,b; qboolean force; V_CalcPowerupCshift (); new_ptr = false; for (i=0 ; i<NUM_CSHIFTS ; i++) { if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) { new_ptr = true; cl.prev_cshifts[i].percent = cl.cshifts[i].percent; } for (j=0 ; j<3 ; j++) if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j]) { new_ptr = true; cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j]; } } // drop the damage value cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150; if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0) cl.cshifts[CSHIFT_DAMAGE].percent = 0; // drop the bonus value cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100; if (cl.cshifts[CSHIFT_BONUS].percent <= 0) cl.cshifts[CSHIFT_BONUS].percent = 0; force = V_CheckGamma (); if (!new_ptr && !force) return; basepal = host_basepal; newpal = pal; for (i=0 ; i<256 ; i++) { r = basepal[0]; g = basepal[1]; b = basepal[2]; basepal += 3; for (j=0 ; j<NUM_CSHIFTS ; j++) { r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8; g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8; b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8; } newpal[0] = gammatable[r]; newpal[1] = gammatable[g]; newpal[2] = gammatable[b]; newpal += 3; } VID_ShiftPalette (pal); }