mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Unless I'm mistaken, scalesteps/heightsteps should be divided by stop-start, not stop-start+1. Revert this commit if that was intentional.
This commit is contained in:
parent
28631c30b7
commit
ec5b272fa6
1 changed files with 25 additions and 17 deletions
42
src/r_segs.c
42
src/r_segs.c
|
@ -288,6 +288,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
line_t *ldef;
|
line_t *ldef;
|
||||||
sector_t *front, *back;
|
sector_t *front, *back;
|
||||||
INT32 times, repeats;
|
INT32 times, repeats;
|
||||||
|
INT32 range;
|
||||||
|
|
||||||
// Calculate light table.
|
// Calculate light table.
|
||||||
// Use different light tables
|
// Use different light tables
|
||||||
|
@ -334,6 +335,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
colfunc = fuzzcolfunc;
|
colfunc = fuzzcolfunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
range = max(ds->x2-ds->x1, 1);
|
||||||
rw_scalestep = ds->scalestep;
|
rw_scalestep = ds->scalestep;
|
||||||
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
|
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
|
||||||
|
|
||||||
|
@ -377,7 +379,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
||||||
|
|
||||||
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
||||||
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
||||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1);
|
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||||
//if (x1 > ds->x1)
|
//if (x1 > ds->x1)
|
||||||
//rlight->height -= (x1 - ds->x1)*rlight->heightstep;
|
//rlight->height -= (x1 - ds->x1)*rlight->heightstep;
|
||||||
#else
|
#else
|
||||||
|
@ -693,6 +695,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
fixed_t offsetvalue = 0;
|
fixed_t offsetvalue = 0;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
|
INT32 range;
|
||||||
#ifndef ESLOPE
|
#ifndef ESLOPE
|
||||||
fixed_t lheight;
|
fixed_t lheight;
|
||||||
#endif
|
#endif
|
||||||
|
@ -757,6 +760,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
else if (pfloor->flags & FF_FOG)
|
else if (pfloor->flags & FF_FOG)
|
||||||
colfunc = R_DrawFogColumn_8;
|
colfunc = R_DrawFogColumn_8;
|
||||||
|
|
||||||
|
range = max(ds->x2-ds->x1, 1);
|
||||||
//SoM: Moved these up here so they are available for my lightlist calculations
|
//SoM: Moved these up here so they are available for my lightlist calculations
|
||||||
rw_scalestep = ds->scalestep;
|
rw_scalestep = ds->scalestep;
|
||||||
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
|
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
|
||||||
|
@ -813,7 +817,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
rightheight -= viewz;
|
rightheight -= viewz;
|
||||||
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
||||||
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
||||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1);
|
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||||
rlight->height -= rlight->heightstep;
|
rlight->height -= rlight->heightstep;
|
||||||
#else
|
#else
|
||||||
if (light->height < *pfloor->bottomheight)
|
if (light->height < *pfloor->bottomheight)
|
||||||
|
@ -841,7 +845,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
|
|
||||||
rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1);
|
||||||
rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
|
||||||
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(ds->x2-ds->x1+1);
|
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range);
|
||||||
rlight->botheight -= rlight->botheightstep;
|
rlight->botheight -= rlight->botheightstep;
|
||||||
#else
|
#else
|
||||||
lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight;
|
lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight;
|
||||||
|
@ -951,8 +955,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
top_step = centeryfrac - FixedMul(right_top, ds->scale2);
|
top_step = centeryfrac - FixedMul(right_top, ds->scale2);
|
||||||
bottom_step = centeryfrac - FixedMul(right_bottom, ds->scale2);
|
bottom_step = centeryfrac - FixedMul(right_bottom, ds->scale2);
|
||||||
|
|
||||||
top_step = (top_step-top_frac)/(ds->x2-ds->x1+1);
|
top_step = (top_step-top_frac)/(range);
|
||||||
bottom_step = (bottom_step-bottom_frac)/(ds->x2-ds->x1+1);
|
bottom_step = (bottom_step-bottom_frac)/(range);
|
||||||
|
|
||||||
top_frac += top_step * (x1 - ds->x1);
|
top_frac += top_step * (x1 - ds->x1);
|
||||||
bottom_frac += bottom_step * (x1 - ds->x1);
|
bottom_frac += bottom_step * (x1 - ds->x1);
|
||||||
|
@ -1549,6 +1553,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
|
INT32 range;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
vertex_t segleft, segright;
|
vertex_t segleft, segright;
|
||||||
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
||||||
|
@ -1633,7 +1638,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
if (stop > start)
|
if (stop > start)
|
||||||
{
|
{
|
||||||
ds_p->scale2 = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[stop]);
|
ds_p->scale2 = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[stop]);
|
||||||
ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (stop-start);
|
range = stop-start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1654,8 +1659,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ds_p->scale2 = ds_p->scale1;
|
ds_p->scale2 = ds_p->scale1;
|
||||||
|
range = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (range);
|
||||||
|
|
||||||
// calculate texture boundaries
|
// calculate texture boundaries
|
||||||
// and decide if floor / ceiling marks are needed
|
// and decide if floor / ceiling marks are needed
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
|
@ -2531,11 +2539,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (frontsector->c_slope) {
|
if (frontsector->c_slope) {
|
||||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2);
|
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2);
|
||||||
topstep = (topfracend-topfrac)/(stop-start+1);
|
topstep = (topfracend-topfrac)/(range);
|
||||||
}
|
}
|
||||||
if (frontsector->f_slope) {
|
if (frontsector->f_slope) {
|
||||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2);
|
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2);
|
||||||
bottomstep = (bottomfracend-bottomfrac)/(stop-start+1);
|
bottomstep = (bottomfracend-bottomfrac)/(range);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2596,7 +2604,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
rlight->height = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
|
rlight->height = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
|
||||||
rlight->heightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2);
|
rlight->heightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2);
|
||||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(stop-start+1);
|
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||||
#else
|
#else
|
||||||
rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw_scale);
|
rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw_scale);
|
||||||
rlight->heightstep = -FixedMul (rw_scalestep, (light->height - viewz) >> 4);
|
rlight->heightstep = -FixedMul (rw_scalestep, (light->height - viewz) >> 4);
|
||||||
|
@ -2623,7 +2631,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
|
|
||||||
rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
|
rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
|
||||||
rlight->botheightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2);
|
rlight->botheightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2);
|
||||||
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(stop-start+1);
|
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw_scale);
|
rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw_scale);
|
||||||
|
@ -2652,7 +2660,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
ffloor[i].f_pos_slope >>= 4;
|
ffloor[i].f_pos_slope >>= 4;
|
||||||
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
|
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
|
||||||
ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(stop-start+1);
|
ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range);
|
||||||
#else
|
#else
|
||||||
ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos);
|
ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos);
|
||||||
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
|
ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale);
|
||||||
|
@ -2681,7 +2689,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (backsector->c_slope) {
|
if (backsector->c_slope) {
|
||||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2);
|
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2);
|
||||||
pixhighstep = (topfracend-pixhigh)/(stop-start+1);
|
pixhighstep = (topfracend-pixhigh)/(range);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2697,7 +2705,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (backsector->f_slope) {
|
if (backsector->f_slope) {
|
||||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2);
|
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2);
|
||||||
pixlowstep = (bottomfracend-pixlow)/(stop-start+1);
|
pixlowstep = (bottomfracend-pixlow)/(range);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2739,7 +2747,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ffloor[i].b_pos_slope >>= 4;
|
ffloor[i].b_pos_slope >>= 4;
|
||||||
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
||||||
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
||||||
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1);
|
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2761,7 +2769,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ffloor[i].b_pos_slope >>= 4;
|
ffloor[i].b_pos_slope >>= 4;
|
||||||
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
||||||
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
||||||
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1);
|
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -2824,7 +2832,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ffloor[i].b_pos_slope >>= 4;
|
ffloor[i].b_pos_slope >>= 4;
|
||||||
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
||||||
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
||||||
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1);
|
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2846,7 +2854,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
ffloor[i].b_pos_slope >>= 4;
|
ffloor[i].b_pos_slope >>= 4;
|
||||||
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
|
||||||
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2);
|
||||||
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1);
|
ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue