Example #1
0
/*
=================
SCR_CalcRefdef

Must be called whenever vid changes
Internal use only
=================
*/
static void SCR_CalcRefdef (void)
{
	float		size, scale; //johnfitz -- scale

// force the status bar to redraw
	Sbar_Changed ();

	scr_tileclear_updates = 0; //johnfitz

// bound viewsize
	if (scr_viewsize.value < 30)
		Cvar_SetQuick (&scr_viewsize, "30");
	if (scr_viewsize.value > 120)
		Cvar_SetQuick (&scr_viewsize, "120");

// bound fov
	if (scr_fov.value < 10)
		Cvar_SetQuick (&scr_fov, "10");
	if (scr_fov.value > 170)
		Cvar_SetQuick (&scr_fov, "170");

	vid.recalc_refdef = 0;

	//johnfitz -- rewrote this section
	size = scr_viewsize.value;
	scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);

	if (size >= 120 || cl.intermission || scr_sbaralpha.value < 1) //johnfitz -- scr_sbaralpha.value
		sb_lines = 0;
	else if (size >= 110)
		sb_lines = 24 * scale;
	else
		sb_lines = 48 * scale;

	size = q_min(scr_viewsize.value, 100) / 100;
	//johnfitz

	//johnfitz -- rewrote this section
	r_refdef.vrect.width = q_max(glwidth * size, 96); //no smaller than 96, for icons
	r_refdef.vrect.height = q_min(glheight * size, glheight - sb_lines); //make room for sbar
	r_refdef.vrect.x = (glwidth - r_refdef.vrect.width)/2;
	r_refdef.vrect.y = (glheight - sb_lines - r_refdef.vrect.height)/2;
	//johnfitz

	r_refdef.fov_x = AdaptFovx(scr_fov.value, vid.width, vid.height);
	r_refdef.fov_y = CalcFovy (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);

	scr_vrect = r_refdef.vrect;
}
/*	Must be called whenever vid changes
	Internal use only
*/
void Screen_UpdateSize(void)
{
	float size, scale; //johnfitz -- scale

	vid.bRecalcRefDef = false;

	scr_tileclear_updates = 0; //johnfitz

// bound viewsize
	if(scr_viewsize.value < 30)
		Cvar_Set("viewsize","30");
	else if(scr_viewsize.value > 120)
		Cvar_Set("viewsize","120");

	// Bound fov
	if(scr_fov.value < 10)
		Cvar_Set ("fov","10");
	else if(scr_fov.value > 170)
		Cvar_Set ("fov","170");

	//johnfitz -- rewrote this section
	size = scr_viewsize.value;
	scale = Math_Clamp(1.0, scr_sbarscale.value, (float)glwidth / 320.0);

	if (size >= 120 || cl.intermission || scr_sbaralpha.value < 1) //johnfitz -- scr_sbaralpha.value
		sb_lines = 0;
	else if (size >= 110)
		sb_lines = 24*scale;
	else
		sb_lines = 48*scale;

	size = Math_Min(scr_viewsize.value,100)/100;
	//johnfitz

	//johnfitz -- rewrote this section
	r_refdef.vrect.width = Math_Max(glwidth * size, 96); //no smaller than 96, for icons
	r_refdef.vrect.height = Math_Min(glheight * size, glheight - sb_lines); //make room for sbar
	r_refdef.vrect.x = (glwidth - r_refdef.vrect.width)/2;
	r_refdef.vrect.y = (glheight - sb_lines - r_refdef.vrect.height)/2;
	//johnfitz

	r_refdef.fov_x = scr_fov.value;
	r_refdef.fov_y = CalcFovy (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);

	scr_vrect = r_refdef.vrect;
}
Example #3
0
/*
=================
SCR_CalcRefdef

Must be called whenever vid changes
Internal use only
=================
*/
static void SCR_CalcRefdef (void)
{
	float		size;
	int		h;
	qboolean		full = false;

	vid.recalc_refdef = false;

// force the status bar to redraw
	Sbar_Changed ();

//========================================
	
// bound viewsize
	if (scr_viewsize.value < 30)
		Cvar_Set ("viewsize","30");
	if (scr_viewsize.value > 120)
		Cvar_Set ("viewsize","120");

// bound weaponsize
	if (scr_weaponsize.value < 60)
		Cvar_Set ("weaponsize","60");
	if (scr_weaponsize.value > 100)
		Cvar_Set ("weaponsize","100");

// bound field of view
	if (scr_fov.value < 10)
		Cvar_Set ("fov","10");
	if (scr_fov.value > 170)
		Cvar_Set ("fov","170");

// bound weapon field of view
	if (scr_weaponfov.value < 10)
		Cvar_Set ("weaponfov","10");
	if (scr_weaponfov.value > 170)
		Cvar_Set ("weaponfov","170");

// intermission is always full screen	
	if (cl.intermission)
		size = 120;
	else
		size = scr_viewsize.value;

	if (size >= 120)
		sb_lines = 0;		// no status bar at all
	else if (size >= 110)
		sb_lines = 24;		// no inventory
	else
		sb_lines = 24+16+8;

	if (scr_overdrawsbar.value)
		sb_lines = 0;

	if (scr_viewsize.value >= 100.0) 
	{
		full = true;
		size = 100.0;
	} 
	else
	{
		full = false;
		size = scr_viewsize.value;
	}

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

	size /= 100.0;

	h = (!scr_sbar.value && full) ? vid.height : 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 = vid.height * size;

	if (scr_sbar.value || !full)
	{
		if (r_refdef.vrect.height > (int)vid.height - sb_lines)
			r_refdef.vrect.height = vid.height - sb_lines;
	}
	else if (r_refdef.vrect.height > (int)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 = AdaptFovx (scr_fov.value, vid.width, vid.height);
	r_refdef.fov_y = CalcFovy (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
	
	r_refdef.weaponfov_x = AdaptFovx (scr_weaponfov.value, vid.width, vid.height);

	scr_vrect = r_refdef.vrect;
}