Skip to content

Commit

Permalink
Heretic: small visual improvements (#1117)
Browse files Browse the repository at this point in the history
* Weapons drawn 1 pixel too high when player is idle

This approach is same to Crispy Doom, and it's working as it should.

* Fix 1px gap between translucent PSPrite and STbar

Same approach as in R_DrawFuzzColumn.

* Allow translucent weapons to be affected by invul colormap

* Better approach for fixing gap between translucent weapon and status bar

Co-Authored-By: ceski <[email protected]>

* Remove redundant changes

* Interpolate scrolling flats

Adopted from commit:
0ab96c0#diff-385affd7076e37a2aa4b0e489fff3bbe8a4ee5fff3cc62f41655c4ee9d92457e

Co-Authored-By: Michael Day <[email protected]>

---------

Co-authored-by: ceski <[email protected]>
Co-authored-by: Michael Day <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2023
1 parent 8618898 commit dcb8585
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/heretic/r_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,13 @@ void R_DrawTLColumn(void)
fixed_t frac, fracstep;
int heightmask = dc_texheight - 1; // [crispy]

// [crispy] Show transparent lines at top and bottom of screen.
/*
if (!dc_yl)
dc_yl = 1;
if (dc_yh == viewheight - 1)
dc_yh = viewheight - 2;
*/

count = dc_yh - dc_yl;
if (count < 0)
Expand Down
41 changes: 41 additions & 0 deletions src/heretic/r_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ fixed_t cacheddistance[MAXHEIGHT];
fixed_t cachedxstep[MAXHEIGHT];
fixed_t cachedystep[MAXHEIGHT];

static fixed_t xsmoothscrolloffset; // [crispy]

Check warning on line 77 in src/heretic/r_plane.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

/src/heretic/r_plane.c:77:16 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'xsmoothscrolloffset' is non-const and globally accessible, consider making it const
static fixed_t ysmoothscrolloffset; // [crispy]

Check warning on line 78 in src/heretic/r_plane.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

/src/heretic/r_plane.c:78:16 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'ysmoothscrolloffset' is non-const and globally accessible, consider making it const

/*
================
Expand Down Expand Up @@ -169,6 +171,10 @@ void R_MapPlane(int y, int x1, int x2)
ds_xfrac = viewx + FixedMul(viewcos, distance) + dx * ds_xstep;
ds_yfrac = -viewy - FixedMul(viewsin, distance) + dx * ds_ystep;

// [crispy] add smooth scroll offsets
ds_xfrac += xsmoothscrolloffset;
ds_yfrac += ysmoothscrolloffset;

if (fixedcolormap)
ds_colormap[0] = ds_colormap[1] = fixedcolormap;
else
Expand Down Expand Up @@ -409,6 +415,8 @@ void R_MakeSpans(int x, unsigned int t1, unsigned int b1, unsigned int t2, unsig
================
*/

extern fixed_t fractionaltic; // [crispy]

Check warning on line 418 in src/heretic/r_plane.c

View workflow job for this annotation

GitHub Actions / cpp-linter (clang)

/src/heretic/r_plane.c:418:16 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'fractionaltic' is non-const and globally accessible, consider making it const

#define SKYTEXTUREMIDSHIFTED 200 // [crispy]

void R_DrawPlanes(void)
Expand All @@ -425,6 +433,7 @@ void R_DrawPlanes(void)
int count;
fixed_t frac, fracstep;
int heightmask; // [crispy]
static int interpfactor; // [crispy]

#ifdef RANGECHECK
if (ds_p - drawsegs > numdrawsegs)
Expand Down Expand Up @@ -552,20 +561,44 @@ void R_DrawPlanes(void)

tempSource = W_CacheLumpNum(lumpnum, PU_STATIC);

// [crispy] Use old value of interpfactor if uncapped and paused. This
// ensures that scrolling stops smoothly when pausing.
if (crispy->uncapped && leveltime > oldleveltime)
{
// [crispy] Scrolling normally advances every *other* gametic, so
// interpolation needs to span two tics
if (leveltime & 1)
{
interpfactor = (FRACUNIT + fractionaltic) >> 1;
}
else
{
interpfactor = fractionaltic >> 1;
}
}
else if (!crispy->uncapped)
{
interpfactor = 0;
}

switch (pl->special)
{
case 25:
case 26:
case 27:
case 28:
case 29: // Scroll_North
xsmoothscrolloffset = 0;
ysmoothscrolloffset = 0;
ds_source = tempSource;
break;
case 20:
case 21:
case 22:
case 23:
case 24: // Scroll_East
xsmoothscrolloffset = -(interpfactor << (pl->special - 20));
ysmoothscrolloffset = 0;
ds_source = tempSource + ((63 - ((leveltime >> 1) & 63)) <<
(pl->special - 20) & 63);
//ds_source = tempSource+((leveltime>>1)&63);
Expand All @@ -575,20 +608,28 @@ void R_DrawPlanes(void)
case 32:
case 33:
case 34: // Scroll_South
xsmoothscrolloffset = 0;
ysmoothscrolloffset = 0;
ds_source = tempSource;
break;
case 35:
case 36:
case 37:
case 38:
case 39: // Scroll_West
xsmoothscrolloffset = 0;
ysmoothscrolloffset = 0;
ds_source = tempSource;
break;
case 4: // Scroll_EastLavaDamage
xsmoothscrolloffset = -(interpfactor << 3);
ysmoothscrolloffset = 0;
ds_source =
tempSource + (((63 - ((leveltime >> 1) & 63)) << 3) & 63);
break;
default:
xsmoothscrolloffset = 0;
ysmoothscrolloffset = 0;
ds_source = tempSource;
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/heretic/r_things.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,9 @@ void R_DrawPSprite(pspdef_t * psp)
vis->mobjflags = 0;
vis->psprite = true;
vis->footclip = 0;
// [crispy] weapons drawn 1 pixel too high when player is idle
vis->texturemid =
(BASEYCENTER << FRACBITS) /* + FRACUNIT / 2 */ - (psp->sy2 -
(BASEYCENTER << FRACBITS) + FRACUNIT / 4 - (psp->sy2 -
spritetopoffset[lump]);
if (viewheight == SCREENHEIGHT)
{
Expand All @@ -825,7 +826,9 @@ void R_DrawPSprite(pspdef_t * psp)
viewplayer->powers[pw_invisibility] & 8)
{
// Invisibility
vis->colormap[0] = vis->colormap[1] = spritelights[MAXLIGHTSCALE - 1];
// [crispy] allow translucent weapons to be affected by invulnerability colormap
vis->colormap[0] = vis->colormap[1] = fixedcolormap ? fixedcolormap :
spritelights[MAXLIGHTSCALE - 1];
vis->mobjflags |= MF_SHADOW;
#ifdef CRISPY_TRUECOLOR
vis->blendfunc = I_BlendOverTinttab;
Expand Down

0 comments on commit dcb8585

Please sign in to comment.