@@ -862,21 +862,18 @@ void R_DrawSprite (vissprite_t* spr)
862862 int r2;
863863 fixed_t scale;
864864 fixed_t lowscale;
865- int silhouette;
866865
867866 for (x = spr->x1 ; x<=spr->x2 ; x++)
868867 clipbot[x] = cliptop[x] = -2 ;
869868
870869 // Scan drawsegs from end to start for obscuring segs.
871870 // The first drawseg that has a greater scale
872871 // is the clip seg.
873- for (ds=ds_p- 1 ; ds >= drawsegs ; ds-- )
872+ for (ds = ds_p ; ds-- > drawsegs; )
874873 {
875874 // determine if the drawseg obscures the sprite
876- if (ds->x1 > spr->x2
877- || ds->x2 < spr->x1
878- || (!ds->silhouette
879- && !ds->maskedtexturecol ) )
875+ if (ds->x1 > spr->x2 || ds->x2 < spr->x1 ||
876+ (!ds->silhouette && !ds->maskedtexturecol ))
880877 {
881878 // does not cover sprite
882879 continue ;
@@ -909,35 +906,15 @@ void R_DrawSprite (vissprite_t* spr)
909906
910907
911908 // clip this piece of the sprite
912- silhouette = ds->silhouette ;
913-
914- if (spr->gz >= ds->bsilheight )
915- silhouette &= ~SIL_BOTTOM;
916-
917- if (spr->gzt <= ds->tsilheight )
918- silhouette &= ~SIL_TOP;
919-
920- if (silhouette == 1 )
921- {
922- // bottom sil
923- for (x=r1 ; x<=r2 ; x++)
909+ if (ds->silhouette & SIL_BOTTOM && spr->gz < ds->bsilheight ) { // bottom sil
910+ for (x = r1 ; x <= r2 ; x++) {
924911 if (clipbot[x] == -2 )
925912 clipbot[x] = ds->sprbottomclip [x];
913+ }
926914 }
927- else if (silhouette == 2 )
928- {
929- // top sil
930- for (x=r1 ; x<=r2 ; x++)
931- if (cliptop[x] == -2 )
932- cliptop[x] = ds->sprtopclip [x];
933- }
934- else if (silhouette == 3 )
935- {
936- // both
937- for (x=r1 ; x<=r2 ; x++)
938- {
939- if (clipbot[x] == -2 )
940- clipbot[x] = ds->sprbottomclip [x];
915+
916+ if (ds->silhouette & SIL_TOP && spr->gzt > ds->tsilheight ) { // top sil
917+ for (x = r1 ; x <= r2 ; x++) {
941918 if (cliptop[x] == -2 )
942919 cliptop[x] = ds->sprtopclip [x];
943920 }
@@ -988,9 +965,10 @@ void R_DrawMasked (void)
988965 }
989966
990967 // render any remaining masked mid textures
991- for (ds=ds_p- 1 ; ds >= drawsegs ; ds--)
968+ for (ds = ds_p ; ds-- > drawsegs; ) {
992969 if (ds->maskedtexturecol )
993970 R_RenderMaskedSegRange (ds, ds->x1 , ds->x2 );
971+ }
994972
995973 // draw the psprites on top of everything
996974 // but does not draw on side views
0 commit comments