Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically adjust field of view for widescreen aspect ratios #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions source/src/rendergl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,15 @@ float dynfov()
bool isscoped = player1->weaponsel->type == GUN_SNIPER && ((sniperrifle *)player1->weaponsel)->scoped;
bool useremote = spectfovremote && camera1 != player1 && camera1->type == ENT_PLAYER && ((playerent *)camera1)->ffov && ((playerent *)camera1)->scopefov;
if(camera1 != player1 && camera1->type < ENT_CAMERA) isscoped = ((playerent *)camera1)->scoping;
if(isscoped) return (float) (useremote ? ((playerent *)camera1)->scopefov : scopefov);
else if(player1->isspectating()) return (float)(useremote ? ((playerent *)camera1)->ffov : spectfov);
else return (float)fov;

float resultfov = 90.0f;
if(isscoped) resultfov = (float) (useremote ? ((playerent *)camera1)->scopefov : scopefov);
else if(player1->isspectating()) resultfov = (float)(useremote ? ((playerent *)camera1)->ffov : spectfov);
else resultfov = (float)fov;

// automatic FOV adjustment for wide screens
// (horizontal FOV value is always specified for 4:3, but scaled for different aspect ratios)
return atan(tan(resultfov * M_PI / 360.0f) * 0.75f * aspect) * 360.0f / M_PI;
}

VARF(fog, 64, DEFAULT_FOG, 1024, flagmapconfigchange());
Expand Down