From d1fc5eb5e8e11fa231383a2aa02d275429b06dfa Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Mon, 6 Sep 2010 23:18:42 +0000 Subject: + Vissprite clipping for MF_FEETCLIPPED flag Subversion-branch: /branches/strife-branch Subversion-revision: 2027 --- src/strife/r_segs.c | 3 ++- src/strife/r_things.c | 23 +++++++++++++++++++++-- src/strife/r_things.h | 3 ++- 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src/strife') diff --git a/src/strife/r_segs.c b/src/strife/r_segs.c index 29ed32a5..d6e5e156 100644 --- a/src/strife/r_segs.c +++ b/src/strife/r_segs.c @@ -182,7 +182,8 @@ R_RenderMaskedSegRange 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; diff --git a/src/strife/r_things.c b/src/strife/r_things.c index 45b71915..a13f355b 100644 --- a/src/strife/r_things.c +++ b/src/strife/r_things.c @@ -289,6 +289,7 @@ void R_InitSpriteDefs (char** namelist) vissprite_t vissprites[MAXVISSPRITES]; vissprite_t* vissprite_p; int newvissprite; +int sprbotscreen; // villsa [STRIFE] @@ -348,7 +349,8 @@ short* mceilingclip; 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 @@ void R_DrawMaskedColumn (column_t* column) 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 @@ R_DrawVisSprite int texturecolumn; fixed_t frac; patch_t* patch; + int clip; // villsa [STRIFE] patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE); @@ -427,6 +437,15 @@ R_DrawVisSprite 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; + } + else + clip = 0; for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale) { @@ -437,7 +456,7 @@ R_DrawVisSprite #endif column = (column_t *) ((byte *)patch + LONG(patch->columnofs[texturecolumn])); - R_DrawMaskedColumn (column); + R_DrawMaskedColumn (column, clip); // villsa [STRIFE] clip argument } colfunc = basecolfunc; diff --git a/src/strife/r_things.h b/src/strife/r_things.h index d0fce4e4..0e160f01 100644 --- a/src/strife/r_things.h +++ b/src/strife/r_things.h @@ -51,7 +51,8 @@ extern fixed_t pspritescale; 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); -- cgit v1.2.3