diff --git a/src/r_bsp.c b/src/r_bsp.c index 51d9bd3fd..b6dbfd76a 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -410,7 +410,7 @@ static void R_AddLine(seg_t *line) return; // Global angle needed by segcalc. - rw_angle1 = angle1; + rw.angle1 = angle1; angle1 -= viewangle; angle2 -= viewangle; diff --git a/src/r_main.c b/src/r_main.c index 0ef0a3d88..8c3fa8857 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -364,7 +364,7 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1) // R_ScaleFromGlobalAngle // Returns the texture mapping scale for the current line (horizontal span) // at the given angle. -// rw_distance must be calculated first. +// rw.distance must be calculated first. // // killough 5/2/98: reformatted, cleaned up // @@ -372,8 +372,8 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1) fixed_t R_ScaleFromGlobalAngle(angle_t visangle) { angle_t anglea = ANGLE_90 + (visangle-viewangle); - angle_t angleb = ANGLE_90 + (visangle-rw_normalangle); - fixed_t den = FixedMul(rw_distance, FINESINE(anglea>>ANGLETOFINESHIFT)); + angle_t angleb = ANGLE_90 + (visangle-rw.normalangle); + fixed_t den = FixedMul(rw.distance, FINESINE(anglea>>ANGLETOFINESHIFT)); // proff 11/06/98: Changed for high-res fixed_t num = FixedMul(projectiony, FINESINE(angleb>>ANGLETOFINESHIFT)); diff --git a/src/r_segs.c b/src/r_segs.c index b132ca976..63c9799e0 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -45,28 +45,16 @@ static vertex_t segleft, segright; static fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide; #endif -angle_t rw_normalangle; -// angle to line origin -angle_t rw_angle1; -fixed_t rw_distance; - // for R_CalculateSegDistance #define SOFTWARE_USE_FLOATS // // regular wall // -static INT32 rw_x, rw_stopx; -static angle_t rw_centerangle; -static fixed_t rw_offset; -static fixed_t rw_offset2; // for splats -static fixed_t rw_scale, rw_scalestep; -static fixed_t rw_midtexturemid, rw_toptexturemid, rw_bottomtexturemid; +renderwall_t rw; static INT32 worldtop, worldbottom, worldhigh, worldlow; #ifdef ESLOPE static INT32 worldtopslope, worldbottomslope, worldhighslope, worldlowslope; // worldtop/bottom at end of slope -static fixed_t rw_toptextureslide, rw_midtextureslide, rw_bottomtextureslide; // Defines how to adjust Y offsets along the wall for slopes -static fixed_t rw_midtextureback, rw_midtexturebackslide; // Values for masked midtexture height calculation #endif static fixed_t pixhigh, pixlow, pixhighstep, pixlowstep; static fixed_t topfrac, topstep; @@ -133,12 +121,12 @@ static void R_RenderSegLoop (void) if (dc_numlights) colfunc = colfuncs[COLDRAWFUNC_SHADOWED]; - for (; rw_x < rw_stopx; rw_x++) + for (; rw.x < rw.stopx; rw.x++) { // mark floor / ceiling areas yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS; - top = ceilingclip[rw_x]+1; + top = ceilingclip[rw.x]+1; // no space above wall? if (yl < top) @@ -149,39 +137,39 @@ static void R_RenderSegLoop (void) #if 0 bottom = yl-1; - if (bottom >= floorclip[rw_x]) - bottom = floorclip[rw_x]-1; + if (bottom >= floorclip[rw.x]) + bottom = floorclip[rw.x]-1; if (top <= bottom) #else - bottom = yl > floorclip[rw_x] ? floorclip[rw_x] : yl; + bottom = yl > floorclip[rw.x] ? floorclip[rw.x] : yl; if (top <= --bottom && ceilingplane) #endif - R_ExpandPlaneY(ceilingplane, rw_x, top, bottom); + R_ExpandPlaneY(ceilingplane, rw.x, top, bottom); } yh = bottomfrac>>HEIGHTBITS; - bottom = floorclip[rw_x]-1; + bottom = floorclip[rw.x]-1; if (yh > bottom) yh = bottom; if (markfloor) { - top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh; + top = yh < ceilingclip[rw.x] ? ceilingclip[rw.x] : yh; if (++top <= bottom && floorplane) - R_ExpandPlaneY(floorplane, rw_x, top, bottom); + R_ExpandPlaneY(floorplane, rw.x, top, bottom); } if (numffloors) { - firstseg->frontscale[rw_x] = frontscale[rw_x]; - top = ceilingclip[rw_x]+1; // PRBoom - bottom = floorclip[rw_x]-1; // PRBoom + firstseg->frontscale[rw.x] = frontscale[rw.x]; + top = ceilingclip[rw.x]+1; // PRBoom + bottom = floorclip[rw.x]-1; // PRBoom for (i = 0; i < numffloors; i++) { @@ -193,7 +181,7 @@ static void R_RenderSegLoop (void) if (ffloor[i].height < viewz) { INT32 top_w = (ffloor[i].f_frac >> HEIGHTBITS) + 1; - INT32 bottom_w = ffloor[i].f_clip[rw_x]; + INT32 bottom_w = ffloor[i].f_clip[rw.x]; if (top_w < top) top_w = top; @@ -204,20 +192,20 @@ static void R_RenderSegLoop (void) #ifdef POLYOBJECTS_PLANES // Polyobject-specific hack to fix plane leaking -Red if (ffloor[i].polyobj && top_w >= bottom_w) { - ffloor[i].plane->top[rw_x] = 0xFFFF; - ffloor[i].plane->bottom[rw_x] = 0x0000; // fix for sky plane drawing crashes - Monster Iestyn 25/05/18 + ffloor[i].plane->top[rw.x] = 0xFFFF; + ffloor[i].plane->bottom[rw.x] = 0x0000; // fix for sky plane drawing crashes - Monster Iestyn 25/05/18 } else #endif if (top_w <= bottom_w) { - ffloor[i].plane->top[rw_x] = (INT16)top_w; - ffloor[i].plane->bottom[rw_x] = (INT16)bottom_w; + ffloor[i].plane->top[rw.x] = (INT16)top_w; + ffloor[i].plane->bottom[rw.x] = (INT16)bottom_w; } } else if (ffloor[i].height > viewz) { - INT32 top_w = ffloor[i].c_clip[rw_x] + 1; + INT32 top_w = ffloor[i].c_clip[rw.x] + 1; INT32 bottom_w = (ffloor[i].f_frac >> HEIGHTBITS); if (top_w < top) @@ -229,15 +217,15 @@ static void R_RenderSegLoop (void) #ifdef POLYOBJECTS_PLANES // Polyobject-specific hack to fix plane leaking -Red if (ffloor[i].polyobj && top_w >= bottom_w) { - ffloor[i].plane->top[rw_x] = 0xFFFF; - ffloor[i].plane->bottom[rw_x] = 0x0000; // fix for sky plane drawing crashes - Monster Iestyn 25/05/18 + ffloor[i].plane->top[rw.x] = 0xFFFF; + ffloor[i].plane->bottom[rw.x] = 0x0000; // fix for sky plane drawing crashes - Monster Iestyn 25/05/18 } else #endif if (top_w <= bottom_w) { - ffloor[i].plane->top[rw_x] = (INT16)top_w; - ffloor[i].plane->bottom[rw_x] = (INT16)bottom_w; + ffloor[i].plane->top[rw.x] = (INT16)top_w; + ffloor[i].plane->bottom[rw.x] = (INT16)bottom_w; } } } @@ -247,22 +235,22 @@ static void R_RenderSegLoop (void) // Done for light lists anyway to avoid doing it for every light. if (segtextured || dc_numlights) { - pindex = FixedMul(rw_scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(rw.scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE-1; } //SoM: Calculate offsets for Thick fake floors. // calculate texture offset - angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT; - texturecolumn = rw_offset-FixedMul(FINETANGENT(angle),rw_distance); + angle = (rw.centerangle + xtoviewangle[rw.x])>>ANGLETOFINESHIFT; + texturecolumn = rw.offset-FixedMul(FINETANGENT(angle),rw.distance); #ifdef ESLOPE if (oldtexturecolumn != -1) { - rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn); - rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn); - rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn-texturecolumn); - rw_midtextureback += FixedMul(rw_midtexturebackslide, oldtexturecolumn-texturecolumn); + rw.bottomtexturemid += FixedMul(rw.bottomtextureslide, oldtexturecolumn-texturecolumn); + rw.midtexturemid += FixedMul(rw.midtextureslide, oldtexturecolumn-texturecolumn); + rw.toptexturemid += FixedMul(rw.toptextureslide, oldtexturecolumn-texturecolumn); + rw.midtextureback += FixedMul(rw.midtexturebackslide, oldtexturecolumn-texturecolumn); } oldtexturecolumn = texturecolumn; #endif @@ -273,8 +261,8 @@ static void R_RenderSegLoop (void) if (segtextured) { dc_colormap = walllights[pindex]; - dc_x = rw_x; - dc_iscale = 0xffffffffu / (unsigned)rw_scale; + dc_x = rw.x; + dc_iscale = 0xffffffffu / (unsigned)rw.scale; if (frontsector->extra_colormap) dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps); @@ -309,7 +297,7 @@ static void R_RenderSegLoop (void) } } - frontscale[rw_x] = rw_scale; + frontscale[rw.x] = rw.scale; // draw the wall tiers if (midtexture) @@ -319,7 +307,7 @@ static void R_RenderSegLoop (void) { dc_yl = yl; dc_yh = yh; - dc_texturemid = rw_midtexturemid; + dc_texturemid = rw.midtexturemid; dc_source = R_GetColumn(midtexture,texturecolumn); dc_texheight = textureheight[midtexture]>>FRACBITS; @@ -340,16 +328,16 @@ static void R_RenderSegLoop (void) // dont draw anything more for this column, since // a midtexture blocks the view - ceilingclip[rw_x] = (INT16)viewheight; - floorclip[rw_x] = -1; + ceilingclip[rw.x] = (INT16)viewheight; + floorclip[rw.x] = -1; } else { // note: don't use min/max macros, since casting from INT32 to INT16 is involved here if (markceiling) - ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + ceilingclip[rw.x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; if (markfloor) - floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + floorclip[rw.x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; } } else @@ -361,31 +349,31 @@ static void R_RenderSegLoop (void) mid = pixhigh>>HEIGHTBITS; pixhigh += pixhighstep; - if (mid >= floorclip[rw_x]) - mid = floorclip[rw_x]-1; + if (mid >= floorclip[rw.x]) + mid = floorclip[rw.x]-1; if (mid >= yl) // back ceiling lower than front ceiling ? { if (yl >= viewheight) // entirely off bottom of screen - ceilingclip[rw_x] = (INT16)viewheight; + ceilingclip[rw.x] = (INT16)viewheight; else if (mid >= 0) // safe to draw top texture { dc_yl = yl; dc_yh = mid; - dc_texturemid = rw_toptexturemid; + dc_texturemid = rw.toptexturemid; dc_source = R_GetColumn(toptexture,texturecolumn); dc_texheight = textureheight[toptexture]>>FRACBITS; colfunc(); - ceilingclip[rw_x] = (INT16)mid; + ceilingclip[rw.x] = (INT16)mid; } else // entirely off top of screen - ceilingclip[rw_x] = -1; + ceilingclip[rw.x] = -1; } else - ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + ceilingclip[rw.x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; } else if (markceiling) // no top wall - ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + ceilingclip[rw.x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; if (bottomtexture) { @@ -394,45 +382,45 @@ static void R_RenderSegLoop (void) pixlow += pixlowstep; // no space above wall? - if (mid <= ceilingclip[rw_x]) - mid = ceilingclip[rw_x]+1; + if (mid <= ceilingclip[rw.x]) + mid = ceilingclip[rw.x]+1; if (mid <= yh) // back floor higher than front floor ? { if (yh < 0) // entirely off top of screen - floorclip[rw_x] = -1; + floorclip[rw.x] = -1; else if (mid < viewheight) // safe to draw bottom texture { dc_yl = mid; dc_yh = yh; - dc_texturemid = rw_bottomtexturemid; + dc_texturemid = rw.bottomtexturemid; dc_source = R_GetColumn(bottomtexture, texturecolumn); dc_texheight = textureheight[bottomtexture]>>FRACBITS; colfunc(); - floorclip[rw_x] = (INT16)mid; + floorclip[rw.x] = (INT16)mid; } else // entirely off bottom of screen - floorclip[rw_x] = (INT16)viewheight; + floorclip[rw.x] = (INT16)viewheight; } else - floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + floorclip[rw.x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; } else if (markfloor) // no bottom wall - floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + floorclip[rw.x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; } if (maskedtexture || numthicksides) { // save texturecol // for backdrawing of masked mid texture - maskedtexturecol[rw_x] = (INT16)texturecolumn; + maskedtexturecol[rw.x] = (INT16)texturecolumn; #ifdef ESLOPE if (maskedtextureheight != NULL) { - maskedtextureheight[rw_x] = (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3) ? - max(rw_midtexturemid, rw_midtextureback) : - min(rw_midtexturemid, rw_midtextureback)); + maskedtextureheight[rw.x] = (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3) ? + max(rw.midtexturemid, rw.midtextureback) : + min(rw.midtexturemid, rw.midtextureback)); } #endif } @@ -452,11 +440,11 @@ static void R_RenderSegLoop (void) for (i = 0; i < numbackffloors; i++) { - ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF); + ffloor[i].f_clip[rw.x] = ffloor[i].c_clip[rw.x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF); ffloor[i].b_frac += ffloor[i].b_step; } - rw_scale += rw_scalestep; + rw.scale += rw.scalestep; topfrac += topstep; bottomfrac += bottomstep; } @@ -520,24 +508,24 @@ static void R_CalculateSegDistance(seg_t *seg, INT64 x2, INT64 y2, boolean longb x = FLOAT_TO_FIXED(ac*(-dy)); y = FLOAT_TO_FIXED(ac*dx); - rw_distance = R_PointToDist(viewx + x, viewy + y); + rw.distance = R_PointToDist(viewx + x, viewy + y); return; } - rw_distance = FLOAT_TO_FIXED(distance); + rw.distance = FLOAT_TO_FIXED(distance); #else (void)longboi; if (!seg->linedef->dy) - rw_distance = (fixed_t)(llabs(y2 - seg->v1->y)); + rw.distance = (fixed_t)(llabs(y2 - seg->v1->y)); else if (!seg->linedef->dx) - rw_distance = (fixed_t)(llabs(x2 - seg->v1->x)); + rw.distance = (fixed_t)(llabs(x2 - seg->v1->x)); else { INT64 dx = (seg->v2->x)-(seg->v1->x); INT64 dy = (seg->v2->y)-(seg->v1->y); INT64 vdx = x2-(seg->v1->x); INT64 vdy = y2-(seg->v1->y); - rw_distance = (fixed_t)(((dy*vdx)-(dx*vdy))/(seg->length)); + rw.distance = (fixed_t)(((dy*vdx)-(dx*vdy))/(seg->length)); } #endif } @@ -550,7 +538,7 @@ static INT32 R_CalculateWallScale(INT32 start, INT32 stop) { INT32 range = 1; - ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]); + ds_p->scale1 = rw.scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]); if (stop > start) { @@ -561,7 +549,7 @@ static INT32 R_CalculateWallScale(INT32 start, INT32 stop) { // UNUSED: try to fix the stretched line bug #if 0 - if (rw_distance < FRACUNIT/2) + if (rw.distance < FRACUNIT/2) { fixed_t tr_x,tr_y; fixed_t gxt,gyt; @@ -578,7 +566,7 @@ static INT32 R_CalculateWallScale(INT32 start, INT32 stop) ds_p->scale2 = ds_p->scale1; } - ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (range); + ds_p->scalestep = rw.scalestep = (ds_p->scale2 - rw.scale) / (range); return range; } @@ -657,14 +645,14 @@ static void R_WorldTopAndBottom(INT32 start, INT32 stop) // // R_WorldSegTextured -// Calculate rw_offset. +// Calculate rw.offset. // Only needed for textured lines. // static void R_WorldSegTextured(fixed_t hyp, boolean longboi) { INT32 lightnum; fixed_t sineval; - angle_t offsetangle = rw_normalangle-rw_angle1; + angle_t offsetangle = rw.normalangle-rw.angle1; if (offsetangle > ANGLE_180) offsetangle = -(signed)offsetangle; @@ -672,7 +660,7 @@ static void R_WorldSegTextured(fixed_t hyp, boolean longboi) offsetangle = ANGLE_90; sineval = FINESINE(offsetangle>>ANGLETOFINESHIFT); - rw_offset = FixedMul(hyp, sineval); + rw.offset = FixedMul(hyp, sineval); // big room fix if (longboi) @@ -681,16 +669,16 @@ static void R_WorldSegTextured(fixed_t hyp, boolean longboi) INT64 dy = (curline->v2->y)-(curline->v1->y); INT64 vdx = viewx-(curline->v1->x); INT64 vdy = viewy-(curline->v1->y); - rw_offset = ((dx*vdx-dy*vdy))/(curline->length); + rw.offset = ((dx*vdx-dy*vdy))/(curline->length); } - if (rw_normalangle-rw_angle1 < ANGLE_180) - rw_offset = -rw_offset; + if (rw.normalangle-rw.angle1 < ANGLE_180) + rw.offset = -rw.offset; /// don't use texture offset for splats - rw_offset2 = rw_offset + curline->offset; - rw_offset += sidedef->textureoffset + curline->offset; - rw_centerangle = ANGLE_90 + viewangle - rw_normalangle; + rw.offset2 = rw.offset + curline->offset; + rw.offset += sidedef->textureoffset + curline->offset; + rw.centerangle = ANGLE_90 + viewangle - rw.normalangle; // calculate light table // use different light tables @@ -734,8 +722,8 @@ static void R_CheckMaskedTextures(void) //markceiling = markfloor = true; maskedtexture = true; - ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x; - lastopening += rw_stopx - rw_x; + ds_p->thicksidecol = maskedtexturecol = lastopening - rw.x; + lastopening += rw.stopx - rw.x; lowcut = max(worldbottom, worldlow) + viewz; highcut = min(worldtop, worldhigh) + viewz; @@ -946,8 +934,8 @@ static void R_CheckMaskedTextures(void) // masked midtexture if (!ds_p->thicksidecol) { - ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x; - lastopening += rw_stopx - rw_x; + ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw.x; + lastopening += rw.stopx - rw.x; } else ds_p->maskedtexturecol = ds_p->thicksidecol; @@ -957,34 +945,34 @@ static void R_CheckMaskedTextures(void) #ifdef POLYOBJECTS if (curline->polyseg) { // use REAL front and back floors please, so midtexture rendering isn't mucked up - rw_midtextureslide = rw_midtexturebackslide = 0; + rw.midtextureslide = rw.midtexturebackslide = 0; if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) - rw_midtexturemid = rw_midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz; + rw.midtexturemid = rw.midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz; else - rw_midtexturemid = rw_midtextureback = min(curline->frontsector->ceilingheight, curline->backsector->ceilingheight) - viewz; + rw.midtexturemid = rw.midtextureback = min(curline->frontsector->ceilingheight, curline->backsector->ceilingheight) - viewz; } else #endif // Set midtexture starting height if (linedef->flags & ML_EFFECT2) { // Ignore slopes when texturing - rw_midtextureslide = rw_midtexturebackslide = 0; + rw.midtextureslide = rw.midtexturebackslide = 0; if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) - rw_midtexturemid = rw_midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; + rw.midtexturemid = rw.midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; else - rw_midtexturemid = rw_midtextureback = min(frontsector->ceilingheight, backsector->ceilingheight) - viewz; + rw.midtexturemid = rw.midtextureback = min(frontsector->ceilingheight, backsector->ceilingheight) - viewz; } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { - rw_midtexturemid = worldbottom; - rw_midtextureslide = floorfrontslide; - rw_midtextureback = worldlow; - rw_midtexturebackslide = floorbackslide; + rw.midtexturemid = worldbottom; + rw.midtextureslide = floorfrontslide; + rw.midtextureback = worldlow; + rw.midtexturebackslide = floorbackslide; } else { - rw_midtexturemid = worldtop; - rw_midtextureslide = ceilingfrontslide; - rw_midtextureback = worldhigh; - rw_midtexturebackslide = ceilingbackslide; + rw.midtexturemid = worldtop; + rw.midtextureslide = ceilingfrontslide; + rw.midtextureback = worldhigh; + rw.midtexturebackslide = ceilingbackslide; } - rw_midtexturemid += sidedef->rowoffset; - rw_midtextureback += sidedef->rowoffset; + rw.midtexturemid += sidedef->rowoffset; + rw.midtextureback += sidedef->rowoffset; #endif maskedtexture = true; @@ -1008,32 +996,32 @@ static void R_CheckWallTextures(void) #ifdef ESLOPE if (linedef->flags & ML_EFFECT2) { if (linedef->flags & ML_DONTPEGBOTTOM) - rw_midtexturemid = frontsector->floorheight + texheight - viewz; + rw.midtexturemid = frontsector->floorheight + texheight - viewz; else - rw_midtexturemid = frontsector->ceilingheight - viewz; + rw.midtexturemid = frontsector->ceilingheight - viewz; } else #endif if (linedef->flags & ML_DONTPEGBOTTOM) { #ifdef ESLOPE - rw_midtexturemid = worldbottom + texheight; - rw_midtextureslide = floorfrontslide; + rw.midtexturemid = worldbottom + texheight; + rw.midtextureslide = floorfrontslide; #else vtop = frontsector->floorheight + texheight; // bottom of texture at bottom - rw_midtexturemid = vtop - viewz; + rw.midtexturemid = vtop - viewz; #endif } else { // top of texture at top - rw_midtexturemid = worldtop; + rw.midtexturemid = worldtop; #ifdef ESLOPE - rw_midtextureslide = ceilingfrontslide; + rw.midtextureslide = ceilingfrontslide; #endif } - rw_midtexturemid += sidedef->rowoffset; + rw.midtexturemid += sidedef->rowoffset; } else { @@ -1066,28 +1054,28 @@ static void R_CheckWallTextures(void) #ifdef ESLOPE if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGTOP) - rw_toptexturemid = frontsector->ceilingheight - viewz; + rw.toptexturemid = frontsector->ceilingheight - viewz; else - rw_toptexturemid = backsector->ceilingheight - viewz; + rw.toptexturemid = backsector->ceilingheight - viewz; } else #endif if (linedef->flags & ML_DONTPEGTOP) { // top of texture at top - rw_toptexturemid = worldtop; + rw.toptexturemid = worldtop; #ifdef ESLOPE - rw_toptextureslide = ceilingfrontslide; + rw.toptextureslide = ceilingfrontslide; #endif } else { #ifdef ESLOPE - rw_toptexturemid = worldhigh + texheight; - rw_toptextureslide = ceilingbackslide; + rw.toptexturemid = worldhigh + texheight; + rw.toptextureslide = ceilingbackslide; #else vtop = backsector->ceilingheight + texheight; // bottom of texture - rw_toptexturemid = vtop - viewz; + rw.toptexturemid = vtop - viewz; #endif } } @@ -1105,30 +1093,30 @@ static void R_CheckWallTextures(void) #ifdef ESLOPE if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGBOTTOM) - rw_bottomtexturemid = frontsector->floorheight - viewz; + rw.bottomtexturemid = frontsector->floorheight - viewz; else - rw_bottomtexturemid = backsector->floorheight - viewz; + rw.bottomtexturemid = backsector->floorheight - viewz; } else #endif if (linedef->flags & ML_DONTPEGBOTTOM) { // bottom of texture at bottom // top of texture at top - rw_bottomtexturemid = worldbottom; + rw.bottomtexturemid = worldbottom; #ifdef ESLOPE - rw_bottomtextureslide = floorfrontslide; + rw.bottomtextureslide = floorfrontslide; #endif } else { // top of texture at top - rw_bottomtexturemid = worldlow; + rw.bottomtexturemid = worldlow; #ifdef ESLOPE - rw_bottomtextureslide = floorbackslide; + rw.bottomtextureslide = floorbackslide; #endif } } - rw_toptexturemid += sidedef->rowoffset; - rw_bottomtexturemid += sidedef->rowoffset; + rw.toptexturemid += sidedef->rowoffset; + rw.bottomtexturemid += sidedef->rowoffset; } } @@ -1397,11 +1385,11 @@ static void R_WorldStep(INT32 range) topfrac = bottomfrac = (centeryfrac>>4); topfrac++; // Prevent 1px HOM } else { - topstep = -FixedMul (rw_scalestep, worldtop); - topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); + topstep = -FixedMul (rw.scalestep, worldtop); + topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw.scale); - bottomstep = -FixedMul (rw_scalestep,worldbottom); - bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); + bottomstep = -FixedMul (rw.scalestep,worldbottom); + bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw.scale); #ifdef ESLOPE if (frontsector->c_slope) { @@ -1435,8 +1423,8 @@ static void R_WorldBackStep(INT32 range) if (toptexture) { - pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale); - pixhighstep = -FixedMul (rw_scalestep,worldhigh); + pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw.scale); + pixhighstep = -FixedMul (rw.scalestep,worldhigh); #ifdef ESLOPE if (backsector->c_slope) { @@ -1448,8 +1436,8 @@ static void R_WorldBackStep(INT32 range) if (bottomtexture) { - pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale); - pixlowstep = -FixedMul (rw_scalestep,worldlow); + pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw.scale); + pixlowstep = -FixedMul (rw.scalestep,worldlow); #ifdef ESLOPE if (backsector->f_slope) { fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2); @@ -1494,7 +1482,7 @@ static void R_WorldBackStep(INT32 range) ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 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 = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; @@ -1517,7 +1505,7 @@ static void R_WorldBackStep(INT32 range) ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 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 = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; @@ -1530,8 +1518,8 @@ static void R_WorldBackStep(INT32 range) { ffloor[i].b_pos = *rover->bottomheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } @@ -1545,8 +1533,8 @@ static void R_WorldBackStep(INT32 range) { ffloor[i].b_pos = *rover->topheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } #endif @@ -1581,7 +1569,7 @@ static void R_WorldBackStep(INT32 range) ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 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 = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; @@ -1604,7 +1592,7 @@ static void R_WorldBackStep(INT32 range) ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 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 = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; @@ -1617,8 +1605,8 @@ static void R_WorldBackStep(INT32 range) { ffloor[i].b_pos = *rover->bottomheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } if (i >= MAXFFLOORS) @@ -1630,8 +1618,8 @@ static void R_WorldBackStep(INT32 range) { ffloor[i].b_pos = *rover->topheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } #endif @@ -1657,8 +1645,8 @@ static void R_WorldBackStep(INT32 range) #endif ffloor[i].b_pos = backsector->floorheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } if (i < numffloors && backsector->ceilingheight >= frontsector->floorheight && @@ -1676,8 +1664,8 @@ static void R_WorldBackStep(INT32 range) #endif ffloor[i].b_pos = backsector->ceilingheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; - ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); - ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = FixedMul(-rw.scalestep, ffloor[i].b_pos); + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw.scale); i++; } } @@ -1714,11 +1702,11 @@ static void R_WorldFFloorStep(INT32 range) else { #ifdef ESLOPE - 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)/(range); #else - 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_step = FixedMul(-rw.scalestep, ffloor[i].f_pos); + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw.scale); #endif } } @@ -1793,12 +1781,12 @@ static void R_WorldLightLists(INT32 range) } #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 = (rlight->heightstep-rlight->height)/(range); #else - rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw_scale); - rlight->heightstep = -FixedMul (rw_scalestep, (light->height - viewz) >> 4); + rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw.scale); + rlight->heightstep = -FixedMul (rw.scalestep, (light->height - viewz) >> 4); #endif rlight->flags = light->flags; @@ -1820,13 +1808,13 @@ static void R_WorldLightLists(INT32 range) leftheight >>= 4; rightheight >>= 4; - 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 = (rlight->botheightstep-rlight->botheight)/(range); #else - rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw_scale); - rlight->botheightstep = -FixedMul (rw_scalestep, (*light->caster->bottomheight - viewz) >> 4); + rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw.scale); + rlight->botheightstep = -FixedMul (rw.scalestep, (*light->caster->bottomheight - viewz) >> 4); #endif } @@ -1851,7 +1839,7 @@ static void R_MarkPlanes(void) if (markceiling) { if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes - ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1); + ceilingplane = R_CheckPlane (ceilingplane, rw.x, rw.stopx-1); else markceiling = false; @@ -1865,7 +1853,7 @@ static void R_MarkPlanes(void) if (markfloor) { if (floorplane) //SoM: 3/29/2000: Check for null planes - floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1); + floorplane = R_CheckPlane (floorplane, rw.x, rw.stopx-1); else markfloor = false; @@ -1885,7 +1873,7 @@ static void R_MarkPlanes(void) for (i = 0; i < numffloors; i++) { ds_p->ffloorplanes[i] = ffloor[i].plane = - R_CheckPlane(ffloor[i].plane, rw_x, rw_stopx - 1); + R_CheckPlane(ffloor[i].plane, rw.x, rw.stopx - 1); } firstseg = ds_p; @@ -1893,7 +1881,7 @@ static void R_MarkPlanes(void) else { for (i = 0; i < numffloors; i++) - R_ExpandPlane(ffloor[i].plane, rw_x, rw_stopx - 1); + R_ExpandPlane(ffloor[i].plane, rw.x, rw.stopx - 1); } #ifdef POLYOBJECTS_PLANES // FIXME hack to fix planes disappearing when a seg goes behind the camera. This NEEDS to be changed to be done properly. -Red @@ -1903,11 +1891,11 @@ static void R_MarkPlanes(void) { if (!ffloor[i].polyobj || ffloor[i].polyobj != curline->polyseg) continue; - if (ffloor[i].plane->minx > rw_x) - ffloor[i].plane->minx = rw_x; + if (ffloor[i].plane->minx > rw.x) + ffloor[i].plane->minx = rw.x; - if (ffloor[i].plane->maxx < rw_stopx - 1) - ffloor[i].plane->maxx = rw_stopx - 1; + if (ffloor[i].plane->maxx < rw.stopx - 1) + ffloor[i].plane->maxx = rw.stopx - 1; } } #endif @@ -1921,7 +1909,7 @@ static void R_MarkPlanes(void) static void R_RemoveOpeningLimits(INT32 start) { size_t pos = lastopening - openings; - size_t need = (rw_stopx - start)*4 + pos; + size_t need = (rw.stopx - start)*4 + pos; if (need > maxopenings) { drawseg_t *ds; //needed for fix from *cough* zdoom *cough* @@ -1994,9 +1982,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) sidedef = curline->sidedef; linedef = curline->linedef; - // calculate rw_distance for scale calculation - rw_normalangle = curline->angle + ANGLE_90; - offsetangle = abs((INT32)(rw_normalangle-rw_angle1)); + // calculate rw.distance for scale calculation + rw.normalangle = curline->angle + ANGLE_90; + offsetangle = abs((INT32)(rw.normalangle-rw.angle1)); if (offsetangle > ANGLE_90) offsetangle = ANGLE_90; @@ -2009,10 +1997,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) // The seg is vertical. if (curline->v1->y == curline->v2->y) - rw_distance = (fixed_t)(llabs(viewy - curline->v1->y)); + rw.distance = (fixed_t)(llabs(viewy - curline->v1->y)); // The seg is horizontal. else if (curline->v1->x == curline->v2->x) - rw_distance = (fixed_t)(llabs(viewx - curline->v1->x)); + rw.distance = (fixed_t)(llabs(viewx - curline->v1->x)); // big room fix #ifdef SOFTWARE_USE_FLOATS else if ((curline->length >= 1024<x1 = rw_x = start; + ds_p->x1 = rw.x = start; ds_p->x2 = stop; ds_p->curline = curline; - rw_stopx = stop+1; + rw.stopx = stop+1; //SoM: Code to remove limits on openings. R_RemoveOpeningLimits(start); @@ -2071,7 +2059,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE // Set up texture Y offset slides for sloped walls - rw_toptextureslide = rw_midtextureslide = rw_bottomtextureslide = 0; + rw.toptextureslide = rw.midtextureslide = rw.bottomtextureslide = 0; ceilingfrontslide = floorfrontslide = ceilingbackslide = floorbackslide = 0; { @@ -2099,7 +2087,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #undef SLOPEPARAMS - // Calculate rw_offset (only needed for textured lines) + // Calculate rw.offset (only needed for textured lines) segtextured = midtexture || toptexture || bottomtexture || maskedtexture || (numthicksides > 0); if (segtextured) R_WorldSegTextured(hyp, longboi); @@ -2173,16 +2161,16 @@ void R_StoreWallRange(INT32 start, INT32 stop) // save sprite clipping info if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip) { - M_Memcpy(lastopening, ceilingclip+start, 2*(rw_stopx - start)); + M_Memcpy(lastopening, ceilingclip+start, 2*(rw.stopx - start)); ds_p->sprtopclip = lastopening - start; - lastopening += rw_stopx - start; + lastopening += rw.stopx - start; } if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip) { - M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx-start)); + M_Memcpy(lastopening, floorclip + start, 2*(rw.stopx-start)); ds_p->sprbottomclip = lastopening - start; - lastopening += rw_stopx - start; + lastopening += rw.stopx - start; } if (maskedtexture && !(ds_p->silhouette & SIL_TOP)) @@ -2292,8 +2280,8 @@ static void R_DrawWallSplats(void) continue; // calculate incremental stepping values for texture edges - rw_scalestep = ds_p->scalestep; - spryscale = ds_p->scale1 + (x1 - ds_p->x1)*rw_scalestep; + rw.scalestep = ds_p->scalestep; + spryscale = ds_p->scale1 + (x1 - ds_p->x1)*rw.scalestep; mfloorclip = floorclip; mceilingclip = ceilingclip; @@ -2329,7 +2317,7 @@ static void R_DrawWallSplats(void) dc_texheight = 0; // draw the columns - for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw_scalestep) + for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw.scalestep) { pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) @@ -2343,9 +2331,9 @@ static void R_DrawWallSplats(void) dc_iscale = 0xffffffffu / (unsigned)spryscale; // find column of patch, from perspective - angle = (rw_centerangle + xtoviewangle[dc_x])>>ANGLETOFINESHIFT; - texturecolumn = rw_offset2 - splat->offset - - FixedMul(FINETANGENT(angle), rw_distance); + angle = (rw.centerangle + xtoviewangle[dc_x])>>ANGLETOFINESHIFT; + texturecolumn = rw.offset2 - splat->offset + - FixedMul(FINETANGENT(angle), rw.distance); // FIXME! texturecolumn >>= FRACBITS; @@ -2483,8 +2471,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) #ifdef ESLOPE range = max(ds->x2-ds->x1, 1); #endif - rw_scalestep = ds->scalestep; - spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + rw.scalestep = ds->scalestep; + spryscale = ds->scale1 + (x1 - ds->x1)*rw.scalestep; // Texture must be cached before setting colfunc_2s, // otherwise texture[texnum]->holes may be false when it shouldn't be @@ -2542,7 +2530,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) //rlight->height -= (x1 - ds->x1)*rlight->heightstep; #else rlight->height = (centeryfrac) - FixedMul((light->height - viewz), spryscale); - rlight->heightstep = -FixedMul(rw_scalestep, (light->height - viewz)); + rlight->heightstep = -FixedMul(rw.scalestep, (light->height - viewz)); #endif rlight->startheight = rlight->height; // keep starting value here to reset for each repeat rlight->lightlevel = *light->lightlevel; @@ -2636,8 +2624,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { if (times > 0) { - rw_scalestep = ds->scalestep; - spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + rw.scalestep = ds->scalestep; + spryscale = ds->scale1 + (x1 - ds->x1)*rw.scalestep; if (dc_numlights) { // reset all lights to their starting heights for (i = 0; i < dc_numlights; i++) @@ -2699,7 +2687,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rlight->height += rlight->heightstep; } } - spryscale += rw_scalestep; + spryscale += rw.scalestep; continue; } @@ -2770,7 +2758,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (windowtop < windowbottom) colfunc_2s(col); - spryscale += rw_scalestep; + spryscale += rw.scalestep; continue; } @@ -2847,7 +2835,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) #endif colfunc_2s(col); } - spryscale += rw_scalestep; + spryscale += rw.scalestep; } } colfunc = colfuncs[BASEDRAWFUNC]; @@ -2968,8 +2956,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) range = max(ds->x2-ds->x1, 1); #endif //SoM: Moved these up here so they are available for my lightlist calculations - rw_scalestep = ds->scalestep; - spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + rw.scalestep = ds->scalestep; + spryscale = ds->scale1 + (x1 - ds->x1)*rw.scalestep; dc_numlights = 0; if (frontsector->numlights) @@ -3039,7 +3027,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) continue; lheight = light->height;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : light->height; - rlight->heightstep = -FixedMul (rw_scalestep, (lheight - viewz)); + rlight->heightstep = -FixedMul (rw.scalestep, (lheight - viewz)); rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale); #endif rlight->flags = light->flags; @@ -3064,7 +3052,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range); #else lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight; - rlight->botheightstep = -FixedMul (rw_scalestep, (lheight - viewz)); + rlight->botheightstep = -FixedMul (rw.scalestep, (lheight - viewz)); rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale); #endif } @@ -3284,7 +3272,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rlight->botheight += rlight->botheightstep; } } - spryscale += rw_scalestep; + spryscale += rw.scalestep; continue; } @@ -3407,7 +3395,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (windowtop < windowbottom) colfunc_2s (col); - spryscale += rw_scalestep; + spryscale += rw.scalestep; continue; } @@ -3426,7 +3414,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // draw the texture colfunc_2s (col); - spryscale += rw_scalestep; + spryscale += rw.scalestep; } } colfunc = colfuncs[BASEDRAWFUNC]; diff --git a/src/r_state.h b/src/r_state.h index 75566923b..8211ac75a 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -93,10 +93,23 @@ extern angle_t doubleclipangle; extern INT32 viewangletox[FINEANGLES/2]; extern angle_t xtoviewangle[MAXVIDWIDTH+1]; -extern fixed_t rw_distance; -extern angle_t rw_normalangle; - -// angle to line origin -extern angle_t rw_angle1; +// Wall rendering +typedef struct +{ + INT32 x, stopx; + angle_t centerangle; + fixed_t offset; + fixed_t offset2; // for splats + fixed_t scale, scalestep; + fixed_t midtexturemid, toptexturemid, bottomtexturemid; +#ifdef ESLOPE + fixed_t toptextureslide, midtextureslide, bottomtextureslide; // Defines how to adjust Y offsets along the wall for slopes + fixed_t midtextureback, midtexturebackslide; // Values for masked midtexture height calculation +#endif + fixed_t distance; + angle_t normalangle; + angle_t angle1; // angle to line origin +} renderwall_t; +extern renderwall_t rw; #endif