Skip to content

Commit

Permalink
stretch short skies only (#1104)
Browse files Browse the repository at this point in the history
Like this @kitchen-ace? Fixes #1092
  • Loading branch information
fabiangreffrath authored Oct 20, 2023
1 parent 99416f4 commit fe4dcd3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
26 changes: 16 additions & 10 deletions src/doom/r_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,15 @@ R_FindPlane
// [crispy] add support for MBF sky tranfers
if (picnum == skyflatnum || picnum & PL_SKYFLAT)
{
height = 0; // all skys map together
lightlevel = 0;
lightlevel = 0; // killough 7/19/98: most skies map together

// haleyjd 05/06/08: but not all. If height > viewpoint.z, set height to 1
// instead of 0, to keep ceilings mapping with ceilings, and floors mapping
// with floors.
if (height > viewz)
height = 1;
else
height = 0;
}

for (check=visplanes; check<lastvisplane; check++)
Expand Down Expand Up @@ -456,11 +463,6 @@ void R_DrawPlanes (void)
const side_t *s = *l->sidenum + sides;
texture = texturetranslation[s->toptexture];
dc_texturemid = s->rowoffset - 28*FRACUNIT;
// [crispy] stretch sky
if (crispy->stretchsky)
{
dc_texturemid = dc_texturemid * (textureheight[texture]>>FRACBITS) / SKYSTRETCH_HEIGHT;
}
flip = (l->special == 272) ? 0u : ~0u;
an += s->textureoffset;
}
Expand All @@ -478,11 +480,15 @@ void R_DrawPlanes (void)
// by INVUL inverse mapping.
// [crispy] no brightmaps for sky
dc_colormap[0] = dc_colormap[1] = colormaps;
// dc_texturemid = skytexturemid;
dc_texheight = textureheight[texture]>>FRACBITS; // [crispy] Tutti-Frutti fix
// [crispy] stretch sky
if (crispy->stretchsky)

// [crispy] stretch short skies
if (crispy->stretchsky && dc_texheight < 200)
{
dc_iscale = dc_iscale * dc_texheight / SKYSTRETCH_HEIGHT;
dc_texturemid = dc_texturemid * dc_texheight / SKYSTRETCH_HEIGHT;
}

for (x=pl->minx ; x <= pl->maxx ; x++)
{
dc_yl = pl->top[x];
Expand Down
17 changes: 11 additions & 6 deletions src/doom/r_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,21 @@ int skytexturemid;
//
void R_InitSkyMap (void)
{
// skyflatnum = R_FlatNumForName ( SKYFLATNAME );
// [crispy] stretch sky
int skyheight;

// [crispy] stretch short skies
if (skytexture == -1)
{
return;
}
if ((crispy->stretchsky = crispy->freelook || crispy->mouselook || crispy->pitch))
{
skytexturemid = -28*FRACUNIT * (textureheight[skytexture] >> FRACBITS) / SKYSTRETCH_HEIGHT;
}

crispy->stretchsky = crispy->freelook || crispy->mouselook || crispy->pitch;
skyheight = textureheight[skytexture] >> FRACBITS;

if (crispy->stretchsky && skyheight < 200)
skytexturemid = -28*FRACUNIT;
else if (skyheight >= 200)
skytexturemid = 200*FRACUNIT;
else
skytexturemid = ORIGHEIGHT/2*FRACUNIT;
}
Expand Down

0 comments on commit fe4dcd3

Please sign in to comment.