clear colorshifts on disconnect, don't decrease cshifts on gamma change, fix warning

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3009 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2008-06-12 23:19:47 +00:00
parent 01d05dc3b6
commit 0adc1e1054
9 changed files with 42 additions and 35 deletions

View File

@ -1187,7 +1187,10 @@ void CL_Disconnect (void)
#ifndef CLIENTONLY #ifndef CLIENTONLY
if (!isDedicated) if (!isDedicated)
#endif #endif
{
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
V_ClearCShifts();
}
cls.protocol = CP_UNKNOWN; cls.protocol = CP_UNKNOWN;
cl.servercount = 0; cl.servercount = 0;

View File

@ -829,7 +829,6 @@ void V_StartPitchDrift (int pnum);
void V_StopPitchDrift (int pnum); void V_StopPitchDrift (int pnum);
void V_RenderView (void); void V_RenderView (void);
void V_UpdatePalette (void);
void V_Register (void); void V_Register (void);
void V_ParseDamage (int pnum); void V_ParseDamage (int pnum);
void V_SetContentsColor (int contents); void V_SetContentsColor (int contents);

View File

@ -370,7 +370,7 @@ void SWV_Gamma_Callback(struct cvar_s *var, char *oldvalue)
{ {
BuildGammaTable (v_gamma.value, v_contrast.value); BuildGammaTable (v_gamma.value, v_contrast.value);
vid.recalc_refdef = 1; // force a surface cache flush vid.recalc_refdef = 1; // force a surface cache flush
SWV_UpdatePalette (true); SWV_UpdatePalette (true, 0);
} }
#endif #endif
@ -379,7 +379,7 @@ void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue)
{ {
BuildGammaTable (v_gamma.value, v_contrast.value); BuildGammaTable (v_gamma.value, v_contrast.value);
vid.recalc_refdef = 1; // force a surface cache flush vid.recalc_refdef = 1; // force a surface cache flush
GLV_UpdatePalette (true); GLV_UpdatePalette (true, 0);
} }
#endif #endif
@ -691,7 +691,7 @@ void GLV_CalcBlend (void)
V_UpdatePalette V_UpdatePalette
============= =============
*/ */
void GLV_UpdatePalette (qboolean force) void GLV_UpdatePalette (qboolean force, double ftime)
{ {
// qboolean ogw; // qboolean ogw;
int i, j; int i, j;
@ -705,16 +705,6 @@ void GLV_UpdatePalette (qboolean force)
V_CalcPowerupCshift (); 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;
update = false; update = false;
for (i=0 ; i<CSHIFT_SERVER ; i++) for (i=0 ; i<CSHIFT_SERVER ; i++)
@ -732,6 +722,16 @@ void GLV_UpdatePalette (qboolean force)
} }
} }
// drop the damage value
cl.cshifts[CSHIFT_DAMAGE].percent -= ftime*150;
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
// drop the bonus value
cl.cshifts[CSHIFT_BONUS].percent -= ftime*100;
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
cl.cshifts[CSHIFT_BONUS].percent = 0;
if (update || force) if (update || force)
{ {
GLV_CalcBlend (); GLV_CalcBlend ();
@ -776,7 +776,7 @@ V_UpdatePalette
============= =============
*/ */
#ifdef SWQUAKE #ifdef SWQUAKE
void SWV_UpdatePalette (qboolean force) void SWV_UpdatePalette (qboolean force, double ftime)
{ {
int i, j; int i, j;
qboolean update; qboolean update;
@ -806,12 +806,12 @@ void SWV_UpdatePalette (qboolean force)
} }
// drop the damage value // drop the damage value
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150; cl.cshifts[CSHIFT_DAMAGE].percent -= ftime*150;
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0) if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0; cl.cshifts[CSHIFT_DAMAGE].percent = 0;
// drop the bonus value // drop the bonus value
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100; cl.cshifts[CSHIFT_BONUS].percent -= ftime*100;
if (cl.cshifts[CSHIFT_BONUS].percent <= 0) if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
cl.cshifts[CSHIFT_BONUS].percent = 0; cl.cshifts[CSHIFT_BONUS].percent = 0;
@ -871,6 +871,14 @@ void SWV_UpdatePalette (qboolean force)
#endif // SWQUAKE #endif // SWQUAKE
void V_ClearCShifts (void)
{
int i;
for (i = 0; i < NUM_CSHIFTS; i++)
cl.cshifts[i].percent = 0;
}
/* /*
============================================================================== ==============================================================================

View File

@ -29,8 +29,9 @@ extern qboolean r_secondaryview;
void V_Init (void); void V_Init (void);
void V_RenderView (void); void V_RenderView (void);
float V_CalcRoll (vec3_t angles, vec3_t velocity); float V_CalcRoll (vec3_t angles, vec3_t velocity);
void GLV_UpdatePalette (qboolean force); void GLV_UpdatePalette (qboolean force, double ftime);
void SWV_UpdatePalette (qboolean force); void SWV_UpdatePalette (qboolean force, double ftime);
void V_ClearCShifts (void);
qboolean V_CheckGamma (void); qboolean V_CheckGamma (void);
void V_AddEntity(entity_t *in); void V_AddEntity(entity_t *in);
void V_AddLerpEntity(entity_t *in); void V_AddLerpEntity(entity_t *in);

View File

@ -958,7 +958,7 @@ void (D3D_SCR_UpdateScreen) (void)
if (editormodal) if (editormodal)
{ {
Editor_Draw(); Editor_Draw();
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -976,7 +976,7 @@ void (D3D_SCR_UpdateScreen) (void)
if (Media_ShowFilm()) if (Media_ShowFilm())
{ {
M_Draw(0); M_Draw(0);
// GLV_UpdatePalette (false); // GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) #if defined(_WIN32)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -1032,7 +1032,7 @@ void (D3D_SCR_UpdateScreen) (void)
SCR_DrawTwoDimensional(uimenu, nohud); SCR_DrawTwoDimensional(uimenu, nohud);
// GLV_UpdatePalette (false); // GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif

View File

@ -1228,7 +1228,7 @@ void (D3D9_SCR_UpdateScreen) (void)
if (editormodal) if (editormodal)
{ {
Editor_Draw(); Editor_Draw();
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -1246,7 +1246,7 @@ void (D3D9_SCR_UpdateScreen) (void)
if (Media_ShowFilm()) if (Media_ShowFilm())
{ {
M_Draw(0); M_Draw(0);
// GLV_UpdatePalette (false); // GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) #if defined(_WIN32)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -1301,7 +1301,7 @@ void (D3D9_SCR_UpdateScreen) (void)
SCR_DrawTwoDimensional(uimenu, nohud); SCR_DrawTwoDimensional(uimenu, nohud);
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif

View File

@ -186,7 +186,7 @@ void GLSCR_UpdateScreen (void)
if (editormodal) if (editormodal)
{ {
Editor_Draw(); Editor_Draw();
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -203,7 +203,7 @@ void GLSCR_UpdateScreen (void)
if (Media_ShowFilm()) if (Media_ShowFilm())
{ {
M_Draw(0); M_Draw(0);
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif
@ -254,7 +254,7 @@ void GLSCR_UpdateScreen (void)
SCR_DrawTwoDimensional(uimenu, nohud); SCR_DrawTwoDimensional(uimenu, nohud);
GLV_UpdatePalette (false); GLV_UpdatePalette (false, host_frametime);
#if defined(_WIN32) && defined(RGLQUAKE) #if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame(); Media_RecordFrame();
#endif #endif

View File

@ -2540,10 +2540,6 @@ void SV_UserCmdMVDList_f (void)
float f; float f;
int i,j,show; int i,j,show;
int first;
first = Cmd_Argv(0);
Con_Printf("available demos\n"); Con_Printf("available demos\n");
dir = Sys_listdir(va("%s/%s", com_gamedir,sv_demoDir.string), ".mvd", SORT_BY_DATE); dir = Sys_listdir(va("%s/%s", com_gamedir,sv_demoDir.string), ".mvd", SORT_BY_DATE);
list = dir->files; list = dir->files;

View File

@ -89,7 +89,7 @@ void SWSCR_UpdateScreen (void)
if (editormodal) if (editormodal)
{ {
Editor_Draw(); Editor_Draw();
SWV_UpdatePalette (false); SWV_UpdatePalette (false, host_frametime);
vrect.x = 0; vrect.x = 0;
vrect.y = 0; vrect.y = 0;
@ -103,7 +103,7 @@ void SWSCR_UpdateScreen (void)
#endif #endif
if (Media_ShowFilm()) if (Media_ShowFilm())
{ {
SWV_UpdatePalette (false); SWV_UpdatePalette (false, host_frametime);
vrect.x = 0; vrect.x = 0;
vrect.y = 0; vrect.y = 0;
@ -159,7 +159,7 @@ void SWSCR_UpdateScreen (void)
D_DisableBackBufferAccess (); // for adapters that can't stay mapped in D_DisableBackBufferAccess (); // for adapters that can't stay mapped in
// for linear writes all the time // for linear writes all the time
SWV_UpdatePalette (false); SWV_UpdatePalette (false, host_frametime);
// //
// update one of three areas // update one of three areas