mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
parent
cd957d84f7
commit
cdbea0be26
1 changed files with 5 additions and 24 deletions
25
src/r_main.c
25
src/r_main.c
|
@ -564,7 +564,7 @@ static struct {
|
||||||
void R_CheckViewMorph(void)
|
void R_CheckViewMorph(void)
|
||||||
{
|
{
|
||||||
float zoomfactor, rollcos, rollsin;
|
float zoomfactor, rollcos, rollsin;
|
||||||
float x1, y1, x2, y2, fisheyef;
|
float x1, y1, x2, y2;
|
||||||
fixed_t temp;
|
fixed_t temp;
|
||||||
size_t end, vx, vy, pos, usedpos;
|
size_t end, vx, vy, pos, usedpos;
|
||||||
INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2;
|
INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2;
|
||||||
|
@ -574,14 +574,14 @@ void R_CheckViewMorph(void)
|
||||||
|
|
||||||
// temp values
|
// temp values
|
||||||
//angle_t rollangle = leveltime << (ANGLETOFINESHIFT);
|
//angle_t rollangle = leveltime << (ANGLETOFINESHIFT);
|
||||||
fixed_t fisheye = FRACUNIT;
|
fixed_t fisheye = 0;
|
||||||
|
|
||||||
rollangle >>= ANGLETOFINESHIFT;
|
rollangle >>= ANGLETOFINESHIFT;
|
||||||
rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot.
|
rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot.
|
||||||
|
|
||||||
fisheye &= ~0xFF; // Same limiter logic for fisheye
|
fisheye &= ~0xFF; // Same limiter logic for fisheye
|
||||||
|
|
||||||
if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye && viewmorph.scrmapsize == vid.width*vid.height)
|
if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye)
|
||||||
return; // No change
|
return; // No change
|
||||||
|
|
||||||
viewmorph.rollangle = rollangle;
|
viewmorph.rollangle = rollangle;
|
||||||
|
@ -614,13 +614,6 @@ void R_CheckViewMorph(void)
|
||||||
x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width;
|
x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width;
|
||||||
y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height;
|
y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height;
|
||||||
|
|
||||||
if (fisheye)
|
|
||||||
{
|
|
||||||
float dist = powf(2, (fisheyef = FIXED_TO_FLOAT(fisheye))/2);
|
|
||||||
x1 *= dist;
|
|
||||||
y1 *= dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = max(x1, y1)*FRACUNIT;
|
temp = max(x1, y1)*FRACUNIT;
|
||||||
if (temp < FRACUNIT)
|
if (temp < FRACUNIT)
|
||||||
temp = FRACUNIT;
|
temp = FRACUNIT;
|
||||||
|
@ -658,21 +651,9 @@ void R_CheckViewMorph(void)
|
||||||
y1 += rollcos;
|
y1 += rollcos;
|
||||||
|
|
||||||
for (vx = 0; vx < vid.width; vx++)
|
for (vx = 0; vx < vid.width; vx++)
|
||||||
{
|
|
||||||
if (fisheye)
|
|
||||||
{
|
|
||||||
float dist = sqrtf(x2*x2 + y2*y2) * zoomfactor / sqrtf(halfwidth*halfwidth + halfheight*halfheight);
|
|
||||||
dist += (1 - sqrtf(1 - dist*dist)) / dist;
|
|
||||||
dist = powf(dist, fisheyef);
|
|
||||||
usedx = halfwidth+x2*dist;
|
|
||||||
usedy = halfheight+y2*dist;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
usedx = halfwidth+x2;
|
usedx = halfwidth+x2;
|
||||||
usedy = halfheight+y2;
|
usedy = halfheight+y2;
|
||||||
}
|
|
||||||
|
|
||||||
if (usedx < 0) usedx = 0;
|
if (usedx < 0) usedx = 0;
|
||||||
else if (usedx >= vid.width) usedx = vid.width-1;
|
else if (usedx >= vid.width) usedx = vid.width-1;
|
||||||
|
|
Loading…
Reference in a new issue