summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/r_segs.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom/r_segs.c')
-rw-r--r--apps/plugins/doom/r_segs.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/apps/plugins/doom/r_segs.c b/apps/plugins/doom/r_segs.c
index 4771132c77..8d38e4bd5f 100644
--- a/apps/plugins/doom/r_segs.c
+++ b/apps/plugins/doom/r_segs.c
@@ -95,18 +95,19 @@ static short *maskedtexturecol;
95// rw_distance must be calculated first. 95// rw_distance must be calculated first.
96// 96//
97// killough 5/2/98: reformatted, cleaned up 97// killough 5/2/98: reformatted, cleaned up
98static fixed_t R_ScaleFromGlobalAngle (angle_t visangle) 98// CPhipps - moved here from r_main.c
99
100static fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
99{ 101{
100 int anglea = ANG90 + (visangle-viewangle); 102 int anglea = ANG90 + (visangle-viewangle);
101 int angleb = ANG90 + (visangle-rw_normalangle); 103 int angleb = ANG90 + (visangle-rw_normalangle);
102 int sinea = finesine[anglea>>ANGLETOFINESHIFT]; 104 int den = FixedMul(rw_distance, finesine[anglea>>ANGLETOFINESHIFT]);
103 int sineb = finesine[angleb>>ANGLETOFINESHIFT]; 105 // proff 11/06/98: Changed for high-res
104 fixed_t num = FixedMul(projection,sineb); 106 fixed_t num = FixedMul(projectiony, finesine[angleb>>ANGLETOFINESHIFT]);
105 int den = FixedMul(rw_distance,sinea); 107 return den > num>>16 ? (num = FixedDiv(num, den)) > 64*FRACUNIT ?
106 108 64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT;
107 return den > num>>16 ? (num=FixedDiv (num, den)) > 64*FRACUNIT ?
108 64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT ;
109} 109}
110
110// 111//
111// R_RenderMaskedSegRange 112// R_RenderMaskedSegRange
112// 113//
@@ -146,11 +147,12 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
146 147
147 // killough 4/13/98: get correct lightlevel for 2s normal textures 148 // killough 4/13/98: get correct lightlevel for 2s normal textures
148 lightnum = (R_FakeFlat(frontsector, &tempsec, NULL, NULL, false) 149 lightnum = (R_FakeFlat(frontsector, &tempsec, NULL, NULL, false)
149 ->lightlevel >> LIGHTSEGSHIFT)+extralight; 150 ->lightlevel >> LIGHTSEGSHIFT)+extralight;
150 151
151 /* cph - ...what is this for? adding contrast to rooms? 152 /* cph - ...what is this for? adding contrast to rooms?
152 * It looks crap in outdoor areas */ 153 * It looks crap in outdoor areas */
153 if (fake_contrast) { 154 if (fake_contrast)
155 {
154 if (curline->v1->y == curline->v2->y) 156 if (curline->v1->y == curline->v2->y)
155 lightnum--; 157 lightnum--;
156 else 158 else
@@ -402,8 +404,10 @@ static void R_RenderSegLoop (void)
402 // cph - if we completely blocked further sight through this column, 404 // cph - if we completely blocked further sight through this column,
403 // add this info to the solid columns array for r_bsp.c 405 // add this info to the solid columns array for r_bsp.c
404 if ((markceiling || markfloor) && 406 if ((markceiling || markfloor) &&
405 (floorclip[rw_x] <= ceilingclip[rw_x] + 1)) { 407 (floorclip[rw_x] <= ceilingclip[rw_x] + 1))
406 solidcol[rw_x] = 1; didsolidcol = 1; 408 {
409 solidcol[rw_x] = 1;
410 didsolidcol = 1;
407 } 411 }
408 412
409 // save texturecol for backdrawing of masked mid texture 413 // save texturecol for backdrawing of masked mid texture
@@ -460,6 +464,7 @@ void R_StoreWallRange(const int start, const int stop)
460 464
461 465
462#ifdef RANGECHECK 466#ifdef RANGECHECK
467
463 if (start >=viewwidth || start > stop) 468 if (start >=viewwidth || start > stop)
464 I_Error ("Bad R_RenderWallRange: %i to %i", start , stop); 469 I_Error ("Bad R_RenderWallRange: %i to %i", start , stop);
465#endif 470#endif
@@ -574,7 +579,8 @@ void R_StoreWallRange(const int start, const int stop)
574 ds_p->sprtopclip = ds_p->sprbottomclip = NULL; 579 ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
575 ds_p->silhouette = 0; 580 ds_p->silhouette = 0;
576 581
577 if (linedef->r_flags & RF_CLOSED) { /* cph - closed 2S line e.g. door */ 582 if (linedef->r_flags & RF_CLOSED)
583 { /* cph - closed 2S line e.g. door */
578 // cph - killough's (outdated) comment follows - this deals with both 584 // cph - killough's (outdated) comment follows - this deals with both
579 // "automap fixes", his and mine 585 // "automap fixes", his and mine
580 // killough 1/17/98: this test is required if the fix 586 // killough 1/17/98: this test is required if the fix
@@ -589,7 +595,9 @@ void R_StoreWallRange(const int start, const int stop)
589 ds_p->sprtopclip = screenheightarray; 595 ds_p->sprtopclip = screenheightarray;
590 ds_p->tsilheight = INT_MIN; 596 ds_p->tsilheight = INT_MIN;
591 597
592 } else { /* not solid - old code */ 598 }
599 else
600 { /* not solid - old code */
593 601
594 if (frontsector->floorheight > backsector->floorheight) 602 if (frontsector->floorheight > backsector->floorheight)
595 { 603 {
@@ -721,7 +729,8 @@ void R_StoreWallRange(const int start, const int stop)
721 729
722 /* cph - ...what is this for? adding contrast to rooms? 730 /* cph - ...what is this for? adding contrast to rooms?
723 * It looks crap in outdoor areas */ 731 * It looks crap in outdoor areas */
724 if (fake_contrast) { 732 if (fake_contrast)
733 {
725 if (curline->v1->y == curline->v2->y) 734 if (curline->v1->y == curline->v2->y)
726 lightnum--; 735 lightnum--;
727 else if (curline->v1->x == curline->v2->x) 736 else if (curline->v1->x == curline->v2->x)
@@ -778,14 +787,16 @@ void R_StoreWallRange(const int start, const int stop)
778 } 787 }
779 788
780 // render it 789 // render it
781 if (markceiling) { 790 if (markceiling)
791 {
782 if (ceilingplane) // killough 4/11/98: add NULL ptr checks 792 if (ceilingplane) // killough 4/11/98: add NULL ptr checks
783 ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1); 793 ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
784 else 794 else
785 markceiling = 0; 795 markceiling = 0;
786 } 796 }
787 797
788 if (markfloor) { 798 if (markfloor)
799 {
789 if (floorplane) // killough 4/11/98: add NULL ptr checks 800 if (floorplane) // killough 4/11/98: add NULL ptr checks
790 /* cph 2003/04/18 - ceilingplane and floorplane might be the same 801 /* cph 2003/04/18 - ceilingplane and floorplane might be the same
791 * visplane (e.g. if both skies); R_CheckPlane doesn't know about 802 * visplane (e.g. if both skies); R_CheckPlane doesn't know about
@@ -805,12 +816,15 @@ void R_StoreWallRange(const int start, const int stop)
805 R_RenderSegLoop(); 816 R_RenderSegLoop();
806 817
807 /* cph - if a column was made solid by this wall, we _must_ save full clipping info */ 818 /* cph - if a column was made solid by this wall, we _must_ save full clipping info */
808 if (backsector && didsolidcol) { 819 if (backsector && didsolidcol)
809 if (!(ds_p->silhouette & SIL_BOTTOM)) { 820 {
821 if (!(ds_p->silhouette & SIL_BOTTOM))
822 {
810 ds_p->silhouette |= SIL_BOTTOM; 823 ds_p->silhouette |= SIL_BOTTOM;
811 ds_p->bsilheight = backsector->floorheight; 824 ds_p->bsilheight = backsector->floorheight;
812 } 825 }
813 if (!(ds_p->silhouette & SIL_TOP)) { 826 if (!(ds_p->silhouette & SIL_TOP))
827 {
814 ds_p->silhouette |= SIL_TOP; 828 ds_p->silhouette |= SIL_TOP;
815 ds_p->tsilheight = backsector->ceilingheight; 829 ds_p->tsilheight = backsector->ceilingheight;
816 } 830 }