If r_screenaspect is 0 (or any other invalid value), assume square pixel aspect.

git-svn-id: https://svn.eduke32.com/eduke32@2959 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-24 18:51:49 +00:00
parent de199a4741
commit 1f5971a4db
3 changed files with 11 additions and 5 deletions

View file

@ -328,8 +328,8 @@ int32_t baselayer_init(void)
cvar_t cvars_engine[] =
{
{ "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
(void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 100, 9999 },
{ "r_screenaspect","r_screenaspect: if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
(void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 0, 9999 },
{ "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
{ "r_voxels","r_voxels: enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 },
#ifdef YAX_ENABLE

View file

@ -401,7 +401,8 @@ int32_t writesetup(const char *fn)
"; Use new aspect determination code? (classic/Polymost)\n"
"r_usenewaspect = %d\n"
#ifndef RENDERTYPEWIN
"; Screen aspect for fullscreen, in the form WWHH (e.g. 1609 for 16:9)\n"
"; Screen aspect for fullscreen, in the form WWHH (e.g. 1609 for 16:9).\n"
"; A value of 0 means to assume that the pixel aspect is square."
"r_screenxy = %d\n"
#endif
"\n"

View file

@ -117,7 +117,7 @@ static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
// r_usenewaspect is the cvar, newaspect_enable to trigger the new behaviour in the code
int32_t r_usenewaspect = 1, newaspect_enable=0;
uint32_t r_screenxy = 403; // 4:3 aspect ratio
uint32_t r_screenxy = 0;
int32_t curbrightness = 0, gammabrightness = 0;
@ -13542,7 +13542,12 @@ void setaspect_new()
int32_t pixratio;
x=r_screenxy/100; y=r_screenxy%100;
if (y==0 || x==0) { x=4; y=3; }
if (y==0 || x==0)
{
// Assume square pixel aspect.
x = xdim;
y = ydim;
}
pixratio = divscale16(xd*y, yd*x);
yx = divscale16(yx, pixratio);