fix saving texture offsets (#2314)

* Rename textureoffset->interptextureoffset, basetextureoffset->textureoffset, etc.
This commit is contained in:
Roman Fomin 2025-07-20 19:35:58 +07:00 committed by GitHub
parent d3e76a1008
commit 928727e630
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 81 additions and 82 deletions

View File

@ -2234,10 +2234,10 @@ void P_UnArchiveWorld (void)
sec->floor_yoffs = saveg_read32();
sec->ceiling_xoffs = saveg_read32();
sec->ceiling_yoffs = saveg_read32();
sec->base_floor_xoffs = sec->old_floor_xoffs = sec->floor_xoffs;
sec->base_floor_yoffs = sec->old_floor_yoffs = sec->floor_yoffs;
sec->base_ceiling_xoffs = sec->old_ceiling_xoffs = sec->ceiling_xoffs;
sec->base_ceiling_yoffs = sec->old_ceiling_yoffs = sec->ceiling_yoffs;
sec->old_floor_xoffs = sec->floor_xoffs;
sec->old_floor_yoffs = sec->floor_yoffs;
sec->old_ceiling_xoffs = sec->ceiling_xoffs;
sec->old_ceiling_yoffs = sec->ceiling_yoffs;
sec->floor_rotation = saveg_read32();
sec->ceiling_rotation = saveg_read32();
@ -2281,9 +2281,8 @@ void P_UnArchiveWorld (void)
si->textureoffset = saveg_read32();
si->rowoffset = saveg_read32();
// [crispy] smooth texture scrolling
si->basetextureoffset = si->textureoffset;
si->baserowoffset = si->rowoffset;
si->oldtextureoffset = si->textureoffset;
si->oldrowoffset = si->rowoffset;
si->toptexture = saveg_read16();
si->bottomtexture = saveg_read16();

View File

@ -329,13 +329,13 @@ void P_LoadSectors (int lump)
// killough 3/7/98:
ss->floor_xoffs = 0;
ss->floor_yoffs = 0; // floor and ceiling flats offsets
ss->old_floor_xoffs = ss->base_floor_xoffs = 0;
ss->old_floor_yoffs = ss->base_floor_yoffs = 0;
ss->old_floor_xoffs = ss->interp_floor_xoffs = 0;
ss->old_floor_yoffs = ss->interp_floor_yoffs = 0;
ss->floor_rotation = 0;
ss->ceiling_xoffs = 0;
ss->ceiling_yoffs = 0;
ss->old_ceiling_xoffs = ss->base_ceiling_xoffs = 0;
ss->old_ceiling_yoffs = ss->base_ceiling_yoffs = 0;
ss->old_ceiling_xoffs = ss->interp_ceiling_xoffs = 0;
ss->old_ceiling_yoffs = ss->interp_ceiling_yoffs = 0;
ss->ceiling_rotation = 0;
ss->heightsec = -1; // sector used to get floor and ceiling height
ss->floorlightsec = -1; // sector used to get floor lighting
@ -616,8 +616,8 @@ void P_LoadSideDefs2(int lump)
// [crispy] smooth texture scrolling
sd->oldtextureoffset = sd->textureoffset;
sd->oldrowoffset = sd->rowoffset;
sd->basetextureoffset = sd->textureoffset;
sd->baserowoffset = sd->rowoffset;
sd->interptextureoffset = sd->textureoffset;
sd->interprowoffset = sd->rowoffset;
sd->oldgametic = -1;
// killough 4/4/98: allow sidedef texture names to be overloaded

View File

@ -2658,14 +2658,14 @@ void EV_RotateOffsetFlat(line_t *line, sector_t *sector)
{
if (offset_floor)
{
sectors[s].base_floor_xoffs -= line->dx;
sectors[s].base_floor_yoffs += line->dy;
sectors[s].floor_xoffs -= line->dx;
sectors[s].floor_yoffs += line->dy;
}
if (offset_ceiling)
{
sectors[s].base_ceiling_xoffs -= line->dx;
sectors[s].base_ceiling_yoffs += line->dy;
sectors[s].ceiling_xoffs -= line->dx;
sectors[s].ceiling_yoffs += line->dy;
}
if (rotate_floor)
@ -2930,36 +2930,36 @@ void T_Scroll(scroll_t *s)
side = sides + s->affectee;
if (side->oldgametic != gametic)
{
side->oldtextureoffset = side->basetextureoffset;
side->oldrowoffset = side->baserowoffset;
side->oldtextureoffset = side->textureoffset;
side->oldrowoffset = side->rowoffset;
side->oldgametic = gametic;
}
side->basetextureoffset += dx;
side->baserowoffset += dy;
side->textureoffset += dx;
side->rowoffset += dy;
break;
case sc_floor: // killough 3/7/98: Scroll floor texture
sec = sectors + s->affectee;
if (sec->old_floor_offs_gametic != gametic)
{
sec->old_floor_xoffs = sec->base_floor_xoffs;
sec->old_floor_yoffs = sec->base_floor_yoffs;
sec->old_floor_xoffs = sec->floor_xoffs;
sec->old_floor_yoffs = sec->floor_yoffs;
sec->old_floor_offs_gametic = gametic;
}
sec->base_floor_xoffs += dx;
sec->base_floor_yoffs += dy;
sec->floor_xoffs += dx;
sec->floor_yoffs += dy;
break;
case sc_ceiling: // killough 3/7/98: Scroll ceiling texture
sec = sectors + s->affectee;
if (sec->old_ceil_offs_gametic != gametic)
{
sec->old_ceiling_xoffs = sec->base_ceiling_xoffs;
sec->old_ceiling_yoffs = sec->base_ceiling_yoffs;
sec->old_ceiling_xoffs = sec->ceiling_xoffs;
sec->old_ceiling_yoffs = sec->ceiling_yoffs;
sec->old_ceil_offs_gametic = gametic;
}
sec->base_ceiling_xoffs += dx;
sec->base_ceiling_yoffs += dy;
sec->ceiling_xoffs += dx;
sec->ceiling_yoffs += dy;
break;
case sc_carry:

View File

@ -210,8 +210,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->ceilingheight = s->floorheight-1, !back))
{ // head-below-floor hack
tempsec->floorpic = s->floorpic;
tempsec->floor_xoffs = s->floor_xoffs;
tempsec->floor_yoffs = s->floor_yoffs;
tempsec->interp_floor_xoffs = s->interp_floor_xoffs;
tempsec->interp_floor_yoffs = s->interp_floor_yoffs;
tempsec->floor_rotation = s->floor_rotation;
if (underwater)
@ -221,15 +221,15 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->floorheight = tempsec->ceilingheight+1;
tempsec->interpfloorheight = tempsec->interpceilingheight+1;
tempsec->ceilingpic = tempsec->floorpic;
tempsec->ceiling_xoffs = tempsec->floor_xoffs;
tempsec->ceiling_yoffs = tempsec->floor_yoffs;
tempsec->interp_ceiling_xoffs = tempsec->interp_floor_xoffs;
tempsec->interp_ceiling_yoffs = tempsec->interp_floor_yoffs;
tempsec->ceiling_rotation = tempsec->ceiling_rotation;
}
else
{
tempsec->ceilingpic = s->ceilingpic;
tempsec->ceiling_xoffs = s->ceiling_xoffs;
tempsec->ceiling_yoffs = s->ceiling_yoffs;
tempsec->interp_ceiling_xoffs = s->interp_ceiling_xoffs;
tempsec->interp_ceiling_yoffs = s->interp_ceiling_yoffs;
tempsec->ceiling_rotation = s->ceiling_rotation;
}
}
@ -254,8 +254,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->interpfloorheight = s->interpceilingheight + 1;
tempsec->floorpic = tempsec->ceilingpic = s->ceilingpic;
tempsec->floor_xoffs = tempsec->ceiling_xoffs = s->ceiling_xoffs;
tempsec->floor_yoffs = tempsec->ceiling_yoffs = s->ceiling_yoffs;
tempsec->interp_floor_xoffs = tempsec->interp_ceiling_xoffs = s->interp_ceiling_xoffs;
tempsec->interp_floor_yoffs = tempsec->interp_ceiling_yoffs = s->interp_ceiling_yoffs;
tempsec->floor_rotation = tempsec->ceiling_rotation = s->ceiling_rotation;
if (s->floorpic != skyflatnum)
@ -263,8 +263,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->ceilingheight = sec->ceilingheight;
tempsec->interpceilingheight = sec->interpceilingheight;
tempsec->floorpic = s->floorpic;
tempsec->floor_xoffs = s->floor_xoffs;
tempsec->floor_yoffs = s->floor_yoffs;
tempsec->interp_floor_xoffs = s->interp_floor_xoffs;
tempsec->interp_floor_yoffs = s->interp_floor_yoffs;
tempsec->floor_rotation = s->floor_rotation;
}
@ -313,34 +313,34 @@ static void R_MaybeInterpolateSector(sector_t* sector)
if (sector->old_floor_offs_gametic == gametic - 1)
{
sector->floor_xoffs = LerpFixed(sector->old_floor_xoffs, sector->base_floor_xoffs);
sector->floor_yoffs = LerpFixed(sector->old_floor_yoffs, sector->base_floor_yoffs);
sector->interp_floor_xoffs = LerpFixed(sector->old_floor_xoffs, sector->floor_xoffs);
sector->interp_floor_yoffs = LerpFixed(sector->old_floor_yoffs, sector->floor_yoffs);
}
else
{
sector->floor_xoffs = sector->base_floor_xoffs;
sector->floor_yoffs = sector->base_floor_yoffs;
sector->interp_floor_xoffs = sector->floor_xoffs;
sector->interp_floor_yoffs = sector->floor_yoffs;
}
if (sector->old_ceil_offs_gametic == gametic - 1)
{
sector->ceiling_xoffs = LerpFixed(sector->old_ceiling_xoffs, sector->base_ceiling_xoffs);
sector->ceiling_yoffs = LerpFixed(sector->old_ceiling_yoffs, sector->base_ceiling_yoffs);
sector->interp_ceiling_xoffs = LerpFixed(sector->old_ceiling_xoffs, sector->ceiling_xoffs);
sector->interp_ceiling_yoffs = LerpFixed(sector->old_ceiling_yoffs, sector->ceiling_yoffs);
}
else
{
sector->ceiling_xoffs = sector->base_ceiling_xoffs;
sector->ceiling_yoffs = sector->base_ceiling_yoffs;
sector->interp_ceiling_xoffs = sector->ceiling_xoffs;
sector->interp_ceiling_yoffs = sector->ceiling_yoffs;
}
}
else
{
sector->interpfloorheight = sector->floorheight;
sector->interpceilingheight = sector->ceilingheight;
sector->floor_xoffs = sector->base_floor_xoffs;
sector->floor_yoffs = sector->base_floor_yoffs;
sector->ceiling_xoffs = sector->base_ceiling_xoffs;
sector->ceiling_yoffs = sector->base_ceiling_yoffs;
sector->interp_floor_xoffs = sector->floor_xoffs;
sector->interp_floor_yoffs = sector->floor_yoffs;
sector->interp_ceiling_xoffs = sector->ceiling_xoffs;
sector->interp_ceiling_yoffs = sector->ceiling_yoffs;
}
}
@ -348,13 +348,13 @@ static void R_MaybeInterpolateTextureOffsets(side_t *side)
{
if (uncapped && side->oldgametic == gametic - 1)
{
side->textureoffset = LerpFixed(side->oldtextureoffset, side->basetextureoffset);
side->rowoffset = LerpFixed(side->oldrowoffset, side->baserowoffset);
side->interptextureoffset = LerpFixed(side->oldtextureoffset, side->textureoffset);
side->interprowoffset = LerpFixed(side->oldrowoffset, side->rowoffset);
}
else
{
side->textureoffset = side->basetextureoffset;
side->rowoffset = side->baserowoffset;
side->interptextureoffset = side->textureoffset;
side->interprowoffset = side->rowoffset;
}
}
@ -478,10 +478,10 @@ static void R_AddLine (seg_t *line)
&& curline->sidedef->midtexture == 0
// killough 3/7/98: Take flats offsets into account:
&& backsector->floor_xoffs == frontsector->floor_xoffs
&& backsector->floor_yoffs == frontsector->floor_yoffs
&& backsector->ceiling_xoffs == frontsector->ceiling_xoffs
&& backsector->ceiling_yoffs == frontsector->ceiling_yoffs
&& backsector->interp_floor_xoffs == frontsector->interp_floor_xoffs
&& backsector->interp_floor_yoffs == frontsector->interp_floor_yoffs
&& backsector->interp_ceiling_xoffs == frontsector->interp_ceiling_xoffs
&& backsector->interp_ceiling_yoffs == frontsector->interp_ceiling_yoffs
&& backsector->floor_rotation == frontsector->floor_rotation
&& backsector->ceiling_rotation == frontsector->ceiling_rotation
@ -646,8 +646,8 @@ static void R_Subsector(int num)
frontsector->floorsky & PL_SKYFLAT ? frontsector->floorsky :
frontsector->floorpic,
floorlightlevel, // killough 3/16/98
frontsector->floor_xoffs, // killough 3/7/98
frontsector->floor_yoffs,
frontsector->interp_floor_xoffs, // killough 3/7/98
frontsector->interp_floor_yoffs,
frontsector->floor_rotation
) : NULL;
@ -660,8 +660,8 @@ static void R_Subsector(int num)
frontsector->ceilingsky & PL_SKYFLAT ? frontsector->ceilingsky :
frontsector->ceilingpic,
ceilinglightlevel, // killough 4/11/98
frontsector->ceiling_xoffs, // killough 3/7/98
frontsector->ceiling_yoffs,
frontsector->interp_ceiling_xoffs, // killough 3/7/98
frontsector->interp_ceiling_yoffs,
frontsector->ceiling_rotation
) : NULL;

View File

@ -159,12 +159,12 @@ typedef struct sector_s
fixed_t interpfloorheight;
fixed_t interpceilingheight;
fixed_t base_floor_xoffs;
fixed_t base_floor_yoffs;
fixed_t interp_floor_xoffs;
fixed_t interp_floor_yoffs;
fixed_t old_floor_xoffs;
fixed_t old_floor_yoffs;
fixed_t base_ceiling_xoffs;
fixed_t base_ceiling_yoffs;
fixed_t interp_ceiling_xoffs;
fixed_t interp_ceiling_yoffs;
fixed_t old_ceiling_xoffs;
fixed_t old_ceiling_yoffs;
@ -197,8 +197,8 @@ typedef struct side_s
// [crispy] smooth texture scrolling
fixed_t oldtextureoffset;
fixed_t oldrowoffset;
fixed_t basetextureoffset;
fixed_t baserowoffset;
fixed_t interptextureoffset;
fixed_t interprowoffset;
int oldgametic;
} side_t;

View File

@ -417,8 +417,8 @@ static void DrawSkyTex(visplane_t *pl, sky_t *sky, skytex_t *skytex)
if (side)
{
deltax += LerpFixed(side->oldtextureoffset, side->basetextureoffset);
dc_texturemid += side->baserowoffset;
deltax += LerpFixed(side->oldtextureoffset, side->textureoffset);
dc_texturemid += side->rowoffset;
}
}
else
@ -429,8 +429,8 @@ static void DrawSkyTex(visplane_t *pl, sky_t *sky, skytex_t *skytex)
if (side)
{
deltax += side->textureoffset;
dc_texturemid += side->baserowoffset;
deltax += side->interptextureoffset;
dc_texturemid += side->rowoffset;
}
}

View File

@ -157,7 +157,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
dc_texturemid = dc_texturemid - viewz;
}
dc_texturemid += curline->sidedef->rowoffset;
dc_texturemid += curline->sidedef->interprowoffset;
if (fixedcolormap)
dc_colormap[0] = dc_colormap[1] = fixedcolormap;
@ -621,7 +621,7 @@ void R_StoreWallRange(const int start, const int stop)
else // top of texture at top
rw_midtexturemid = worldtop;
rw_midtexturemid += sidedef->rowoffset;
rw_midtexturemid += sidedef->interprowoffset;
{ // killough 3/27/98: reduce offset
fixed_t h = textureheight[sidedef->midtexture];
@ -700,8 +700,8 @@ void R_StoreWallRange(const int start, const int stop)
|| backsector->lightlevel != frontsector->lightlevel
// killough 3/7/98: Add checks for (x,y) offsets
|| backsector->floor_xoffs != frontsector->floor_xoffs
|| backsector->floor_yoffs != frontsector->floor_yoffs
|| backsector->interp_floor_xoffs != frontsector->interp_floor_xoffs
|| backsector->interp_floor_yoffs != frontsector->interp_floor_yoffs
|| backsector->floor_rotation != frontsector->floor_rotation
// killough 4/15/98: prevent 2s normals
@ -720,8 +720,8 @@ void R_StoreWallRange(const int start, const int stop)
|| backsector->lightlevel != frontsector->lightlevel
// killough 3/7/98: Add checks for (x,y) offsets
|| backsector->ceiling_xoffs != frontsector->ceiling_xoffs
|| backsector->ceiling_yoffs != frontsector->ceiling_yoffs
|| backsector->interp_ceiling_xoffs != frontsector->interp_ceiling_xoffs
|| backsector->interp_ceiling_yoffs != frontsector->interp_ceiling_yoffs
|| backsector->ceiling_rotation != frontsector->ceiling_rotation
// killough 4/15/98: prevent 2s normals
@ -750,7 +750,7 @@ void R_StoreWallRange(const int start, const int stop)
rw_bottomtexturemid = linedef->flags & ML_DONTPEGBOTTOM ? worldtop :
worldlow;
}
rw_toptexturemid += sidedef->rowoffset;
rw_toptexturemid += sidedef->interprowoffset;
// killough 3/27/98: reduce offset
{
@ -759,7 +759,7 @@ void R_StoreWallRange(const int start, const int stop)
rw_toptexturemid %= h;
}
rw_bottomtexturemid += sidedef->rowoffset;
rw_bottomtexturemid += sidedef->interprowoffset;
// killough 3/27/98: reduce offset
{
@ -785,7 +785,7 @@ void R_StoreWallRange(const int start, const int stop)
{
// [FG] fix long wall wobble
rw_offset = (fixed_t)(((dx * dx1 + dy * dy1) / len) << 1);
rw_offset += sidedef->textureoffset + curline->offset;
rw_offset += sidedef->interptextureoffset + curline->offset;
rw_centerangle = ANG90 + viewangle - rw_normalangle;