[quake3-commits] r2319 - in trunk/code: q3_ui ui

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 29 22:56:50 EDT 2012


Author: ztm
Date: 2012-09-29 22:56:50 -0400 (Sat, 29 Sep 2012)
New Revision: 2319

Modified:
   trunk/code/q3_ui/ui_players.c
   trunk/code/ui/ui_players.c
Log:
Fix UI player model FOV when using non-640x480 resolution.

Modified: trunk/code/q3_ui/ui_players.c
===================================================================
--- trunk/code/q3_ui/ui_players.c	2012-09-17 04:16:30 UTC (rev 2318)
+++ trunk/code/q3_ui/ui_players.c	2012-09-30 02:56:50 UTC (rev 2319)
@@ -736,9 +736,9 @@
 	refdef.width = w;
 	refdef.height = h;
 
-	refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
-	xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
-	refdef.fov_y = atan2( refdef.height, xx );
+	refdef.fov_x = (int)((float)refdef.width / uis.xscale / 640.0f * 90.0f);
+	xx = refdef.width / uis.xscale / tan( refdef.fov_x / 360 * M_PI );
+	refdef.fov_y = atan2( refdef.height / uis.yscale, xx );
 	refdef.fov_y *= ( 360 / M_PI );
 
 	// calculate distance so the player nearly fills the box

Modified: trunk/code/ui/ui_players.c
===================================================================
--- trunk/code/ui/ui_players.c	2012-09-17 04:16:30 UTC (rev 2318)
+++ trunk/code/ui/ui_players.c	2012-09-30 02:56:50 UTC (rev 2319)
@@ -742,13 +742,13 @@
 	refdef.width = w;
 	refdef.height = h;
 
-	refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
-	xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
-	refdef.fov_y = atan2( refdef.height, xx );
+	refdef.fov_x = (int)((float)refdef.width / uiInfo.uiDC.xscale / 640.0f * 90.0f);
+	xx = refdef.width / uiInfo.uiDC.xscale / tan( refdef.fov_x / 360 * M_PI );
+	refdef.fov_y = atan2( refdef.height / uiInfo.uiDC.yscale, xx );
 	refdef.fov_y *= ( 360 / (float)M_PI );
 
 	// calculate distance so the player nearly fills the box
-	len = 0.7 * ( maxs[2] - mins[2] );		
+	len = 0.7 * ( maxs[2] - mins[2] );
 	origin[0] = len / tan( DEG2RAD(refdef.fov_x) * 0.5 );
 	origin[1] = 0.5 * ( mins[1] + maxs[1] );
 	origin[2] = -0.5 * ( mins[2] + maxs[2] );



More information about the quake3-commits mailing list