mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Hack that fixes software drop shadow crashes by bypassing incorrectly set variables
This commit is contained in:
parent
e8c83f48be
commit
a8fe12ae98
3 changed files with 40 additions and 0 deletions
|
@ -170,6 +170,7 @@ void R_DrawViewBorder(void);
|
|||
void R_DrawColumn_8(void);
|
||||
void R_DrawShadeColumn_8(void);
|
||||
void R_DrawTranslucentColumn_8(void);
|
||||
void R_DrawDropShadowColumn_8(void);
|
||||
void R_DrawTranslatedColumn_8(void);
|
||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||
void R_Draw2sMultiPatchColumn_8(void);
|
||||
|
|
|
@ -416,6 +416,39 @@ void R_DrawTranslucentColumn_8(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture
|
||||
// data since something about calculating the texture reading address for drop shadows is broken.
|
||||
// dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly
|
||||
// needed for the current design of the shadows, so this function bypasses the issue
|
||||
// by not using those variables at all.
|
||||
void R_DrawDropShadowColumn_8(void)
|
||||
{
|
||||
register INT32 count;
|
||||
register UINT8 *dest;
|
||||
|
||||
count = dc_yh - dc_yl + 1;
|
||||
|
||||
if (count <= 0) // Zero length, column does not exceed a pixel.
|
||||
return;
|
||||
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
|
||||
{
|
||||
#define DSCOLOR 31 // palette index for the color of the shadow
|
||||
register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[DSCOLOR] << 8);
|
||||
#undef DSCOLOR
|
||||
while ((count -= 2) >= 0)
|
||||
{
|
||||
*dest = *(transmap_offset + (*dest));
|
||||
dest += vid.width;
|
||||
*dest = *(transmap_offset + (*dest));
|
||||
dest += vid.width;
|
||||
}
|
||||
if (count & 1)
|
||||
*dest = *(transmap_offset + (*dest));
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief The R_DrawTranslatedTranslucentColumn_8 function
|
||||
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
|
||||
Uber-kudos to Cyan Helkaraxe
|
||||
|
|
|
@ -837,6 +837,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
|
||||
colfunc = colfuncs[COLDRAWFUNC_TRANS];
|
||||
|
||||
// Hack: Use a special column function for drop shadows that bypasses
|
||||
// invalid memory access crashes caused by R_ProjectDropShadow putting wrong values
|
||||
// in dc_texturemid and dc_iscale when the shadow is sloped.
|
||||
if (vis->cut & SC_SHADOW)
|
||||
colfunc = R_DrawDropShadowColumn_8;
|
||||
|
||||
if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS))
|
||||
{
|
||||
if (!dc_colormap)
|
||||
|
|
Loading…
Reference in a new issue