Beispiel #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;
}
Beispiel #2
0
/*
=================
SCR_CalcRefdef

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

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

// bound field of view
	if (scr_fov.value < 10)
		Cvar_Set (&scr_fov, "10");
	if (scr_fov.value > (r_refdef2.allow_cheats ? 170 : 140))
		Cvar_SetValue (&scr_fov, r_refdef2.allow_cheats ? 170 : 140);

// intermission is always full screen	
	if (cl.intermission) {
		size = 100.0;
		sb_drawinventory = sb_drawmain = false;
	} else {
		size = scr_viewsize.value;

		// decide how much of the status bar to draw
		if (size >= 120) {
			// no status bar at all
			sb_drawinventory = sb_drawmain = false;
		} else if (size >= 110) {
			// no inventory
			sb_drawinventory = false;
			sb_drawmain = true;
		} else {
			// full status bar
			sb_drawinventory = sb_drawmain = true;
		}

		if (size > 100.0)
			size = 100.0;
	}

	size /= 100.0;

	scr_vrect.width = (int)(vid.width * size + 1.0) & ~1;
	if (scr_vrect.width < 96) {
		size = 96.0 / scr_vrect.width;
		scr_vrect.width = 96; // min for icons
	}

	scr_vrect.height = (int)(vid.height * size + 1.0) & ~1;

	scr_vrect.x = (vid.width - scr_vrect.width)/2;
	scr_vrect.y = (vid.height - scr_vrect.height)/2;

	r_refdef2.vrect = scr_vrect;

	if (scr_fov_adapt.value)
		r_refdef2.fov_x = AdaptFovx(scr_fov.value, r_refdef2.vrect.width, r_refdef2.vrect.height);
	else
		r_refdef2.fov_x = scr_fov.value;
	r_refdef2.fov_x = clamp(10, r_refdef2.fov_x, 170);
	r_refdef2.fov_y = CalcFov (r_refdef2.fov_x, scr_vrect.width, scr_vrect.height);
}
Beispiel #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;
}