Ejemplo n.º 1
0
/*
=================
Host_Autosleep
=================
*/
void Host_Autosleep( void )
{
	int sleeptime = host_sleeptime->value;

	if( host.type == HOST_DEDICATED )
	{
		// let the dedicated server some sleep
		Sys_Sleep( sleeptime );

	}
	else
	{
		if( host.state == HOST_NOFOCUS )
		{
			if( Host_ServerState() && CL_IsInGame( ))
				Sys_Sleep( sleeptime ); // listenserver
			else Sys_Sleep( 20 ); // sleep 20 ms otherwise
		}
		else if( host.state == HOST_SLEEP )
		{
			// completely sleep in minimized state
			Sys_Sleep( 20 );
		}
		else
		{
			Sys_Sleep( sleeptime );
		}
	}
}
Ejemplo n.º 2
0
static int GL_RenderGetParm( int parm, int arg )
{
	gltexture_t *glt;

	switch( parm )
	{
	case PARM_TEX_WIDTH:
		glt = R_GetTexture( arg );
		return glt->width;
	case PARM_TEX_HEIGHT:
		glt = R_GetTexture( arg );
		return glt->height;
	case PARM_TEX_SRC_WIDTH:
		glt = R_GetTexture( arg );
		return glt->srcWidth;
	case PARM_TEX_SRC_HEIGHT:
		glt = R_GetTexture( arg );
		return glt->srcHeight;
	case PARM_TEX_SKYBOX:
		ASSERT( arg >= 0 && arg < 6 );
		return tr.skyboxTextures[arg];
	case PARM_TEX_SKYTEXNUM:
		return tr.skytexturenum;
	case PARM_TEX_LIGHTMAP:
		ASSERT( arg >= 0 && arg < MAX_LIGHTMAPS );
		return tr.lightmapTextures[arg];
	case PARM_SKY_SPHERE:
		return world.sky_sphere;
	case PARM_WORLD_VERSION:
		return world.version;
	case PARM_WIDESCREEN:
		return glState.wideScreen;
	case PARM_FULLSCREEN:
		return glState.fullScreen;
	case PARM_SCREEN_WIDTH:
		return glState.width;
	case PARM_SCREEN_HEIGHT:
		return glState.height;
	case PARM_MAP_HAS_MIRRORS:
		return world.has_mirrors;
	case PARM_CLIENT_INGAME:
		return CL_IsInGame();
	case PARM_MAX_ENTITIES:
		return clgame.maxEntities;
	case PARM_TEX_TARGET:
		glt = R_GetTexture( arg );
		return glt->target;
	case PARM_TEX_TEXNUM:
		glt = R_GetTexture( arg );
		return glt->texnum;
	case PARM_TEX_FLAGS:
		glt = R_GetTexture( arg );
		return glt->flags;
	case PARM_FEATURES:
		return host.features;
	}
	return 0;
}
Ejemplo n.º 3
0
/*
=================
SV_IsSimulating
=================
*/
qboolean SV_IsSimulating( void )
{
	if( sv.background && SV_Active() && CL_Active())
	{
		if( CL_IsInConsole( ))
			return false;
		return true; // force simulating for background map
	}

	if( sv.hostflags & SVF_PLAYERSONLY )
		return false;
	if( !SV_HasActivePlayers())
		return false;
	if( !sv.paused && CL_IsInGame( ))
		return true;
	return false;
}
Ejemplo n.º 4
0
/*
================
CL_AllocParticle

can return NULL if particles is out
================
*/
particle_t *CL_AllocParticle( void (*callback)( particle_t*, float ))
{
	particle_t	*p;

	if( !cl_draw_particles->integer )
		return NULL;

	// never alloc particles when we not in game
	if( !CL_IsInGame( )) return NULL;

	if( !cl_free_particles )
	{
		MsgDev( D_INFO, "Overflow %d particles\n", GI->max_particles );
		return NULL;
	}

	p = cl_free_particles;
	cl_free_particles = p->next;
	p->next = cl_active_particles;
	cl_active_particles = p;

	// clear old particle
	p->type = pt_static;
	VectorClear( p->vel );
	VectorClear( p->org );
	p->die = cl.time;
	p->ramp = 0;

	if( callback )
	{
		p->type = pt_clientcustom;
		p->callback = callback;
	}

	return p;
}
Ejemplo n.º 5
0
static int GL_RenderGetParm( int parm, int arg )
{
	gltexture_t *glt;

	switch( parm )
	{
	case PARM_TEX_WIDTH:
		glt = R_GetTexture( arg );
		return glt->width;
	case PARM_TEX_HEIGHT:
		glt = R_GetTexture( arg );
		return glt->height;
	case PARM_TEX_SRC_WIDTH:
		glt = R_GetTexture( arg );
		return glt->srcWidth;
	case PARM_TEX_SRC_HEIGHT:
		glt = R_GetTexture( arg );
		return glt->srcHeight;
	case PARM_TEX_GLFORMAT:
		glt = R_GetTexture( arg );
		return glt->format;
	case PARM_TEX_ENCODE:
		glt = R_GetTexture( arg );
		return glt->encode;
	case PARM_TEX_SKYBOX:
		ASSERT( arg >= 0 && arg < 6 );
		return tr.skyboxTextures[arg];
	case PARM_TEX_SKYTEXNUM:
		return tr.skytexturenum;
	case PARM_TEX_LIGHTMAP:
		ASSERT( arg >= 0 && arg < MAX_LIGHTMAPS );
		return tr.lightmapTextures[arg];
	case PARM_SKY_SPHERE:
		return world.sky_sphere;
	case PARM_WORLD_VERSION:
		if( cls.state != ca_active )
			return bmodel_version;
		return world.version;
	case PARM_WIDESCREEN:
		return glState.wideScreen;
	case PARM_FULLSCREEN:
		return glState.fullScreen;
	case PARM_SCREEN_WIDTH:
		return glState.width;
	case PARM_SCREEN_HEIGHT:
		return glState.height;
	case PARM_MAP_HAS_MIRRORS:
		return world.has_mirrors;
	case PARM_CLIENT_INGAME:
		return CL_IsInGame();
	case PARM_MAX_ENTITIES:
		return clgame.maxEntities;
	case PARM_TEX_TARGET:
		glt = R_GetTexture( arg );
		return glt->target;
	case PARM_TEX_TEXNUM:
		glt = R_GetTexture( arg );
		return glt->texnum;
	case PARM_TEX_FLAGS:
		glt = R_GetTexture( arg );
		return glt->flags;
	case PARM_FEATURES:
		return host.features;
	case PARM_ACTIVE_TMU:
		return glState.activeTMU;
	case PARM_TEX_CACHEFRAME:
		glt = R_GetTexture( arg );
		return glt->cacheframe;
	case PARM_MAP_HAS_DELUXE:
		return (world.deluxedata != NULL);
	case PARM_TEX_TYPE:
		glt = R_GetTexture( arg );
		return glt->texType;
	case PARM_CACHEFRAME:
		return world.load_sequence;
	case PARM_MAX_IMAGE_UNITS:
		return GL_MaxTextureUnits();
	case PARM_CLIENT_ACTIVE:
		return (cls.state == ca_active);
	case PARM_REBUILD_GAMMA:
		return glConfig.softwareGammaUpdate;
	}
	return 0;
}