This commit is contained in:
Christoph Oelckers 2016-02-02 10:46:50 +01:00
commit 046541c7ef
5 changed files with 69 additions and 46 deletions

View file

@ -90,7 +90,7 @@ struct F3DFloor
fixed_t delta; fixed_t delta;
int flags; unsigned int flags;
line_t* master; line_t* master;
sector_t * model; sector_t * model;

View file

@ -228,7 +228,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
FTexture * tex= TexMan(texnum); FTexture * tex= TexMan(texnum);
if (!tex) return false; if (!tex) return false;
fixed_t totalscale = FixedMul(side->GetTextureYScale(side_t::mid), tex->yScale); fixed_t totalscale = abs(FixedMul(side->GetTextureYScale(side_t::mid), tex->yScale));
fixed_t y_offset = side->GetTextureYOffset(side_t::mid); fixed_t y_offset = side->GetTextureYOffset(side_t::mid);
fixed_t textureheight = tex->GetScaledHeight(totalscale) << FRACBITS; fixed_t textureheight = tex->GetScaledHeight(totalscale) << FRACBITS;
if (totalscale != FRACUNIT && !tex->bWorldPanning) if (totalscale != FRACUNIT && !tex->bWorldPanning)

View file

@ -56,7 +56,7 @@ class SightCheck
fixed_t topslope, bottomslope; // slopes to top and bottom of target fixed_t topslope, bottomslope; // slopes to top and bottom of target
int Flags; int Flags;
divline_t trace; divline_t trace;
int myseethrough; unsigned int myseethrough;
bool PTR_SightTraverse (intercept_t *in); bool PTR_SightTraverse (intercept_t *in);
bool P_SightCheckLine (line_t *ld); bool P_SightCheckLine (line_t *ld);

View file

@ -171,8 +171,6 @@ fixed_t MaskedScaleY;
static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FTexture::Span *spans), FTexture *tex) static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FTexture::Span *spans), FTexture *tex)
{ {
if (maskedtexturecol[dc_x] != FIXED_MAX)
{
// calculate lighting // calculate lighting
if (fixedcolormap == NULL && fixedlightlev < 0) if (fixedcolormap == NULL && fixedlightlev < 0)
{ {
@ -180,7 +178,10 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
} }
dc_iscale = MulScale18 (MaskedSWall[dc_x], MaskedScaleY); dc_iscale = MulScale18 (MaskedSWall[dc_x], MaskedScaleY);
sprtopscreen = centeryfrac - FixedMul (dc_texturemid, spryscale); if (sprflipvert)
sprtopscreen = centeryfrac + FixedMul(dc_texturemid, spryscale);
else
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
// killough 1/25/98: here's where Medusa came in, because // killough 1/25/98: here's where Medusa came in, because
// it implicitly assumed that the column was all one patch. // it implicitly assumed that the column was all one patch.
@ -194,8 +195,6 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
const FTexture::Span *spans; const FTexture::Span *spans;
const BYTE *pixels = tex->GetColumn (maskedtexturecol[dc_x] >> FRACBITS, &spans); const BYTE *pixels = tex->GetColumn (maskedtexturecol[dc_x] >> FRACBITS, &spans);
blastfunc (pixels, spans); blastfunc (pixels, spans);
// maskedtexturecol[dc_x] = FIXED_MAX; // kg3D - seems to be useless
}
rw_light += rw_lightstep; rw_light += rw_lightstep;
spryscale += rw_scalestep; spryscale += rw_scalestep;
} }
@ -226,7 +225,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
FTexture *tex; FTexture *tex;
int i; int i;
sector_t tempsec; // killough 4/13/98 sector_t tempsec; // killough 4/13/98
fixed_t texheight, textop, texheightscale; fixed_t texheight, texheightscale;
bool notrelevant = false; bool notrelevant = false;
const sector_t *sec; const sector_t *sec;
@ -308,9 +307,14 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1); spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
rw_scalestep = ds->iscalestep; rw_scalestep = ds->iscalestep;
if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev;
else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap;
// find positioning // find positioning
texheight = tex->GetScaledHeight() << FRACBITS; texheight = tex->GetScaledHeight() << FRACBITS;
texheightscale = curline->sidedef->GetTextureYScale(side_t::mid); texheightscale = abs(curline->sidedef->GetTextureYScale(side_t::mid));
if (texheightscale != FRACUNIT) if (texheightscale != FRACUNIT)
{ {
texheight = FixedDiv(texheight, texheightscale); texheight = FixedDiv(texheight, texheightscale);
@ -324,8 +328,18 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
dc_texturemid = MIN (frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling)); dc_texturemid = MIN (frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
} }
{ // encapsulate the lifetime of rowoffset
fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid); fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
if (!(curline->linedef->flags & ML_WRAP_MIDTEX) &&
!(curline->sidedef->Flags & WALLF_WRAP_MIDTEX))
{ // Texture does not wrap vertically.
fixed_t textop;
if (MaskedScaleY < 0)
{
MaskedScaleY = -MaskedScaleY;
sprflipvert = true;
}
if (tex->bWorldPanning) if (tex->bWorldPanning)
{ {
// rowoffset is added before the MulScale3 so that the masked texture will // rowoffset is added before the MulScale3 so that the masked texture will
@ -341,17 +355,12 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
textop = dc_texturemid - viewz + SafeDivScale16 (rowoffset, MaskedScaleY); textop = dc_texturemid - viewz + SafeDivScale16 (rowoffset, MaskedScaleY);
dc_texturemid = MulScale16 (dc_texturemid - viewz, MaskedScaleY) + rowoffset; dc_texturemid = MulScale16 (dc_texturemid - viewz, MaskedScaleY) + rowoffset;
} }
if (sprflipvert)
{
MaskedScaleY = -MaskedScaleY;
dc_texturemid -= tex->GetHeight() << FRACBITS;
} }
if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev;
else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap;
if (!(curline->linedef->flags & ML_WRAP_MIDTEX) &&
!(curline->sidedef->Flags & WALLF_WRAP_MIDTEX))
{ // Texture does not wrap vertically.
// [RH] Don't bother drawing segs that are completely offscreen // [RH] Don't bother drawing segs that are completely offscreen
if (MulScale12 (globaldclip, ds->sz1) < -textop && if (MulScale12 (globaldclip, ds->sz1) < -textop &&
MulScale12 (globaldclip, ds->sz2) < -textop) MulScale12 (globaldclip, ds->sz2) < -textop)
@ -467,6 +476,20 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
} }
else else
{ // Texture does wrap vertically. { // Texture does wrap vertically.
if (tex->bWorldPanning)
{
// rowoffset is added before the MulScale3 so that the masked texture will
// still be positioned in world units rather than texels.
dc_texturemid += rowoffset - viewz;
dc_texturemid = MulScale16 (dc_texturemid, MaskedScaleY);
}
else
{
// rowoffset is added outside the multiply so that it positions the texture
// by texels instead of world units.
dc_texturemid = MulScale16 (dc_texturemid - viewz, MaskedScaleY) + rowoffset;
}
WallC.sz1 = ds->sz1; WallC.sz1 = ds->sz1;
WallC.sz2 = ds->sz2; WallC.sz2 = ds->sz2;
WallC.sx1 = ds->sx1; WallC.sx1 = ds->sx1;
@ -576,7 +599,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
} }
xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart)); xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart));
yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart)); yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart));
// encapsulate the lifetime of rowoffset
fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid);
dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling); dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling);
rw_offset = curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid); rw_offset = curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid);
@ -2508,9 +2531,9 @@ void R_StoreWallRange (int start, int stop)
iend = DivScale32 (1, iend); iend = DivScale32 (1, iend);
ds_p->yrepeat = yrepeat; ds_p->yrepeat = yrepeat;
ds_p->iscale = istart; ds_p->iscale = istart;
if (stop - start > 1) if (stop - start > 0)
{ {
ds_p->iscalestep = (iend - istart) / (stop - start - 1); ds_p->iscalestep = (iend - istart) / (stop - start);
} }
else else
{ {

View file

@ -276,9 +276,9 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
lump.Read (trans, len); lump.Read (trans, len);
HaveTrans = true; HaveTrans = true;
// Save for colortype 2 // Save for colortype 2
NonPaletteTrans[0] = BigShort(((WORD *)trans)[0]); NonPaletteTrans[0] = WORD(trans[0] * 256 + trans[1]);
NonPaletteTrans[1] = BigShort(((WORD *)trans)[1]); NonPaletteTrans[1] = WORD(trans[2] * 256 + trans[3]);
NonPaletteTrans[2] = BigShort(((WORD *)trans)[2]); NonPaletteTrans[2] = WORD(trans[4] * 256 + trans[5]);
break; break;
case MAKE_ID('a','l','P','h'): case MAKE_ID('a','l','P','h'):