mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- floatified sidedef texture info and fixed two bugs involving this data.
This commit is contained in:
parent
f1b3f59bcc
commit
4d4f31fd83
6 changed files with 62 additions and 109 deletions
|
@ -480,8 +480,8 @@ void extsector_t::Serialize(FArchive &arc)
|
|||
|
||||
FArchive &operator<< (FArchive &arc, side_t::part &p)
|
||||
{
|
||||
arc << p.xoffset << p.yoffset << p.interpolation << p.texture
|
||||
<< p.xscale << p.yscale;// << p.Light;
|
||||
arc << p.xOffset << p.yOffset << p.interpolation << p.texture
|
||||
<< p.xScale << p.yScale;// << p.Light;
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
|
|
@ -549,8 +549,8 @@ void P_SpawnScrollers(void)
|
|||
case Scroll_Texture_Offsets:
|
||||
// killough 3/2/98: scroll according to sidedef offsets
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffset(side_t::mid),
|
||||
sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
|
||||
new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffsetF(side_t::mid),
|
||||
sides[s].GetTextureYOffsetF(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Left:
|
||||
|
|
|
@ -2627,10 +2627,10 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
|
|||
msd->rowoffset += 102;
|
||||
}
|
||||
|
||||
sd->SetTextureXOffset(LittleShort(msd->textureoffset)<<FRACBITS);
|
||||
sd->SetTextureYOffset(LittleShort(msd->rowoffset)<<FRACBITS);
|
||||
sd->SetTextureXScale(FRACUNIT);
|
||||
sd->SetTextureYScale(FRACUNIT);
|
||||
sd->SetTextureXOffset(LittleShort(msd->textureoffset));
|
||||
sd->SetTextureYOffset(LittleShort(msd->rowoffset));
|
||||
sd->SetTextureXScale(1.);
|
||||
sd->SetTextureYScale(1.);
|
||||
sd->linedef = NULL;
|
||||
sd->Flags = 0;
|
||||
sd->Index = i;
|
||||
|
|
119
src/r_defs.h
119
src/r_defs.h
|
@ -1127,10 +1127,10 @@ struct side_t
|
|||
};
|
||||
struct part
|
||||
{
|
||||
fixed_t xoffset;
|
||||
fixed_t yoffset;
|
||||
fixed_t xscale;
|
||||
fixed_t yscale;
|
||||
double xOffset;
|
||||
double yOffset;
|
||||
double xScale;
|
||||
double yScale;
|
||||
FTextureID texture;
|
||||
TObjPtr<DInterpolation> interpolation;
|
||||
//int Light;
|
||||
|
@ -1163,135 +1163,88 @@ struct side_t
|
|||
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)
|
||||
{
|
||||
textures[which].xoffset = FLOAT2FIXED(offset);
|
||||
textures[which].xOffset = offset;;
|
||||
}
|
||||
void SetTextureXOffset(double offset)
|
||||
{
|
||||
textures[top].xoffset =
|
||||
textures[mid].xoffset =
|
||||
textures[bottom].xoffset = FLOAT2FIXED(offset);
|
||||
}
|
||||
fixed_t GetTextureXOffset(int which) const
|
||||
{
|
||||
return textures[which].xoffset;
|
||||
textures[top].xOffset =
|
||||
textures[mid].xOffset =
|
||||
textures[bottom].xOffset = offset;
|
||||
}
|
||||
fixed_t GetTextureXOffset(int which) const = delete;
|
||||
double GetTextureXOffsetF(int which) const
|
||||
{
|
||||
return FIXED2DBL(textures[which].xoffset);
|
||||
}
|
||||
void AddTextureXOffset(int which, fixed_t delta)
|
||||
{
|
||||
textures[which].xoffset += delta;
|
||||
return textures[which].xOffset;
|
||||
}
|
||||
void AddTextureXOffset(int which, fixed_t delta) = delete;
|
||||
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)
|
||||
{
|
||||
textures[which].yoffset = FLOAT2FIXED(offset);
|
||||
textures[which].yOffset = offset;
|
||||
}
|
||||
void SetTextureYOffset(double offset)
|
||||
{
|
||||
textures[top].yoffset =
|
||||
textures[mid].yoffset =
|
||||
textures[bottom].yoffset = FLOAT2FIXED(offset);
|
||||
}
|
||||
fixed_t GetTextureYOffset(int which) const
|
||||
{
|
||||
return textures[which].yoffset;
|
||||
textures[top].yOffset =
|
||||
textures[mid].yOffset =
|
||||
textures[bottom].yOffset = offset;
|
||||
}
|
||||
fixed_t GetTextureYOffset(int which) const = delete;
|
||||
double GetTextureYOffsetF(int which) const
|
||||
{
|
||||
return FIXED2DBL(textures[which].yoffset);
|
||||
}
|
||||
void AddTextureYOffset(int which, fixed_t delta)
|
||||
{
|
||||
textures[which].yoffset += delta;
|
||||
return textures[which].yOffset;
|
||||
}
|
||||
void AddTextureYOffset(int which, fixed_t delta) = delete;
|
||||
void AddTextureYOffset(int which, double delta)
|
||||
{
|
||||
textures[which].yoffset += FLOAT2FIXED(delta);
|
||||
textures[which].yOffset += delta;
|
||||
}
|
||||
|
||||
void SetTextureXScale(int which, fixed_t scale)
|
||||
{
|
||||
textures[which].xscale = scale == 0 ? FRACUNIT : scale;
|
||||
}
|
||||
void SetTextureXScale(int which, fixed_t scale) = delete;
|
||||
void SetTextureXScale(int which, double scale)
|
||||
{
|
||||
textures[which].xscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale);
|
||||
}
|
||||
void SetTextureXScale(fixed_t scale)
|
||||
{
|
||||
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
|
||||
textures[which].xScale = scale == 0 ? 1. : scale;
|
||||
}
|
||||
void SetTextureXScale(fixed_t scale) = delete;
|
||||
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)
|
||||
{
|
||||
textures[which].xscale = fixed_t(textures[which].xscale * delta);
|
||||
}
|
||||
|
||||
|
||||
void SetTextureYScale(int which, fixed_t scale)
|
||||
{
|
||||
textures[which].yscale = scale == 0 ? FRACUNIT : scale;
|
||||
textures[which].xScale *= delta;
|
||||
}
|
||||
|
||||
void SetTextureYScale(int which, fixed_t scale) = delete;
|
||||
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)
|
||||
{
|
||||
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
|
||||
}
|
||||
void SetTextureYScale(fixed_t scale) = delete;
|
||||
void SetTextureYScale(double scale)
|
||||
{
|
||||
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale);
|
||||
}
|
||||
fixed_t GetTextureYScale(int which) const
|
||||
{
|
||||
return textures[which].yscale;
|
||||
textures[top].yScale = textures[mid].yScale = textures[bottom].yScale = scale == 0 ? 1. : scale;
|
||||
}
|
||||
fixed_t GetTextureYScale(int which) const = delete;
|
||||
double GetTextureYScaleF(int which) const
|
||||
{
|
||||
return FIXED2DBL(textures[which].yscale);
|
||||
return textures[which].yScale;
|
||||
}
|
||||
void MultiplyTextureYScale(int which, double delta)
|
||||
{
|
||||
textures[which].yscale = fixed_t(textures[which].yscale * delta);
|
||||
textures[which].yScale *= delta;
|
||||
}
|
||||
|
||||
DInterpolation *SetInterpolation(int position);
|
||||
|
|
|
@ -1447,7 +1447,7 @@ void R_DrawSkyPlane (visplane_t *pl)
|
|||
// to allow sky rotation as well as careful positioning.
|
||||
// However, the offset is scaled very small, so that it
|
||||
// allows a long-period of sky rotation.
|
||||
skyangle += s->GetTextureXOffset(pos);
|
||||
skyangle += FLOAT2FIXED(s->GetTextureXOffsetF(pos));
|
||||
|
||||
// Vertical offset allows careful sky positioning.
|
||||
skymid = s->GetTextureYOffsetF(pos) - 28;
|
||||
|
|
|
@ -599,12 +599,12 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
|
|||
scaledside = rover->master->sidedef[0];
|
||||
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);
|
||||
|
||||
double rowoffset = curline->sidedef->GetTextureYOffsetF(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffsetF(side_t::mid);
|
||||
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)
|
||||
{
|
||||
rowoffset += rw_pic->GetHeight();
|
||||
|
@ -2026,10 +2026,10 @@ void R_NewWall (bool needlights)
|
|||
if (linedef->special != Line_Horizon)
|
||||
{
|
||||
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);
|
||||
rw_midtexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::mid));
|
||||
rw_midtexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::mid));
|
||||
rw_midtexturescalex = sidedef->GetTextureXScaleF(side_t::mid);
|
||||
rw_midtexturescaley = sidedef->GetTextureYScaleF(side_t::mid);
|
||||
yrepeat = midtexture->Scale.Y * rw_midtexturescaley;
|
||||
if (yrepeat >= 0)
|
||||
{ // normal orientation
|
||||
|
@ -2181,10 +2181,10 @@ void R_NewWall (bool needlights)
|
|||
{ // top texture
|
||||
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);
|
||||
rw_toptexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::top));
|
||||
rw_toptexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::top));
|
||||
rw_toptexturescalex =sidedef->GetTextureXScaleF(side_t::top);
|
||||
rw_toptexturescaley =sidedef->GetTextureYScaleF(side_t::top);
|
||||
yrepeat = toptexture->Scale.Y * rw_toptexturescaley;
|
||||
if (yrepeat >= 0)
|
||||
{ // normal orientation
|
||||
|
@ -2226,10 +2226,10 @@ void R_NewWall (bool needlights)
|
|||
{ // bottom texture
|
||||
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);
|
||||
rw_bottomtexturescalex = FIXED2DBL(sidedef->GetTextureXScale(side_t::bottom));
|
||||
rw_bottomtexturescaley = FIXED2DBL(sidedef->GetTextureYScale(side_t::bottom));
|
||||
rw_bottomtexturescalex = sidedef->GetTextureXScaleF(side_t::bottom);
|
||||
rw_bottomtexturescaley = sidedef->GetTextureYScaleF(side_t::bottom);
|
||||
yrepeat = bottomtexture->Scale.Y * rw_bottomtexturescaley;
|
||||
if (yrepeat >= 0)
|
||||
{ // normal orientation
|
||||
|
@ -2301,10 +2301,10 @@ void R_NewWall (bool needlights)
|
|||
if (needlights && (segtextured || (backsector && IsFogBoundary(frontsector, backsector))))
|
||||
{
|
||||
lwallscale =
|
||||
midtex ? (midtex->Scale.X * sidedef->GetTextureXScale(side_t::mid) / 65536.0) :
|
||||
toptexture ? (toptexture->Scale.X * sidedef->GetTextureXScale(side_t::top) / 65536.0) :
|
||||
bottomtexture ? (bottomtexture->Scale.X * sidedef->GetTextureXScale(side_t::bottom) / 65536.0) :
|
||||
FRACUNIT;
|
||||
midtex ? (midtex->Scale.X * sidedef->GetTextureXScaleF(side_t::mid)) :
|
||||
toptexture ? (toptexture->Scale.X * sidedef->GetTextureXScaleF(side_t::top)) :
|
||||
bottomtexture ? (bottomtexture->Scale.X * sidedef->GetTextureXScaleF(side_t::bottom)) :
|
||||
1.;
|
||||
|
||||
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2);
|
||||
|
||||
|
@ -2387,7 +2387,7 @@ void R_StoreWallRange (int start, int stop)
|
|||
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);
|
||||
|
||||
ds_p->CurrentPortalUniq = CurrentPortalUniq;
|
||||
|
@ -2517,7 +2517,7 @@ void R_StoreWallRange (int start, int stop)
|
|||
swal = (float *)(openings + ds_p->swall);
|
||||
FTexture *pic = TexMan(sidedef->GetTexture(side_t::mid), true);
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue