// // FWallCoords :: Init // // Transform and clip coordinates. Returns true if it was clipped away // bool FWallCoords::Init(int x1, int y1, int x2, int y2, int too_close) { tx1 = DMulScale20(x1, viewsin, -y1, viewcos); tx2 = DMulScale20(x2, viewsin, -y2, viewcos); ty1 = DMulScale20(x1, viewtancos, y1, viewtansin); ty2 = DMulScale20(x2, viewtancos, y2, viewtansin); if (MirrorFlags & RF_XFLIP) { int t = 256 - tx1; tx1 = 256 - tx2; tx2 = t; swapvalues(ty1, ty2); } if (tx1 >= -ty1) { if (tx1 > ty1) return true; // left edge is off the right side if (ty1 == 0) return true; sx1 = (centerxfrac + Scale(tx1, centerxfrac, ty1)) >> FRACBITS; if (tx1 >= 0) sx1 = MIN(viewwidth, sx1+1); // fix for signed divide sz1 = ty1; } else { if (tx2 < -ty2) return true; // wall is off the left side
void R_AddLine (seg_t *line) { static sector_t tempsec; // killough 3/8/98: ceiling/water hack bool solid; fixed_t tx1, tx2, ty1, ty2; curline = line; // [RH] Color if not texturing line dc_color = (((int)(line - segs) * 8) + 4) & 255; tx1 = line->v1->x - viewx; tx2 = line->v2->x - viewx; ty1 = line->v1->y - viewy; ty2 = line->v2->y - viewy; // Reject lines not facing viewer if (DMulScale32 (ty1, tx1-tx2, tx1, ty2-ty1) >= 0) return; WallTX1 = DMulScale20 (tx1, viewsin, -ty1, viewcos); WallTX2 = DMulScale20 (tx2, viewsin, -ty2, viewcos); WallTY1 = DMulScale20 (tx1, viewtancos, ty1, viewtansin); WallTY2 = DMulScale20 (tx2, viewtancos, ty2, viewtansin); if (MirrorFlags & RF_XFLIP) { int t = 256-WallTX1; WallTX1 = 256-WallTX2; WallTX2 = t; swap (WallTY1, WallTY2); } if (WallTX1 >= -WallTY1) { if (WallTX1 > WallTY1) return; // left edge is off the right side if (WallTY1 == 0) return; WallSX1 = (centerxfrac + Scale (WallTX1, centerxfrac, WallTY1)) >> FRACBITS; if (WallTX1 >= 0) WallSX1 = MIN (viewwidth, WallSX1+1); // fix for signed divide WallSZ1 = WallTY1; } else { if (WallTX2 < -WallTY2) return; // wall is off the left side