From 11811e8138f1236600f73bee92bf1be2ca17186a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 30 Sep 2012 02:56:50 +0000 Subject: [PATCH] Fix UI player model FOV when using non-640x480 resolution. --- code/q3_ui/ui_players.c | 6 +++--- code/ui/ui_players.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/q3_ui/ui_players.c b/code/q3_ui/ui_players.c index 28a58ccd..d132f5c9 100644 --- a/code/q3_ui/ui_players.c +++ b/code/q3_ui/ui_players.c @@ -736,9 +736,9 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti 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 diff --git a/code/ui/ui_players.c b/code/ui/ui_players.c index e42fc893..409ff689 100644 --- a/code/ui/ui_players.c +++ b/code/ui/ui_players.c @@ -742,13 +742,13 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti 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] );