shithub: choc

Download patch

ref: d1fc5eb5e8e11fa231383a2aa02d275429b06dfa
parent: 471b912a41d283f28b5fec6382adbdc13251fa8d
author: Samuel Villareal <[email protected]>
date: Mon Sep 6 19:18:42 EDT 2010

+ Vissprite clipping for MF_FEETCLIPPED flag

Subversion-branch: /branches/strife-branch
Subversion-revision: 2027

--- a/src/strife/r_segs.c
+++ b/src/strife/r_segs.c
@@ -182,7 +182,8 @@
 	    col = (column_t *)( 
 		(byte *)R_GetColumn(texnum,maskedtexturecol[dc_x]) -3);
 			
-	    R_DrawMaskedColumn (col);
+            // villsa [STRIFE] added 0 argument
+	    R_DrawMaskedColumn (col, 0);
 	    maskedtexturecol[dc_x] = SHRT_MAX;
 	}
 	spryscale += rw_scalestep;
--- a/src/strife/r_things.c
+++ b/src/strife/r_things.c
@@ -289,6 +289,7 @@
 vissprite_t	vissprites[MAXVISSPRITES];
 vissprite_t*	vissprite_p;
 int		newvissprite;
+int             sprbotscreen;       // villsa [STRIFE]
 
 
 
@@ -348,7 +349,8 @@
 fixed_t		spryscale;
 fixed_t		sprtopscreen;
 
-void R_DrawMaskedColumn (column_t* column)
+// villsa [STRIFE] new baseclip argument
+void R_DrawMaskedColumn (column_t *column, int baseclip)
 {
     int		topscreen;
     int 	bottomscreen;
@@ -371,6 +373,13 @@
 	if (dc_yl <= mceilingclip[dc_x])
 	    dc_yl = mceilingclip[dc_x]+1;
 
+        // villsa [STRIFE] checks for clipping
+        if(baseclip)
+        {
+            if(dc_yh > baseclip)
+                dc_yh = baseclip;
+        }
+
 	if (dc_yl <= dc_yh)
 	{
 	    dc_source = (byte *)column + 3;
@@ -403,6 +412,7 @@
     int			texturecolumn;
     fixed_t		frac;
     patch_t*		patch;
+    int                 clip;   // villsa [STRIFE]
 	
 	
     patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE);
@@ -427,6 +437,15 @@
     frac = vis->startfrac;
     spryscale = vis->scale;
     sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
+
+    // villsa [STRIFE] clip sprite's feet if needed
+    if(vis->mobjflags & MF_FEETCLIPPED)
+    {
+        sprbotscreen = sprtopscreen + FixedMul(spryscale, patch->height<<FRACBITS);
+        clip = (sprbotscreen - FixedMul(10*FRACUNIT, spryscale)) >> FRACBITS;
+    }
+    else
+        clip = 0;
 	
     for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale)
     {
@@ -437,7 +456,7 @@
 #endif
 	column = (column_t *) ((byte *)patch +
 			       LONG(patch->columnofs[texturecolumn]));
-	R_DrawMaskedColumn (column);
+	R_DrawMaskedColumn (column, clip);  // villsa [STRIFE] clip argument
     }
 
     colfunc = basecolfunc;
--- a/src/strife/r_things.h
+++ b/src/strife/r_things.h
@@ -51,7 +51,8 @@
 extern fixed_t		pspriteiscale;
 
 
-void R_DrawMaskedColumn (column_t* column);
+// villsa [STIFE] new argument
+void R_DrawMaskedColumn (column_t *column, int baseclip);
 
 
 void R_SortVisSprites (void);