mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
Make Polymer's FOV depend viewingrange variable in a 'tangent-linear'
fashion. Among other things, this makes the FOV widening when shrunk work. User CON code should always check the initial viewingrange value when attempting to do FOV effects like zoom, because it is not guaranteed to be 65536 due to different screen aspect ratios etc. git-svn-id: https://svn.eduke32.com/eduke32@2078 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
50bc3a3fcb
commit
026e1f44e9
3 changed files with 10 additions and 13 deletions
|
@ -12957,7 +12957,7 @@ restart_grand:
|
|||
|
||||
void setaspect_new()
|
||||
{
|
||||
if (r_usenewaspect && newaspect_enable)
|
||||
if (r_usenewaspect && newaspect_enable && getrendermode()!=4)
|
||||
{
|
||||
// the correction factor 100/107 has been found
|
||||
// out experimentally. squares ftw!
|
||||
|
@ -13020,7 +13020,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|||
void setaspect(int32_t daxrange, int32_t daaspect)
|
||||
{
|
||||
viewingrange = daxrange;
|
||||
viewingrangerecip = divscale32(1L,daxrange);
|
||||
viewingrangerecip = divscale32(1,daxrange);
|
||||
|
||||
yxaspect = daaspect;
|
||||
xyaspect = divscale32(1,yxaspect);
|
||||
|
|
|
@ -780,6 +780,9 @@ void polymer_uninit(void)
|
|||
void polymer_setaspect(int32_t ang)
|
||||
{
|
||||
float aspect;
|
||||
float fang = ang;
|
||||
|
||||
fang *= atanf((float)viewingrange/65536.0f)/(PI/4);
|
||||
|
||||
if (pr_customaspect != 0.0f)
|
||||
aspect = pr_customaspect;
|
||||
|
@ -789,7 +792,7 @@ void polymer_setaspect(int32_t ang)
|
|||
|
||||
bglMatrixMode(GL_PROJECTION);
|
||||
bglLoadIdentity();
|
||||
bgluPerspective((float)(ang) / (2048.0f / 360.0f), aspect, 0.01f, 100.0f);
|
||||
bgluPerspective(fang / (2048.0f / 360.0f), aspect, 0.01f, 100.0f);
|
||||
}
|
||||
|
||||
void polymer_glinit(void)
|
||||
|
|
|
@ -2182,11 +2182,10 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
|||
char col;
|
||||
walltype *wal, *wal2;
|
||||
spritetype *spr;
|
||||
int32_t oydim=ydim;
|
||||
|
||||
ydim = (int32_t)((double)xdim * 0.625f);
|
||||
setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L));
|
||||
ydim = oydim;
|
||||
int32_t tmpydim = (xdim*5)/8;
|
||||
|
||||
setaspect(65536, divscale16(tmpydim*320, xdim*200));
|
||||
|
||||
xvect = sintable[(-cang)&2047] * czoom;
|
||||
yvect = sintable[(1536-cang)&2047] * czoom;
|
||||
|
@ -3171,7 +3170,6 @@ void G_DrawBackground(void)
|
|||
|
||||
static int32_t ror_sprite = -1;
|
||||
|
||||
static int32_t oyrepeat=-1;
|
||||
extern float r_ambientlight;
|
||||
|
||||
char ror_protectedsectors[MAXSECTORS];
|
||||
|
@ -3389,11 +3387,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
|
||||
if (!r_usenewaspect)
|
||||
{
|
||||
// if (i != oyrepeat)
|
||||
{
|
||||
oyrepeat = i;
|
||||
setaspect(oyrepeat,yxaspect);
|
||||
}
|
||||
setaspect(i, yxaspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue