Browse Source

engine: client: implement v_dark in engine, instead of making it ref-specific

pull/2/head
Alibek Omarov 2 years ago
parent
commit
cb3b16e2ec
  1. 39
      engine/client/cl_parse.c
  2. 28
      ref/gl/gl_rmisc.c

39
engine/client/cl_parse.c

@ -1543,6 +1543,42 @@ void CL_SendConsistencyInfo( sizebuf_t *msg ) @@ -1543,6 +1543,42 @@ void CL_SendConsistencyInfo( sizebuf_t *msg )
MSG_WriteOneBit( msg, 0 );
}
/*
==================
CL_StartDark
==================
*/
static void CL_StartDark( void )
{
if( Cvar_VariableValue( "v_dark" ))
{
screenfade_t *sf = &clgame.fade;
float fadetime = 5.0f;
client_textmessage_t *title;
title = CL_TextMessageGet( "GAMETITLE" );
if( Host_IsQuakeCompatible( ))
fadetime = 1.0f;
if( title )
{
// get settings from titles.txt
sf->fadeEnd = title->holdtime + title->fadeout;
sf->fadeReset = title->fadeout;
}
else sf->fadeEnd = sf->fadeReset = fadetime;
sf->fadeFlags = FFADE_IN;
sf->fader = sf->fadeg = sf->fadeb = 0;
sf->fadealpha = 255;
sf->fadeSpeed = (float)sf->fadealpha / sf->fadeReset;
sf->fadeReset += cl.time;
sf->fadeEnd += sf->fadeReset;
Cvar_SetValue( "v_dark", 0.0f );
}
}
/*
==================
CL_RegisterResources
@ -1592,6 +1628,9 @@ void CL_RegisterResources( sizebuf_t *msg ) @@ -1592,6 +1628,9 @@ void CL_RegisterResources( sizebuf_t *msg )
// tell rendering system we have a new set of models.
ref.dllFuncs.R_NewMap ();
// check if this map must start from dark screen
CL_StartDark ();
CL_SetupOverviewParams();
// release unused SpriteTextures

28
ref/gl/gl_rmisc.c

@ -124,34 +124,6 @@ void R_NewMap( void ) @@ -124,34 +124,6 @@ void R_NewMap( void )
R_ParseDetailTextures( filepath );
}
if( gEngfuncs.pfnGetCvarFloat( "v_dark" ))
{
screenfade_t *sf = gEngfuncs.GetScreenFade();
float fadetime = 5.0f;
client_textmessage_t *title;
title = gEngfuncs.pfnTextMessageGet( "GAMETITLE" );
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
fadetime = 1.0f;
if( title )
{
// get settings from titles.txt
sf->fadeEnd = title->holdtime + title->fadeout;
sf->fadeReset = title->fadeout;
}
else sf->fadeEnd = sf->fadeReset = fadetime;
sf->fadeFlags = FFADE_IN;
sf->fader = sf->fadeg = sf->fadeb = 0;
sf->fadealpha = 255;
sf->fadeSpeed = (float)sf->fadealpha / sf->fadeReset;
sf->fadeReset += gpGlobals->time;
sf->fadeEnd += sf->fadeReset;
gEngfuncs.Cvar_SetValue( "v_dark", 0.0f );
}
// clear out efrags in case the level hasn't been reloaded
for( i = 0; i < WORLDMODEL->numleafs; i++ )
WORLDMODEL->leafs[i+1].efrags = NULL;

Loading…
Cancel
Save