- floatified sidedef texture info and fixed two bugs involving this data.

This commit is contained in:
Christoph Oelckers 2016-04-23 09:41:59 +02:00
parent f1b3f59bcc
commit 4d4f31fd83
6 changed files with 62 additions and 109 deletions

View File

@ -480,8 +480,8 @@ void extsector_t::Serialize(FArchive &arc)
FArchive &operator<< (FArchive &arc, side_t::part &p) FArchive &operator<< (FArchive &arc, side_t::part &p)
{ {
arc << p.xoffset << p.yoffset << p.interpolation << p.texture arc << p.xOffset << p.yOffset << p.interpolation << p.texture
<< p.xscale << p.yscale;// << p.Light; << p.xScale << p.yScale;// << p.Light;
return arc; return arc;
} }

View File

@ -549,8 +549,8 @@ void P_SpawnScrollers(void)
case Scroll_Texture_Offsets: case Scroll_Texture_Offsets:
// killough 3/2/98: scroll according to sidedef offsets // killough 3/2/98: scroll according to sidedef offsets
s = int(lines[i].sidedef[0] - sides); s = int(lines[i].sidedef[0] - sides);
new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffset(side_t::mid), new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffsetF(side_t::mid),
sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0])); sides[s].GetTextureYOffsetF(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
break; break;
case Scroll_Texture_Left: case Scroll_Texture_Left:

View File

@ -2627,10 +2627,10 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
msd->rowoffset += 102; msd->rowoffset += 102;
} }
sd->SetTextureXOffset(LittleShort(msd->textureoffset)<<FRACBITS); sd->SetTextureXOffset(LittleShort(msd->textureoffset));
sd->SetTextureYOffset(LittleShort(msd->rowoffset)<<FRACBITS); sd->SetTextureYOffset(LittleShort(msd->rowoffset));
sd->SetTextureXScale(FRACUNIT); sd->SetTextureXScale(1.);
sd->SetTextureYScale(FRACUNIT); sd->SetTextureYScale(1.);
sd->linedef = NULL; sd->linedef = NULL;
sd->Flags = 0; sd->Flags = 0;
sd->Index = i; sd->Index = i;

View File

@ -1127,10 +1127,10 @@ struct side_t
}; };
struct part struct part
{ {
fixed_t xoffset; double xOffset;
fixed_t yoffset; double yOffset;
fixed_t xscale; double xScale;
fixed_t yscale; double yScale;
FTextureID texture; FTextureID texture;
TObjPtr<DInterpolation> interpolation; TObjPtr<DInterpolation> interpolation;
//int Light; //int Light;
@ -1163,135 +1163,88 @@ struct side_t
textures[which].texture = tex; textures[which].texture = tex;
} }
void SetTextureXOffset(int which, fixed_t offset)
{
textures[which].xoffset = offset;
}
void SetTextureXOffset(fixed_t offset)
{
textures[top].xoffset =
textures[mid].xoffset =
textures[bottom].xoffset = offset;
}
void SetTextureXOffset(int which, double offset) void SetTextureXOffset(int which, double offset)
{ {
textures[which].xoffset = FLOAT2FIXED(offset); textures[which].xOffset = offset;;
} }
void SetTextureXOffset(double offset) void SetTextureXOffset(double offset)
{ {
textures[top].xoffset = textures[top].xOffset =
textures[mid].xoffset = textures[mid].xOffset =
textures[bottom].xoffset = FLOAT2FIXED(offset); textures[bottom].xOffset = offset;
}
fixed_t GetTextureXOffset(int which) const
{
return textures[which].xoffset;
} }
fixed_t GetTextureXOffset(int which) const = delete;
double GetTextureXOffsetF(int which) const double GetTextureXOffsetF(int which) const
{ {
return FIXED2DBL(textures[which].xoffset); return textures[which].xOffset;
}
void AddTextureXOffset(int which, fixed_t delta)
{
textures[which].xoffset += delta;
} }
void AddTextureXOffset(int which, fixed_t delta) = delete;
void AddTextureXOffset(int which, double delta) void AddTextureXOffset(int which, double delta)
{ {
textures[which].xoffset += FLOAT2FIXED(delta); textures[which].xOffset += delta;
} }
void SetTextureYOffset(int which, fixed_t offset)
{
textures[which].yoffset = offset;
}
void SetTextureYOffset(fixed_t offset)
{
textures[top].yoffset =
textures[mid].yoffset =
textures[bottom].yoffset = offset;
}
void SetTextureYOffset(int which, double offset) void SetTextureYOffset(int which, double offset)
{ {
textures[which].yoffset = FLOAT2FIXED(offset); textures[which].yOffset = offset;
} }
void SetTextureYOffset(double offset) void SetTextureYOffset(double offset)
{ {
textures[top].yoffset = textures[top].yOffset =
textures[mid].yoffset = textures[mid].yOffset =
textures[bottom].yoffset = FLOAT2FIXED(offset); textures[bottom].yOffset = offset;
}
fixed_t GetTextureYOffset(int which) const
{
return textures[which].yoffset;
} }
fixed_t GetTextureYOffset(int which) const = delete;
double GetTextureYOffsetF(int which) const double GetTextureYOffsetF(int which) const
{ {
return FIXED2DBL(textures[which].yoffset); return textures[which].yOffset;
}
void AddTextureYOffset(int which, fixed_t delta)
{
textures[which].yoffset += delta;
} }
void AddTextureYOffset(int which, fixed_t delta) = delete;
void AddTextureYOffset(int which, double delta) void AddTextureYOffset(int which, double delta)
{ {
textures[which].yoffset += FLOAT2FIXED(delta); textures[which].yOffset += delta;
} }
void SetTextureXScale(int which, fixed_t scale) void SetTextureXScale(int which, fixed_t scale) = delete;
{
textures[which].xscale = scale == 0 ? FRACUNIT : scale;
}
void SetTextureXScale(int which, double scale) void SetTextureXScale(int which, double scale)
{ {
textures[which].xscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale); textures[which].xScale = scale == 0 ? 1. : scale;
}
void SetTextureXScale(fixed_t scale)
{
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
} }
void SetTextureXScale(fixed_t scale) = delete;
void SetTextureXScale(double scale) void SetTextureXScale(double scale)
{ {
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale); textures[top].xScale = textures[mid].xScale = textures[bottom].xScale = scale == 0 ? 1. : scale;
} }
fixed_t GetTextureXScale(int which) const fixed_t GetTextureXScale(int which) const = delete;
double GetTextureXScaleF(int which) const
{ {
return textures[which].xscale; return textures[which].xScale;
} }
void MultiplyTextureXScale(int which, double delta) void MultiplyTextureXScale(int which, double delta)
{ {
textures[which].xscale = fixed_t(textures[which].xscale * delta); textures[which].xScale *= delta;
}
void SetTextureYScale(int which, fixed_t scale)
{
textures[which].yscale = scale == 0 ? FRACUNIT : scale;
} }
void SetTextureYScale(int which, fixed_t scale) = delete;
void SetTextureYScale(int which, double scale) void SetTextureYScale(int which, double scale)
{ {
textures[which].yscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale); textures[which].yScale = scale == 0 ? 1. : scale;
} }
void SetTextureYScale(fixed_t scale) void SetTextureYScale(fixed_t scale) = delete;
{
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
}
void SetTextureYScale(double scale) void SetTextureYScale(double scale)
{ {
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale); textures[top].yScale = textures[mid].yScale = textures[bottom].yScale = scale == 0 ? 1. : scale;
}
fixed_t GetTextureYScale(int which) const
{
return textures[which].yscale;
} }
fixed_t GetTextureYScale(int which) const = delete;
double GetTextureYScaleF(int which) const double GetTextureYScaleF(int which) const
{ {
return FIXED2DBL(textures[which].yscale); return textures[which].yScale;
} }
void MultiplyTextureYScale(int which, double delta) void MultiplyTextureYScale(int which, double delta)
{ {
textures[which].yscale = fixed_t(textures[which].yscale * delta); textures[which].yScale *= delta;
} }
DInterpolation *SetInterpolation(int position); DInterpolation *SetInterpolation(int position);

View File

@ -1447,7 +1447,7 @@ void R_DrawSkyPlane (visplane_t *pl)
// to allow sky rotation as well as careful positioning. // to allow sky rotation as well as careful positioning.
// However, the offset is scaled very small, so that it // However, the offset is scaled very small, so that it
// allows a long-period of sky rotation. // allows a long-period of sky rotation.
skyangle += s->GetTextureXOffset(pos); skyangle += FLOAT2FIXED(s->GetTextureXOffsetF(pos));
// Vertical offset allows careful sky positioning. // Vertical offset allows careful sky positioning.
skymid = s->GetTextureYOffsetF(pos) - 28; skymid = s->GetTextureYOffsetF(pos) - 28;

View File

@ -599,12 +599,12 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
scaledside = rover->master->sidedef[0]; scaledside = rover->master->sidedef[0];
scaledpart = side_t::mid; scaledpart = side_t::mid;
} }
xscale = fixed_t(rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart)); xscale = FLOAT2FIXED(rw_pic->Scale.X * scaledside->GetTextureXScaleF(scaledpart));
yscale = rw_pic->Scale.Y * scaledside->GetTextureYScaleF(scaledpart); yscale = rw_pic->Scale.Y * scaledside->GetTextureYScaleF(scaledpart);
double rowoffset = curline->sidedef->GetTextureYOffsetF(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffsetF(side_t::mid); double rowoffset = curline->sidedef->GetTextureYOffsetF(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffsetF(side_t::mid);
double planez = rover->model->GetPlaneTexZF(sector_t::ceiling); double planez = rover->model->GetPlaneTexZF(sector_t::ceiling);
rw_offset = curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid); rw_offset = FLOAT2FIXED(curline->sidedef->GetTextureXOffsetF(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffsetF(side_t::mid));
if (rowoffset < 0) if (rowoffset < 0)
{ {
rowoffset += rw_pic->GetHeight(); rowoffset += rw_pic->GetHeight();
@ -2026,10 +2026,10 @@ void R_NewWall (bool needlights)
if (linedef->special != Line_Horizon) if (linedef->special != Line_Horizon)
{ {
midtexture = TexMan(sidedef->GetTexture(side_t::mid), true); midtexture = TexMan(sidedef->GetTexture(side_t::mid), true);
rw_offset_mid = sidedef->GetTextureXOffset(side_t::mid); rw_offset_mid = FLOAT2FIXED(sidedef->GetTextureXOffsetF(side_t::mid));
rowoffset = sidedef->GetTextureYOffsetF(side_t::mid); rowoffset = sidedef->GetTextureYOffsetF(side_t::mid);
rw_midtexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::mid)); rw_midtexturescalex = sidedef->GetTextureXScaleF(side_t::mid);
rw_midtexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::mid)); rw_midtexturescaley = sidedef->GetTextureYScaleF(side_t::mid);
yrepeat = midtexture->Scale.Y * rw_midtexturescaley; yrepeat = midtexture->Scale.Y * rw_midtexturescaley;
if (yrepeat >= 0) if (yrepeat >= 0)
{ // normal orientation { // normal orientation
@ -2181,10 +2181,10 @@ void R_NewWall (bool needlights)
{ // top texture { // top texture
toptexture = TexMan(sidedef->GetTexture(side_t::top), true); toptexture = TexMan(sidedef->GetTexture(side_t::top), true);
rw_offset_top = sidedef->GetTextureXOffset(side_t::top); rw_offset_top = FLOAT2FIXED(sidedef->GetTextureXOffsetF(side_t::top));
rowoffset = sidedef->GetTextureYOffsetF(side_t::top); rowoffset = sidedef->GetTextureYOffsetF(side_t::top);
rw_toptexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::top)); rw_toptexturescalex =sidedef->GetTextureXScaleF(side_t::top);
rw_toptexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::top)); rw_toptexturescaley =sidedef->GetTextureYScaleF(side_t::top);
yrepeat = toptexture->Scale.Y * rw_toptexturescaley; yrepeat = toptexture->Scale.Y * rw_toptexturescaley;
if (yrepeat >= 0) if (yrepeat >= 0)
{ // normal orientation { // normal orientation
@ -2226,10 +2226,10 @@ void R_NewWall (bool needlights)
{ // bottom texture { // bottom texture
bottomtexture = TexMan(sidedef->GetTexture(side_t::bottom), true); bottomtexture = TexMan(sidedef->GetTexture(side_t::bottom), true);
rw_offset_bottom = sidedef->GetTextureXOffset(side_t::bottom); rw_offset_bottom = FLOAT2FIXED(sidedef->GetTextureXOffsetF(side_t::bottom));
rowoffset = sidedef->GetTextureYOffsetF(side_t::bottom); rowoffset = sidedef->GetTextureYOffsetF(side_t::bottom);
rw_bottomtexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::bottom)); rw_bottomtexturescalex = sidedef->GetTextureXScaleF(side_t::bottom);
rw_bottomtexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::bottom)); rw_bottomtexturescaley = sidedef->GetTextureYScaleF(side_t::bottom);
yrepeat = bottomtexture->Scale.Y * rw_bottomtexturescaley; yrepeat = bottomtexture->Scale.Y * rw_bottomtexturescaley;
if (yrepeat >= 0) if (yrepeat >= 0)
{ // normal orientation { // normal orientation
@ -2301,10 +2301,10 @@ void R_NewWall (bool needlights)
if (needlights && (segtextured || (backsector && IsFogBoundary(frontsector, backsector)))) if (needlights && (segtextured || (backsector && IsFogBoundary(frontsector, backsector))))
{ {
lwallscale = lwallscale =
midtex ? (midtex->Scale.X * sidedef->GetTextureXScale(side_t::mid) / 65536.0) : midtex ? (midtex->Scale.X * sidedef->GetTextureXScaleF(side_t::mid)) :
toptexture ? (toptexture->Scale.X * sidedef->GetTextureXScale(side_t::top) / 65536.0) : toptexture ? (toptexture->Scale.X * sidedef->GetTextureXScaleF(side_t::top)) :
bottomtexture ? (bottomtexture->Scale.X * sidedef->GetTextureXScale(side_t::bottom) / 65536.0) : bottomtexture ? (bottomtexture->Scale.X * sidedef->GetTextureXScaleF(side_t::bottom)) :
FRACUNIT; 1.;
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2); PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2);
@ -2387,7 +2387,7 @@ void R_StoreWallRange (int start, int stop)
R_NewWall (true); R_NewWall (true);
} }
rw_offset = sidedef->GetTextureXOffset(side_t::mid); rw_offset = FLOAT2FIXED(sidedef->GetTextureXOffsetF(side_t::mid));
rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1); rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
ds_p->CurrentPortalUniq = CurrentPortalUniq; ds_p->CurrentPortalUniq = CurrentPortalUniq;
@ -2517,7 +2517,7 @@ void R_StoreWallRange (int start, int stop)
swal = (float *)(openings + ds_p->swall); swal = (float *)(openings + ds_p->swall);
FTexture *pic = TexMan(sidedef->GetTexture(side_t::mid), true); FTexture *pic = TexMan(sidedef->GetTexture(side_t::mid), true);
double yscale = pic->Scale.X * sidedef->GetTextureYScaleF(side_t::mid); double yscale = pic->Scale.X * sidedef->GetTextureYScaleF(side_t::mid);
fixed_t xoffset = sidedef->GetTextureXOffset(side_t::mid); fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffsetF(side_t::mid));
if (pic->bWorldPanning) if (pic->bWorldPanning)
{ {