Esempio n. 1
0
void SCR_SizeDown_f(void) {
	//JHL:HACK; changed to affect the HUD, not SCR size
	if (hud.getInt() > 0) {
		hud.set(hud.getFloat() - 1);
		vid.recalc_refdef = 1;
	}
	//qmb :hud
	//Cvar_SetValue ("viewsize",scr_viewsize.value-10);
	//vid.recalc_refdef = 1;
}
Esempio n. 2
0
void Host_FindMaxClients(void) {
    svs.maxclients = 1;

    int i = COM_CheckParm("-dedicated");
    if (i) {
        cls.state = ca_dedicated;
        if (i != (com_argc - 1)) {
            svs.maxclients = atoi(com_argv[i + 1]);
        } else
            svs.maxclients = 8;
    } else
        cls.state = ca_disconnected;

    //qmb :64 clients
    //various number changes including max_scoreboard
    i = COM_CheckParm("-listen");
    if (i) {
        if (cls.state == ca_dedicated)
            Sys_Error("Only one of -dedicated or -listen can be specified");
        if (i != (com_argc - 1))
            svs.maxclients = atoi(com_argv[i + 1]);
        else
            svs.maxclients = 32;
    }
    if (svs.maxclients < 1)
        svs.maxclients = 32;
    else if (svs.maxclients > MAX_SCOREBOARD)
        svs.maxclients = MAX_SCOREBOARD;

    svs.maxclientslimit = svs.maxclients;
    if (svs.maxclientslimit < 32)
        svs.maxclientslimit = 32;
    svs.clients = (client_t *) Hunk_AllocName(svs.maxclientslimit * sizeof (client_t), "clients");

    if (svs.maxclients > 1)
        deathmatch.set(1.0f);
    else
        deathmatch.set(0.0f);
}
Esempio n. 3
0
bool Settings::setCVar(const std::string& name, const unsigned int& value)
{
	CVar* cvar = cvarlist[name];
	if ( cvar )
	{
		if ( cvar->set(value) )
			return true;
		else
			BE_LOG( "warning failed to set value for cvar '" << name << "': value must be >=" << cvarlist[name]->getIntMin() << " and <=" << cvarlist[name]->getIntMax() );
	}
	else
		BE_LOG( "unknown cvar: '" << name << "'");
	return false;
}
Esempio n. 4
0
bool Settings::setCVar(const std::string& name, const unsigned int& value)
{
	CVar* cvar = cvarlist[name];
	if ( cvar )
	{
		if ( cvar->set(value) )
			return true;
		else
			m_logDebug << "::SETTINGS warning failed to set value for cvar '" << name << "': value must be >=" << cvarlist[name]->getIntMin() << " and <=" << cvarlist[name]->getIntMax() << "'\n";
	}
	else
		m_logDebug << "::SETTINGS unknown cvar: '" << name << "'\n";
	return false;
}
Esempio n. 5
0
/**
 * CL_FinishTimeDemo
 */
void CL_FinishTimeDemo(void) {
	int frames;
	float time;

	cls.timedemo = false;

	// the first frame didn't count
	frames = (host_framecount - cls.td_startframe) - 1;
	time = realtime - cls.td_starttime;
	if (!time)
		time = 1;
	Con_Printf("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames / time);

	//restore console speed
	scr_conspeed.set(saveconspeed);
}
Esempio n. 6
0
/**
 * timedemo [demoname]
 */
void CL_TimeDemo_f(void) {
	if (CmdArgs::getSource() != CmdArgs::COMMAND)
		return;

	if (CmdArgs::getArgCount() != 2) {
		Con_Printf("timedemo <demoname> : gets demo speeds\n");
		return;
	}

	if (key_dest == key_console) {
		//make console disappare fast
		saveconspeed = scr_conspeed.getFloat();
		scr_conspeed.set(1000000.0f);
		Con_ToggleConsole_f();
	}

	CL_PlayDemo_f();

	// cls.td_starttime will be grabbed at the second frame of the demo, so
	// all the loading time doesn't get counted
	cls.timedemo = true;
	cls.td_startframe = host_framecount;
	cls.td_lastframe = -1; // get a new message this frame
}
Esempio n. 7
0
/**
 * Must be called whenever vid changes
 * 
 * Internal use only
 */
static void SCR_CalcRefdef(void) {
	float size, fov;
	int h;
	bool full = false;

	scr_fullupdate = 0; // force a background redraw
	vid.recalc_refdef = 0;

	//========================================
	size = scr_viewsize.getFloat();
	fov = scr_fov.getFloat();

	// bound viewsize
	size = max(30, size);
	size = min(120, size);

	// bound field of view
	fov = max(10, fov);
	fov = min(170, fov);

	if (size != scr_viewsize.getFloat())
		scr_viewsize.set(size);
	if (fov != scr_fov.getFloat())
		scr_fov.set(fov);

	sb_lines = 24 + 16 + 8;
	if (size >= 100.0) {
		full = true;
		size = 100.0;
	}

	if (cl.intermission) {
		full = true;
		size = 100;
		sb_lines = 0;
	}

	size /= 100.0f;

	// TODO: remove sb_lines variable
	h = vid.height; // - sb_lines;

	r_refdef.vrect.width = vid.width * size;
	if (r_refdef.vrect.width < 96) {
		size = 96.0 / r_refdef.vrect.width;
		r_refdef.vrect.width = 96; // min for icons
	}

	r_refdef.vrect.height = (signed)vid.height * size;
	//if (r_refdef.vrect.height > (signed)vid.height - sb_lines)
	//	r_refdef.vrect.height = (signed)vid.height - sb_lines;
	if (r_refdef.vrect.height > (signed)vid.height)
		r_refdef.vrect.height = vid.height;
	r_refdef.vrect.x = (vid.width - r_refdef.vrect.width) / 2;

	if (full)
		r_refdef.vrect.y = 0;
	else
		r_refdef.vrect.y = (h - r_refdef.vrect.height) / 2;

	r_refdef.fov_x = fov;
	r_refdef.fov_y = CalcFov(r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);

	scr_vrect = r_refdef.vrect;
}