From 3644d4d883a3ee787546f439617ced579722a811 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 30 Apr 2015 00:41:29 -0500 Subject: [PATCH] Minor code cleanup around renderer gunk (Who let that silhouette == 1/etc thing sit there all those years? :V) --- src/r_segs.c | 33 ++++----------------------------- src/r_things.c | 6 +++--- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 6c8c95c49..5465e0d07 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1512,27 +1512,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) // Figure out map coordinates of where start and end are mapping to on seg, so we can clip right for slope bullshit if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) { angle_t temp; - fixed_t tan; // left temp = xtoviewangle[start]+viewangle; - /*if (curline->v1->x == curline->v2->x) { - // Line seg is vertical, so no line-slope form for it - tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); - - segleft.x = curline->v1->x; - - segleft.y = curline->v1->y-FixedMul(viewx-segleft.x, tan); - } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { - // Same problem as above, except this time with the view angle - tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); - - segleft.x = viewx; - segleft.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else */{ + { // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to FPU a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); @@ -1551,22 +1538,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) // right temp = xtoviewangle[stop]+viewangle; - /*if (curline->v1->x == curline->v2->x) { - // Line seg is vertical, so no line-slope form for it - tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); - - segright.x = curline->v1->x; - - segright.y = curline->v1->y-FixedMul(viewx-segright.x, tan); - } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { - // Same problem as above, except this time with the view angle - tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); - - segright.x = viewx; - segright.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else */{ + { // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to FPU a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); diff --git a/src/r_things.c b/src/r_things.c index f1b2e7199..a759dd1d0 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2030,21 +2030,21 @@ void R_ClipSprites(void) if (spr->gzt <= ds->tsilheight) silhouette &= ~SIL_TOP; - if (silhouette == 1) + if (silhouette == SIL_BOTTOM) { // bottom sil for (x = r1; x <= r2; x++) if (spr->clipbot[x] == -2) spr->clipbot[x] = ds->sprbottomclip[x]; } - else if (silhouette == 2) + else if (silhouette == SIL_TOP) { // top sil for (x = r1; x <= r2; x++) if (spr->cliptop[x] == -2) spr->cliptop[x] = ds->sprtopclip[x]; } - else if (silhouette == 3) + else if (silhouette == (SIL_TOP|SIL_BOTTOM)) { // both for (x = r1; x <= r2; x++)