mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
parent
99bb2f1d83
commit
aa3425522d
16
src/r_main.c
16
src/r_main.c
@ -48,6 +48,7 @@ int validcount = 1; // increment every time a check is made
|
||||
lighttable_t *fixedcolormap;
|
||||
int centerx, centery;
|
||||
fixed_t centerxfrac, centeryfrac;
|
||||
fixed_t focallength;
|
||||
fixed_t projection;
|
||||
fixed_t viewx, viewy, viewz;
|
||||
angle_t viewangle;
|
||||
@ -259,7 +260,7 @@ static fixed_t centerxfrac_nonwide;
|
||||
static void R_InitTextureMapping(void)
|
||||
{
|
||||
register int i,x;
|
||||
fixed_t focallength, slopefrac;
|
||||
fixed_t slopefrac;
|
||||
angle_t fov;
|
||||
|
||||
// Use tangent table to generate viewangletox:
|
||||
@ -273,8 +274,9 @@ static void R_InitTextureMapping(void)
|
||||
{
|
||||
const double slope = (tan(custom_fov * M_PI / 360.0) *
|
||||
centerxfrac / centerxfrac_nonwide);
|
||||
fov = atan(slope) * FINEANGLES / M_PI;
|
||||
slopefrac = finetangent[FINEANGLES / 4 + fov / 2];
|
||||
const double angle = atan(slope) + M_PI / FINEANGLES; // finetangent offset.
|
||||
fov = angle * FINEANGLES / M_PI;
|
||||
slopefrac = tan(angle) * FRACUNIT;
|
||||
focallength = FixedDiv(centerxfrac, slopefrac);
|
||||
projection = centerxfrac / slope;
|
||||
}
|
||||
@ -285,10 +287,12 @@ static void R_InitTextureMapping(void)
|
||||
focallength = FixedDiv(centerxfrac_nonwide, slopefrac);
|
||||
projection = centerxfrac_nonwide;
|
||||
|
||||
if (widescreen != RATIO_ORIG)
|
||||
if (centerxfrac != centerxfrac_nonwide)
|
||||
{
|
||||
fov = atan((double)centerxfrac / centerxfrac_nonwide) * FINEANGLES / M_PI;
|
||||
slopefrac = finetangent[FINEANGLES / 4 + fov / 2];
|
||||
const double slope = (double)centerxfrac / centerxfrac_nonwide;
|
||||
const double angle = atan(slope) + M_PI / FINEANGLES; // finetangent offset.
|
||||
fov = angle * FINEANGLES / M_PI;
|
||||
slopefrac = tan(angle) * FRACUNIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ extern int centerx;
|
||||
extern int centery;
|
||||
extern fixed_t centerxfrac;
|
||||
extern fixed_t centeryfrac;
|
||||
extern fixed_t focallength;
|
||||
extern fixed_t projection;
|
||||
extern int validcount;
|
||||
extern int linecount;
|
||||
|
@ -157,7 +157,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
|
||||
{
|
||||
if (!fixedcolormap) // calculate lighting
|
||||
{ // killough 11/98:
|
||||
unsigned index = FixedDiv(spryscale, video.xscale) >> LIGHTSCALESHIFT;
|
||||
unsigned index = FixedDiv(spryscale * 160, focallength) >> LIGHTSCALESHIFT;
|
||||
|
||||
if (index >= MAXLIGHTSCALE )
|
||||
index = MAXLIGHTSCALE-1;
|
||||
@ -378,7 +378,7 @@ static void R_RenderSegLoop (void)
|
||||
texturecolumn >>= FRACBITS;
|
||||
|
||||
// calculate lighting
|
||||
index = FixedDiv(rw_scale, video.xscale) >> LIGHTSCALESHIFT; // killough 11/98
|
||||
index = FixedDiv(rw_scale * 160, focallength) >> LIGHTSCALESHIFT;
|
||||
|
||||
if (index >= MAXLIGHTSCALE )
|
||||
index = MAXLIGHTSCALE-1;
|
||||
|
@ -664,7 +664,7 @@ void R_ProjectSprite (mobj_t* thing)
|
||||
vis->colormap[0] = vis->colormap[1] = fullcolormap; // full bright // killough 3/20/98
|
||||
else
|
||||
{ // diminished light
|
||||
int index = FixedDiv(xscale, video.xscale) >> LIGHTSCALESHIFT; // killough 11/98
|
||||
int index = FixedDiv(xscale * 160, focallength) >> LIGHTSCALESHIFT;
|
||||
if (index >= MAXLIGHTSCALE)
|
||||
index = MAXLIGHTSCALE-1;
|
||||
vis->colormap[0] = spritelights[index];
|
||||
|
@ -724,7 +724,7 @@ boolean VX_ProjectVoxel (mobj_t * thing)
|
||||
else
|
||||
{
|
||||
// diminished light
|
||||
int index = FixedDiv(xscale, video.xscale) >> LIGHTSCALESHIFT; // killough 11/98
|
||||
int index = FixedDiv(xscale * 160, focallength) >> LIGHTSCALESHIFT;
|
||||
|
||||
if (index < 0) index = 0;
|
||||
if (index > MAXLIGHTSCALE-1) index = MAXLIGHTSCALE-1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user