Fix for showstopper crash in software client.

Also added checks for possible height=0 crashes to GL target too.
This commit is contained in:
Danne 2000-05-19 14:38:45 +00:00
parent a1bca14fa8
commit 4cf13bcdbf

View file

@ -290,7 +290,7 @@ float CalcFov (float fov_x, float width, float height)
x = width/tan(fov_x/360*M_PI); x = width/tan(fov_x/360*M_PI);
a = atan (height/x); a = (x == 0) ? 90 : atan(height/x); // 0 shouldn't happen
a = a*360/M_PI; a = a*360/M_PI;
@ -328,21 +328,6 @@ static void SCR_CalcRefdef (void)
if (scr_viewsize->value > 120) if (scr_viewsize->value > 120)
Cvar_Set (scr_viewsize,"120"); Cvar_Set (scr_viewsize,"120");
// bound field of view
/* if (scr_fov.value < 10)
CVAR_FIXME */
if (scr_fov->value < 10)
Cvar_Set (scr_fov,"10");
/* if (scr_fov.value > 170)
CVAR_FIXME */
if (scr_fov->value > 170)
Cvar_Set (scr_fov,"170");
/* r_refdef.fov_x = scr_fov.value;
CVAR_FIXME */
r_refdef.fov_x = scr_fov->value;
r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
// intermission is always full screen // intermission is always full screen
if (cl.intermission) if (cl.intermission)
size = 120; size = 120;
@ -358,6 +343,22 @@ static void SCR_CalcRefdef (void)
else else
sb_lines = 24+16+8; sb_lines = 24+16+8;
r_refdef.vrect.height = vid.height * size;
// bound field of view
/* if (scr_fov.value < 10)
CVAR_FIXME */
if (scr_fov->value < 10)
Cvar_Set (scr_fov,"10");
/* if (scr_fov.value > 170)
CVAR_FIXME */
if (scr_fov->value > 170)
Cvar_Set (scr_fov,"170");
/* r_refdef.fov_x = scr_fov.value;
CVAR_FIXME */
r_refdef.fov_x = scr_fov->value;
r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
// these calculations mirror those in R_Init() for r_refdef, but take no // these calculations mirror those in R_Init() for r_refdef, but take no
// account of water warping // account of water warping
vrect.x = 0; vrect.x = 0;