tr2/viewport: fix fov cropping viewport

Resolves #2002.
This commit is contained in:
Marcin Kurczewski 2024-12-31 01:03:11 +01:00
parent e44c5507f2
commit 97f4b782ca
2 changed files with 5 additions and 7 deletions

View file

@ -21,6 +21,7 @@
- fixed flare sound effects not always playing when Lara is in shallow water (#1590)
- fixed looking forward too far causing an upside down camera frame (#1594)
- fixed music not playing if triggered while the game is muted, but the volume is then increased (#2170)
- fixed game FOV being interpreted as horizontal (#2002)
- fixed software renderer not applying underwater tint (#2066, regression from 0.7)
- fixed some enemies not looking at Lara (#2080, regression from 0.6)
- fixed the camera getting stuck at the start of Home Sweet Home (#2129, regression from 0.7)

View file

@ -49,13 +49,10 @@ static void M_ApplyGameVars(const VIEWPORT *vp);
static void M_AlterFov(VIEWPORT *const vp)
{
if (vp->view_angle == 0) {
return;
}
const int16_t view_angle = vp->view_angle;
vp->game_vars.persp = vp->game_vars.win_width / 2 * Math_Cos(view_angle / 2)
/ Math_Sin(view_angle / 2);
const int32_t view_angle = vp->view_angle;
const int32_t fov_width = vp->game_vars.win_height * 320 / 240;
vp->game_vars.persp =
fov_width / 2 * Math_Cos(view_angle / 2) / Math_Sin(view_angle / 2);
vp->game_vars.flt_persp = vp->game_vars.persp;
vp->game_vars.flt_rhw_o_persp = g_RhwFactor / vp->game_vars.flt_persp;