void V_UpdatePalette(void) { int i; qboolean force; V_CalcPowerupCshift(); /* 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 (force) { for (i = 0; i < 256; i++) { ramps[0][i] = gammatable[i] << 8; ramps[1][i] = gammatable[i] << 8; ramps[2][i] = gammatable[i] << 8; } #ifndef __LIBRETRO__ if (VID_IsFullScreen() && VID_SetGammaRamp) VID_SetGammaRamp(ramps); //VID_ShiftPalette(NULL); #endif } }
//----------------------------------------------------------------------------- // Purpose: This is called every frame, and can also be called explicitly to flush // text to the screen. //----------------------------------------------------------------------------- void SCR_UpdateScreen (void) { // Always force the Gamma Table to be rebuilt. Otherwise, // we'll load textures with an all white gamma lookup table. V_CheckGamma(); if (scr_skipupdate) return; if ( scr_disabled_for_loading ) { if ( realtime - scr_disabled_time <= 60 ) return; scr_disabled_for_loading = false; Con_Printf( "Connecting may have failed.\n" ); } // No screen refresh on dedicated servers if ( cls.state == ca_dedicated ) return; if (!scr_initialized || !con_initialized) return; // not initialized yet // Let demo system overwrite view origin/angles during playback demo->GetInterpolatedViewpoint(); // Simulation meant to occur before any views are rendered ClientDLL_FrameStageNotify( FRAME_RENDER_START ); { Shader_BeginRendering (); // // determine size of refresh window // if ( vid.recalc_refdef ) { SCR_CalcRefdef (); } // Draw world, etc. V_RenderView(); CL_TakeSnapshotAndSwap(); } ClientDLL_FrameStageNotify( FRAME_RENDER_END ); }
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); }
void V_UpdatePalette (void) { int i, j; qboolean new_ptr; byte *basepal, *newpal; byte pal[768]; float r,g,b,a; int ir, ig, ib; 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; V_CalcBlend (); a = v_blend[3]; r = 255*v_blend[0]*a; g = 255*v_blend[1]*a; b = 255*v_blend[2]*a; a = 1-a; for (i=0 ; i<256 ; i++) { ir = i*a + r; ig = i*a + g; ib = i*a + b; if (ir > 255) ir = 255; if (ig > 255) ig = 255; if (ib > 255) ib = 255; ramps[0][i] = gammatable[ir]; ramps[1][i] = gammatable[ig]; ramps[2][i] = gammatable[ib]; } basepal = host_basepal; newpal = pal; for (i=0 ; i<256 ; i++) { ir = basepal[0]; ig = basepal[1]; ib = basepal[2]; basepal += 3; newpal[0] = ramps[0][ir]; newpal[1] = ramps[1][ig]; newpal[2] = ramps[2][ib]; newpal += 3; } render.ShiftPalette (pal); }