mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 22:22:10 +08:00
engine: directly access background state cvar
This commit is contained in:
@@ -1213,7 +1213,7 @@ void CL_StopPlayback( void )
|
||||
else
|
||||
{
|
||||
// let game known about demo state
|
||||
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
Cvar_DirectFullSet( &cl_background, "0", FCVAR_READ_ONLY );
|
||||
cls.state = ca_disconnected;
|
||||
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
|
||||
cls.set_lastdemo = false;
|
||||
|
||||
@@ -3958,7 +3958,7 @@ void CL_UnloadProgs( void )
|
||||
if( GI->internal_vgui_support )
|
||||
VGui_Shutdown();
|
||||
|
||||
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
Cvar_DirectFullSet( &cl_background, "0", FCVAR_READ_ONLY );
|
||||
Cvar_FullSet( "host_clientloaded", "0", FCVAR_READ_ONLY );
|
||||
|
||||
Cvar_Unlink( FCVAR_CLIENTDLL );
|
||||
|
||||
@@ -1548,7 +1548,7 @@ void CL_ClearState( void )
|
||||
memset( &clgame.fade, 0, sizeof( clgame.fade ));
|
||||
memset( &clgame.shake, 0, sizeof( clgame.shake ));
|
||||
clgame.mapname[0] = '\0';
|
||||
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
Cvar_DirectFullSet( &cl_background, "0", FCVAR_READ_ONLY );
|
||||
cl.maxclients = 1; // allow to drawing player in menu
|
||||
cl.mtime[0] = cl.mtime[1] = 1.0f; // because level starts from 1.0f second
|
||||
cls.signon = 0;
|
||||
@@ -3419,7 +3419,6 @@ static void CL_InitLocal( void )
|
||||
Cvar_RegisterVariable( &hud_fontrender );
|
||||
Cvar_RegisterVariable( &hud_scale );
|
||||
Cvar_RegisterVariable( &hud_scale_minimal_width );
|
||||
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||
Cvar_RegisterVariable( &cl_showevents );
|
||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||
Cvar_RegisterVariable( &ui_renderworld );
|
||||
|
||||
@@ -938,9 +938,8 @@ void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto )
|
||||
cl.background = true;
|
||||
else cl.background = background;
|
||||
|
||||
if( cl.background ) // tell the game parts about background state
|
||||
Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY );
|
||||
else Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
// tell the game parts about background state
|
||||
Cvar_DirectFullSet( &cl_background, cl.background ? "1" : "0", FCVAR_READ_ONLY );
|
||||
|
||||
if( !cls.changelevel )
|
||||
{
|
||||
|
||||
@@ -239,9 +239,8 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
}
|
||||
else Cvar_DirectSet( &r_decals, NULL );
|
||||
|
||||
if( cl.background ) // tell the game parts about background state
|
||||
Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY );
|
||||
else Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
// tell the game parts about background state
|
||||
Cvar_DirectFullSet( &cl_background, cl.background ? "1" : "0", FCVAR_READ_ONLY );
|
||||
|
||||
S_StopBackgroundTrack ();
|
||||
|
||||
|
||||
+15
-5
@@ -154,6 +154,16 @@ static void Con_InvalidateFonts( void );
|
||||
static void Con_LoadHistory( con_history_t *self );
|
||||
static void Con_SaveHistory( con_history_t *self );
|
||||
|
||||
/*
|
||||
================
|
||||
Con_BackgroundMapActive
|
||||
================
|
||||
*/
|
||||
qboolean Con_BackgroundMapActive( void )
|
||||
{
|
||||
return sv_background.value != 0.0f || cl.background;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Con_Clear_f
|
||||
@@ -273,7 +283,7 @@ void Con_ToggleConsole_f( void )
|
||||
if( cls.key_dest == key_console )
|
||||
{
|
||||
// closing console
|
||||
if( cls.state != ca_active || Cvar_VariableInteger( "sv_background" ) || Cvar_VariableInteger( "cl_background" ))
|
||||
if( cls.state != ca_active || Con_BackgroundMapActive( ))
|
||||
{
|
||||
// not in game or in background mode - return to menu
|
||||
// UI_SetActiveMenu(true) reactivates menu without resetting history
|
||||
@@ -1799,7 +1809,7 @@ void Con_DrawDebug( void )
|
||||
timeStart = host.realtime;
|
||||
}
|
||||
|
||||
if( !host.allow_console || Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" ))
|
||||
if( !host.allow_console || Con_BackgroundMapActive( ))
|
||||
return;
|
||||
|
||||
if( con.draw_notify && !Con_Visible( ))
|
||||
@@ -1825,7 +1835,7 @@ static void Con_DrawNotify( void )
|
||||
|
||||
x = con.curFont->charWidths[' ']; // offset one space at left screen side
|
||||
|
||||
if( host.allow_console && ( !Cvar_VariableInteger( "cl_background" ) && !Cvar_VariableInteger( "sv_background" )))
|
||||
if( host.allow_console && !Con_BackgroundMapActive( ))
|
||||
{
|
||||
for( i = Q_max( 0, CON_LINES_COUNT - con.num_times ); i < CON_LINES_COUNT; i++ )
|
||||
{
|
||||
@@ -2015,7 +2025,7 @@ void Con_DrawConsole( void )
|
||||
{
|
||||
if( !cl_allow_levelshots.value && !cls.timedemo )
|
||||
{
|
||||
if( cls.key_dest != key_console && ( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )))
|
||||
if( cls.key_dest != key_console && Con_BackgroundMapActive( ))
|
||||
con.vislines = con.showlines = 0;
|
||||
else con.vislines = con.showlines = refState.height;
|
||||
}
|
||||
@@ -2046,7 +2056,7 @@ void Con_DrawConsole( void )
|
||||
break;
|
||||
case ca_active:
|
||||
case ca_cinematic:
|
||||
if( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" ))
|
||||
if( Con_BackgroundMapActive( ))
|
||||
{
|
||||
if( cls.key_dest == key_console )
|
||||
Con_DrawSolidConsole( refState.height );
|
||||
|
||||
@@ -169,6 +169,8 @@ extern convar_t cl_filterstuffcmd;
|
||||
extern convar_t rcon_password;
|
||||
extern convar_t hpk_custom_file;
|
||||
extern convar_t con_gamemaps;
|
||||
extern convar_t sv_background;
|
||||
extern convar_t cl_background;
|
||||
|
||||
#define Mod_AllowMaterials() ( host_allow_materials.value != 0.0f && !FBitSet( host.features, ENGINE_DISABLE_HDTEXTURES ))
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTER
|
||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||
CVAR_DEFINE_AUTO( host_allow_materials, "0", FCVAR_LATCH|FCVAR_ARCHIVE, "allow texture replacements from materials/ folder" );
|
||||
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||
CVAR_DEFINE_AUTO( cl_background, "0", FCVAR_READ_ONLY, "if set to 1, client running a background map" );
|
||||
CVAR_DEFINE_AUTO( sv_background, "0", FCVAR_READ_ONLY, "if set to 1, server running a background map" );
|
||||
|
||||
typedef struct feature_message_s
|
||||
{
|
||||
@@ -1226,6 +1228,8 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
Cvar_RegisterVariable( &sv_hibernate_when_empty );
|
||||
Cvar_RegisterVariable( &sv_hibernate_when_empty_include_bots );
|
||||
Cvar_RegisterVariable( &sv_hibernate_when_empty_sleep );
|
||||
Cvar_RegisterVariable( &sv_background );
|
||||
Cvar_RegisterVariable( &cl_background );
|
||||
|
||||
Cvar_Getf( "buildnum", FCVAR_READ_ONLY, "returns a current build number", "%i", Q_buildnum_compat());
|
||||
Cvar_Getf( "ver", FCVAR_READ_ONLY, "shows an engine version", "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat());
|
||||
|
||||
@@ -265,6 +265,12 @@ static void SV_MapBackground_f( void )
|
||||
{
|
||||
char mapname[MAX_QPATH];
|
||||
|
||||
if( Host_IsDedicated( ))
|
||||
{
|
||||
Con_Printf( S_ERROR "no background maps are allowed in dedicated mode" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "map_background <mapname>\n" );
|
||||
|
||||
+3
-11
@@ -1088,17 +1088,9 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
||||
svgame.globals->coop = coop.value;
|
||||
svgame.globals->maxClients = svs.maxclients;
|
||||
|
||||
if( sv.background )
|
||||
{
|
||||
// tell the game parts about background state
|
||||
Cvar_FullSet( "sv_background", "1", FCVAR_READ_ONLY );
|
||||
Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY );
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_FullSet( "sv_background", "0", FCVAR_READ_ONLY );
|
||||
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
}
|
||||
// tell the game parts about background state
|
||||
Cvar_DirectFullSet( &sv_background, sv.background ? "1" : "0", FCVAR_READ_ONLY );
|
||||
Cvar_DirectFullSet( &cl_background, sv.background ? "1" : "0", FCVAR_READ_ONLY );
|
||||
|
||||
// force normal player collisions for single player
|
||||
if( svs.maxclients == 1 ) Cvar_SetValue( "sv_clienttrace", 1 );
|
||||
|
||||
@@ -864,7 +864,6 @@ void SV_Init( void )
|
||||
|
||||
Cvar_Getf( "protocol", FCVAR_READ_ONLY, "displays server protocol version", "%i", PROTOCOL_VERSION );
|
||||
Cvar_Get( "suitvolume", "0.25", FCVAR_ARCHIVE, "HEV suit volume" );
|
||||
Cvar_Get( "sv_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||
Cvar_Get( "gamedir", GI->gamefolder, FCVAR_READ_ONLY, "game folder" );
|
||||
Cvar_Get( "sv_alltalk", "1", 0, "allow to talking for all players (legacy, unused)" );
|
||||
Cvar_Get( "sv_allow_PhysX", "1", FCVAR_ARCHIVE, "allow XashXT to usage PhysX engine" ); // XashXT cvar
|
||||
@@ -1111,7 +1110,7 @@ void SV_Shutdown( const char *finalmsg )
|
||||
}
|
||||
|
||||
// don't forget to reset sv_background state
|
||||
Cvar_FullSet( "sv_background", "0", FCVAR_READ_ONLY );
|
||||
Cvar_DirectFullSet( &sv_background, "0", FCVAR_READ_ONLY );
|
||||
|
||||
if( COM_CheckString( finalmsg ))
|
||||
Con_Printf( "%s", finalmsg );
|
||||
|
||||
Reference in New Issue
Block a user