- Fixed: The UDMF parser stored plane rotation angles as fixed_t, not angle_t.

- Grouped the sector plane texture transformation options into a separate
  structure and replaced all access to them with wrapper functions.


SVN r1033 (trunk)
This commit is contained in:
Christoph Oelckers 2008-06-14 15:26:16 +00:00
parent 4a1cb412f1
commit 0e6e1da970
14 changed files with 249 additions and 201 deletions

View file

@ -1,3 +1,8 @@
June 14, 2008 (Changes by Graf Zahl)
- Fixed: The UDMF parser stored plane rotation angles as fixed_t, not angle_t.
- Grouped the sector plane texture transformation values into a separate
structure and replaced all access to them with wrapper functions.
June 12, 2008 June 12, 2008
- Add environment 255, 255 as a way to get the software underwater effect in - Add environment 255, 255 as a way to get the software underwater effect in
any zone you want. any zone you want.

View file

@ -376,10 +376,10 @@ static void LoadSectors (sectortype *bsec)
sec->floorplane.ic = FRACUNIT; sec->floorplane.ic = FRACUNIT;
sprintf (tnam, "BTIL%04d", LittleShort(bsec->floorpicnum)); sprintf (tnam, "BTIL%04d", LittleShort(bsec->floorpicnum));
sec->floorpic = TexMan.GetTexture (tnam, FTexture::TEX_Build); sec->floorpic = TexMan.GetTexture (tnam, FTexture::TEX_Build);
sec->floor_xscale = (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT; sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->floor_yscale = (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT; sec->SetYScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->floor_xoffs = (bsec->floorxpanning << FRACBITS) + (32 << FRACBITS); sec->SetXOffset(sector_t::floor, (bsec->floorxpanning << FRACBITS) + (32 << FRACBITS));
sec->floor_yoffs = bsec->floorypanning << FRACBITS; sec->SetYOffset(sector_t::floor, bsec->floorypanning << FRACBITS);
sec->FloorLight = SHADE2LIGHT (bsec->floorshade); sec->FloorLight = SHADE2LIGHT (bsec->floorshade);
sec->FloorFlags = SECF_ABSLIGHTING; sec->FloorFlags = SECF_ABSLIGHTING;
@ -394,10 +394,10 @@ static void LoadSectors (sectortype *bsec)
sky1texture = sky2texture = sec->ceilingpic; sky1texture = sky2texture = sec->ceilingpic;
sec->ceilingpic = skyflatnum; sec->ceilingpic = skyflatnum;
} }
sec->ceiling_xscale = (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT; sec->SetXScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->ceiling_yscale = (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT; sec->SetYScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->ceiling_xoffs = (bsec->ceilingxpanning << FRACBITS) + (32 << FRACBITS); sec->SetXOffset(sector_t::ceiling, (bsec->ceilingxpanning << FRACBITS) + (32 << FRACBITS));
sec->ceiling_yoffs = bsec->ceilingypanning << FRACBITS; sec->SetYOffset(sector_t::ceiling, bsec->ceilingypanning << FRACBITS);
sec->CeilingLight = SHADE2LIGHT (bsec->ceilingshade); sec->CeilingLight = SHADE2LIGHT (bsec->ceilingshade);
sec->CeilingFlags = SECF_ABSLIGHTING; sec->CeilingFlags = SECF_ABSLIGHTING;
@ -414,30 +414,30 @@ static void LoadSectors (sectortype *bsec)
if (bsec->floorstat & 4) if (bsec->floorstat & 4)
{ {
sec->floor_angle = ANGLE_90; sec->SetAngle(sector_t::floor, ANGLE_90);
sec->floor_xscale = -sec->floor_xscale; sec->SetXScale(sector_t::floor, -sec->GetXScale(sector_t::floor));
} }
if (bsec->floorstat & 16) if (bsec->floorstat & 16)
{ {
sec->floor_xscale = -sec->floor_xscale; sec->SetXScale(sector_t::floor, -sec->GetXScale(sector_t::floor));
} }
if (bsec->floorstat & 32) if (bsec->floorstat & 32)
{ {
sec->floor_yscale = -sec->floor_yscale; sec->SetYScale(sector_t::floor, -sec->GetYScale(sector_t::floor));
} }
if (bsec->ceilingstat & 4) if (bsec->ceilingstat & 4)
{ {
sec->ceiling_angle = ANGLE_90; sec->SetAngle(sector_t::ceiling, ANGLE_90);
sec->floor_yscale = -sec->floor_yscale; sec->SetYScale(sector_t::ceiling, -sec->GetYScale(sector_t::ceiling));
} }
if (bsec->ceilingstat & 16) if (bsec->ceilingstat & 16)
{ {
sec->ceiling_xscale = -sec->ceiling_xscale; sec->SetXScale(sector_t::ceiling, -sec->GetXScale(sector_t::ceiling));
} }
if (bsec->ceilingstat & 32) if (bsec->ceilingstat & 32)
{ {
sec->ceiling_yscale = -sec->ceiling_yscale; sec->SetYScale(sector_t::ceiling, -sec->GetYScale(sector_t::ceiling));
} }
} }
} }
@ -512,7 +512,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
} }
sides[i].TexelLength = walls[i].xrepeat * 8; sides[i].TexelLength = walls[i].xrepeat * 8;
sides[i].Light = SHADE2LIGHT(walls[i].shade); sides[i].SetLight(SHADE2LIGHT(walls[i].shade));
sides[i].Flags = WALLF_ABSLIGHTING; sides[i].Flags = WALLF_ABSLIGHTING;
sides[i].RightSide = walls[i].point2; sides[i].RightSide = walls[i].point2;
sides[walls[i].point2].LeftSide = i; sides[walls[i].point2].LeftSide = i;

View file

@ -2160,8 +2160,8 @@ FUNC(LS_Sector_SetCeilingPanning)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
sectors[secnum].ceiling_xoffs = xofs; sectors[secnum].SetXOffset(sector_t::ceiling, xofs);
sectors[secnum].ceiling_yoffs = yofs; sectors[secnum].SetYOffset(sector_t::ceiling, yofs);
} }
return true; return true;
} }
@ -2175,8 +2175,8 @@ FUNC(LS_Sector_SetFloorPanning)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
sectors[secnum].floor_xoffs = xofs; sectors[secnum].SetXOffset(sector_t::floor, xofs);
sectors[secnum].floor_yoffs = yofs; sectors[secnum].SetYOffset(sector_t::floor, yofs);
} }
return true; return true;
} }
@ -2196,9 +2196,9 @@ FUNC(LS_Sector_SetCeilingScale)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
if (xscale) if (xscale)
sectors[secnum].ceiling_xscale = xscale; sectors[secnum].SetXScale(sector_t::ceiling, arg1);
if (yscale) if (yscale)
sectors[secnum].ceiling_yscale = yscale; sectors[secnum].SetYScale(sector_t::ceiling, arg2);
} }
return true; return true;
} }
@ -2216,9 +2216,9 @@ FUNC(LS_Sector_SetFloorScale2)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
if (arg1) if (arg1)
sectors[secnum].floor_xscale = arg1; sectors[secnum].SetXScale(sector_t::floor, arg1);
if (arg2) if (arg2)
sectors[secnum].floor_yscale = arg2; sectors[secnum].SetXScale(sector_t::floor, arg1);
} }
return true; return true;
} }
@ -2236,9 +2236,9 @@ FUNC(LS_Sector_SetCeilingScale2)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
if (arg1) if (arg1)
sectors[secnum].ceiling_xscale = arg1; sectors[secnum].SetXScale(sector_t::ceiling, arg1);
if (arg2) if (arg2)
sectors[secnum].ceiling_yscale = arg2; sectors[secnum].SetXScale(sector_t::ceiling, arg1);
} }
return true; return true;
} }
@ -2258,9 +2258,9 @@ FUNC(LS_Sector_SetFloorScale)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
if (xscale) if (xscale)
sectors[secnum].floor_xscale = xscale; sectors[secnum].SetXScale(sector_t::floor, arg1);
if (yscale) if (yscale)
sectors[secnum].floor_yscale = yscale; sectors[secnum].SetXScale(sector_t::floor, arg1);
} }
return true; return true;
} }
@ -2274,8 +2274,8 @@ FUNC(LS_Sector_SetRotation)
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{ {
sectors[secnum].floor_angle = floor; sectors[secnum].SetAngle(sector_t::floor, floor);
sectors[secnum].ceiling_angle = ceiling; sectors[secnum].SetAngle(sector_t::ceiling, ceiling);
} }
return true; return true;
} }

View file

@ -311,13 +311,8 @@ void P_SerializeWorld (FArchive &arc)
<< sec->stairlock << sec->stairlock
<< sec->prevsec << sec->prevsec
<< sec->nextsec << sec->nextsec
<< sec->floor_xoffs << sec->floor_yoffs << sec->planes[sector_t::floor]
<< sec->ceiling_xoffs << sec->ceiling_yoffs << sec->planes[sector_t::ceiling]
<< sec->floor_xscale << sec->floor_yscale
<< sec->ceiling_xscale << sec->ceiling_yscale
<< sec->floor_angle << sec->ceiling_angle
<< sec->base_ceiling_angle << sec->base_ceiling_yoffs
<< sec->base_floor_angle << sec->base_floor_yoffs
<< sec->heightsec << sec->heightsec
<< sec->bottommap << sec->midmap << sec->topmap << sec->bottommap << sec->midmap << sec->topmap
<< sec->gravity << sec->gravity
@ -428,6 +423,13 @@ FArchive &operator<< (FArchive &arc, side_t::part &p)
return arc; return arc;
} }
FArchive &operator<< (FArchive &arc, sector_t::splane &p)
{
arc << p.xform.xoffs << p.xform.yoffs << p.xform.xscale << p.xform.yscale
<< p.xform.angle << p.xform.base_yoffs << p.xform.base_angle;
return arc;
}
// //
// Thinkers // Thinkers

View file

@ -1210,10 +1210,10 @@ void P_LoadSectors (MapData * map)
ss->prevsec = -1; // stair retriggering until build completes ss->prevsec = -1; // stair retriggering until build completes
// killough 3/7/98: // killough 3/7/98:
ss->floor_xscale = FRACUNIT; // [RH] floor and ceiling scaling ss->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling
ss->floor_yscale = FRACUNIT; ss->SetYScale(sector_t::floor, FRACUNIT);
ss->ceiling_xscale = FRACUNIT; ss->SetXScale(sector_t::ceiling, FRACUNIT);
ss->ceiling_yscale = FRACUNIT; ss->SetYScale(sector_t::ceiling, FRACUNIT);
ss->heightsec = NULL; // sector used to get floor and ceiling height ss->heightsec = NULL; // sector used to get floor and ceiling height
// killough 3/7/98: end changes // killough 3/7/98: end changes

View file

@ -803,12 +803,12 @@ void DWallLightTransfer::DoTransfer (BYTE lightlevel, int target, BYTE flags)
if (flags & WLF_SIDE1 && line->sidenum[0]!=NO_SIDE) if (flags & WLF_SIDE1 && line->sidenum[0]!=NO_SIDE)
{ {
sides[line->sidenum[0]].Light = lightlevel; sides[line->sidenum[0]].SetLight(lightlevel);
} }
if (flags & WLF_SIDE2 && line->sidenum[1]!=NO_SIDE) if (flags & WLF_SIDE2 && line->sidenum[1]!=NO_SIDE)
{ {
sides[line->sidenum[1]].Light = lightlevel; sides[line->sidenum[1]].SetLight(lightlevel);
} }
} }
} }
@ -1150,13 +1150,13 @@ void DScroller::Tick ()
break; break;
case sc_floor: // killough 3/7/98: Scroll floor texture case sc_floor: // killough 3/7/98: Scroll floor texture
sectors[m_Affectee].floor_xoffs += dx; sectors[m_Affectee].AddXOffset(sector_t::floor, dx);
sectors[m_Affectee].floor_yoffs += dy; sectors[m_Affectee].AddYOffset(sector_t::floor, dy);
break; break;
case sc_ceiling: // killough 3/7/98: Scroll ceiling texture case sc_ceiling: // killough 3/7/98: Scroll ceiling texture
sectors[m_Affectee].ceiling_xoffs += dx; sectors[m_Affectee].AddXOffset(sector_t::ceiling, dx);
sectors[m_Affectee].ceiling_yoffs += dy; sectors[m_Affectee].AddYOffset(sector_t::ceiling, dy);
break; break;
// [RH] Don't actually carry anything here. That happens later. // [RH] Don't actually carry anything here. That happens later.

View file

@ -204,6 +204,11 @@ struct UDMFParser
return FLOAT2FIXED(CheckFloat(key)); return FLOAT2FIXED(CheckFloat(key));
} }
angle_t CheckAngle(const char *key)
{
return angle_t(CheckFloat(key) * ANGLE_90 / 90.);
}
bool CheckBool(const char *key) bool CheckBool(const char *key)
{ {
if (sc.TokenType == TK_True) return true; if (sc.TokenType == TK_True) return true;
@ -724,7 +729,7 @@ struct UDMFParser
break; break;
case NAME_light: case NAME_light:
sd->Light = CheckInt(key); sd->SetLight(CheckInt(key));
break; break;
case NAME_lightabsolute: case NAME_lightabsolute:
@ -767,10 +772,10 @@ struct UDMFParser
memset(sec, 0, sizeof(*sec)); memset(sec, 0, sizeof(*sec));
sec->lightlevel = 160; sec->lightlevel = 160;
sec->floor_xscale = FRACUNIT; // [RH] floor and ceiling scaling sec->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling
sec->floor_yscale = FRACUNIT; sec->SetYScale(sector_t::floor, FRACUNIT);
sec->ceiling_xscale = FRACUNIT; sec->SetXScale(sector_t::ceiling, FRACUNIT);
sec->ceiling_yscale = FRACUNIT; sec->SetYScale(sector_t::ceiling, FRACUNIT);
sec->oldspecial = !!(sec->special&SECRET_MASK); sec->oldspecial = !!(sec->special&SECRET_MASK);
sec->thinglist = NULL; sec->thinglist = NULL;
sec->touching_thinglist = NULL; // phares 3/14/98 sec->touching_thinglist = NULL; // phares 3/14/98
@ -835,43 +840,43 @@ struct UDMFParser
if (namespace_bits & (Zd|Zdt)) switch(key) if (namespace_bits & (Zd|Zdt)) switch(key)
{ {
case NAME_Xpanningfloor: case NAME_Xpanningfloor:
sec->floor_xoffs = CheckFixed(key); sec->SetXOffset(sector_t::floor, CheckFixed(key));
break; break;
case NAME_Ypanningfloor: case NAME_Ypanningfloor:
sec->floor_yoffs = CheckFixed(key); sec->SetYOffset(sector_t::floor, CheckFixed(key));
break; break;
case NAME_Xpanningceiling: case NAME_Xpanningceiling:
sec->ceiling_xoffs = CheckFixed(key); sec->SetXOffset(sector_t::ceiling, CheckFixed(key));
break; break;
case NAME_Ypanningceiling: case NAME_Ypanningceiling:
sec->ceiling_yoffs = CheckFixed(key); sec->SetYOffset(sector_t::ceiling, CheckFixed(key));
break; break;
case NAME_Xscalefloor: case NAME_Xscalefloor:
sec->floor_xscale = CheckFixed(key); sec->SetXScale(sector_t::floor, CheckFixed(key));
break; break;
case NAME_Yscalefloor: case NAME_Yscalefloor:
sec->floor_yscale = CheckFixed(key); sec->SetYScale(sector_t::floor, CheckFixed(key));
break; break;
case NAME_Xscaleceiling: case NAME_Xscaleceiling:
sec->ceiling_xscale = CheckFixed(key); sec->SetXScale(sector_t::ceiling, CheckFixed(key));
break; break;
case NAME_Yscaleceiling: case NAME_Yscaleceiling:
sec->ceiling_yscale = CheckFixed(key); sec->SetYScale(sector_t::ceiling, CheckFixed(key));
break; break;
case NAME_Rotationfloor: case NAME_Rotationfloor:
sec->floor_angle = CheckFixed(key); sec->SetAngle(sector_t::floor, CheckAngle(key));
break; break;
case NAME_Rotationceiling: case NAME_Rotationceiling:
sec->ceiling_angle = CheckFixed(key); sec->SetAngle(sector_t::ceiling, CheckAngle(key));
break; break;
case NAME_Lightfloor: case NAME_Lightfloor:

View file

@ -456,13 +456,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
if ((underwater && !back) || doorunderwater) if ((underwater && !back) || doorunderwater)
{ // head-below-floor hack { // head-below-floor hack
tempsec->floorpic = diffTex ? sec->floorpic : s->floorpic; tempsec->floorpic = diffTex ? sec->floorpic : s->floorpic;
tempsec->floor_xoffs = s->floor_xoffs; tempsec->planes[sector_t::floor].xform = s->planes[sector_t::floor].xform;
tempsec->floor_yoffs = s->floor_yoffs;
tempsec->floor_xscale = s->floor_xscale;
tempsec->floor_yscale = s->floor_yscale;
tempsec->floor_angle = s->floor_angle;
tempsec->base_floor_angle = s->base_floor_angle;
tempsec->base_floor_yoffs = s->base_floor_yoffs;
tempsec->ceilingplane = s->floorplane; tempsec->ceilingplane = s->floorplane;
tempsec->ceilingplane.FlipVert (); tempsec->ceilingplane.FlipVert ();
@ -473,24 +467,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->floorplane.FlipVert (); tempsec->floorplane.FlipVert ();
tempsec->floorplane.ChangeHeight (+1); tempsec->floorplane.ChangeHeight (+1);
tempsec->ceilingpic = tempsec->floorpic; tempsec->ceilingpic = tempsec->floorpic;
tempsec->ceiling_xoffs = tempsec->floor_xoffs; tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform;
tempsec->ceiling_yoffs = tempsec->floor_yoffs;
tempsec->ceiling_xscale = tempsec->floor_xscale;
tempsec->ceiling_yscale = tempsec->floor_yscale;
tempsec->ceiling_angle = tempsec->floor_angle;
tempsec->base_ceiling_angle = tempsec->base_floor_angle;
tempsec->base_ceiling_yoffs = tempsec->base_floor_yoffs;
} }
else else
{ {
tempsec->ceilingpic = diffTex ? s->floorpic : s->ceilingpic; tempsec->ceilingpic = diffTex ? s->floorpic : s->ceilingpic;
tempsec->ceiling_xoffs = s->ceiling_xoffs; tempsec->planes[sector_t::ceiling].xform = s->planes[sector_t::ceiling].xform;
tempsec->ceiling_yoffs = s->ceiling_yoffs;
tempsec->ceiling_xscale = s->ceiling_xscale;
tempsec->ceiling_yscale = s->ceiling_yscale;
tempsec->ceiling_angle = s->ceiling_angle;
tempsec->base_ceiling_angle = s->base_ceiling_angle;
tempsec->base_ceiling_yoffs = s->base_ceiling_yoffs;
} }
if (!(s->MoreFlags & SECF_NOFAKELIGHT)) if (!(s->MoreFlags & SECF_NOFAKELIGHT))
@ -521,23 +503,13 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
tempsec->ceilingpic = diffTex ? sec->ceilingpic : s->ceilingpic; tempsec->ceilingpic = diffTex ? sec->ceilingpic : s->ceilingpic;
tempsec->floorpic = s->ceilingpic; tempsec->floorpic = s->ceilingpic;
tempsec->floor_xoffs = tempsec->ceiling_xoffs = s->ceiling_xoffs; tempsec->planes[sector_t::ceiling].xform = tempsec->planes[sector_t::floor].xform = s->planes[sector_t::ceiling].xform;
tempsec->floor_yoffs = tempsec->ceiling_yoffs = s->ceiling_yoffs;
tempsec->floor_xscale = tempsec->ceiling_xscale = s->ceiling_xscale;
tempsec->floor_yscale = tempsec->ceiling_yscale = s->ceiling_yscale;
tempsec->floor_angle = tempsec->ceiling_angle = s->ceiling_angle;
tempsec->base_floor_angle = tempsec->base_ceiling_angle = s->base_ceiling_angle;
tempsec->base_floor_yoffs = tempsec->base_ceiling_yoffs = s->base_ceiling_yoffs;
if (s->floorpic != skyflatnum) if (s->floorpic != skyflatnum)
{ {
tempsec->ceilingplane = sec->ceilingplane; tempsec->ceilingplane = sec->ceilingplane;
tempsec->floorpic = s->floorpic; tempsec->floorpic = s->floorpic;
tempsec->floor_xoffs = s->floor_xoffs; tempsec->planes[sector_t::floor].xform = s->planes[sector_t::floor].xform;
tempsec->floor_yoffs = s->floor_yoffs;
tempsec->floor_xscale = s->floor_xscale;
tempsec->floor_yscale = s->floor_yscale;
tempsec->floor_angle = s->floor_angle;
} }
if (!(s->MoreFlags & SECF_NOFAKELIGHT)) if (!(s->MoreFlags & SECF_NOFAKELIGHT))
@ -782,10 +754,10 @@ void R_AddLine (seg_t *line)
|| curline->sidedef->GetTexture(side_t::mid) != 0 || curline->sidedef->GetTexture(side_t::mid) != 0
// killough 3/7/98: Take flats offsets into account: // killough 3/7/98: Take flats offsets into account:
|| backsector->floor_xoffs != frontsector->floor_xoffs || backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
|| (backsector->floor_yoffs + backsector->base_floor_yoffs) != (frontsector->floor_yoffs + backsector->base_floor_yoffs) || backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor)
|| backsector->ceiling_xoffs != frontsector->ceiling_xoffs || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling)
|| (backsector->ceiling_yoffs + backsector->base_ceiling_yoffs) != (frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs) || backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
|| backsector->FloorLight != frontsector->FloorLight || backsector->FloorLight != frontsector->FloorLight
|| backsector->CeilingLight != frontsector->CeilingLight || backsector->CeilingLight != frontsector->CeilingLight
@ -796,14 +768,14 @@ void R_AddLine (seg_t *line)
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
// [RH] and scaling // [RH] and scaling
|| backsector->floor_xscale != frontsector->floor_xscale || backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|| backsector->floor_yscale != frontsector->floor_yscale || backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|| backsector->ceiling_xscale != frontsector->ceiling_xscale || backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|| backsector->ceiling_yscale != frontsector->ceiling_yscale || backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
// [RH] and rotation // [RH] and rotation
|| (backsector->floor_angle + backsector->base_floor_angle) != (frontsector->floor_angle + frontsector->base_floor_angle) || backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|| (backsector->ceiling_angle + backsector->base_ceiling_angle) != (frontsector->ceiling_angle + frontsector->base_ceiling_angle) || backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
) )
{ {
solid = false; solid = false;
@ -1078,11 +1050,11 @@ void R_Subsector (subsector_t *sub)
frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->ceilingpic, frontsector->ceilingpic,
ceilinglightlevel + r_actualextralight, // killough 4/11/98 ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->ceiling_xoffs, // killough 3/7/98 frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98
frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs, frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98
frontsector->ceiling_xscale, frontsector->GetXScale(sector_t::ceiling),
frontsector->ceiling_yscale, frontsector->GetYScale(sector_t::ceiling),
frontsector->ceiling_angle + frontsector->base_ceiling_angle, frontsector->GetAngle(sector_t::ceiling),
frontsector->CeilingSkyBox frontsector->CeilingSkyBox
) : NULL; ) : NULL;
@ -1103,11 +1075,11 @@ void R_Subsector (subsector_t *sub)
frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->floorpic, frontsector->floorpic,
floorlightlevel + r_actualextralight, // killough 3/16/98 floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->floor_xoffs, // killough 3/7/98 frontsector->GetXOffset(sector_t::floor), // killough 3/7/98
frontsector->floor_yoffs + frontsector->base_floor_yoffs, frontsector->GetYOffset(sector_t::floor), // killough 3/7/98
frontsector->floor_xscale, frontsector->GetXScale(sector_t::floor),
frontsector->floor_yscale, frontsector->GetYScale(sector_t::floor),
frontsector->floor_angle + frontsector->base_floor_angle, frontsector->GetAngle(sector_t::floor),
frontsector->FloorSkyBox frontsector->FloorSkyBox
) : NULL; ) : NULL;

View file

@ -319,6 +319,20 @@ struct extsector_t
void Serialize(FArchive &arc); void Serialize(FArchive &arc);
}; };
struct FTransform
{
// killough 3/7/98: floor and ceiling texture offsets
fixed_t xoffs, yoffs;
// [RH] floor and ceiling texture scales
fixed_t xscale, yscale;
// [RH] floor and ceiling texture rotation
angle_t angle;
// base values
fixed_t base_angle, base_yoffs;
};
struct sector_t struct sector_t
{ {
@ -347,6 +361,102 @@ struct sector_t
DInterpolation *SetInterpolation(int position, bool attach); DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position); void StopInterpolation(int position);
enum
{
floor,
ceiling
};
struct splane
{
FTransform xform;
};
splane planes[2];
void SetXOffset(int pos, fixed_t o)
{
planes[pos].xform.xoffs = o;
}
void AddXOffset(int pos, fixed_t o)
{
planes[pos].xform.xoffs += o;
}
fixed_t GetXOffset(int pos) const
{
return planes[pos].xform.xoffs;
}
void SetYOffset(int pos, fixed_t o)
{
planes[pos].xform.yoffs = o;
}
void AddYOffset(int pos, fixed_t o)
{
planes[pos].xform.yoffs += o;
}
fixed_t GetYOffset(int pos, bool addbase = true) const
{
if (!addbase)
{
return planes[pos].xform.yoffs;
}
else
{
return planes[pos].xform.yoffs + planes[pos].xform.base_yoffs;
}
}
void SetXScale(int pos, fixed_t o)
{
planes[pos].xform.xscale = o;
}
fixed_t GetXScale(int pos) const
{
return planes[pos].xform.xscale;
}
void SetYScale(int pos, fixed_t o)
{
planes[pos].xform.yscale = o;
}
fixed_t GetYScale(int pos) const
{
return planes[pos].xform.yscale;
}
void SetAngle(int pos, angle_t o)
{
planes[pos].xform.angle = o;
}
angle_t GetAngle(int pos, bool addbase = true) const
{
if (!addbase)
{
return planes[pos].xform.angle;
}
else
{
return planes[pos].xform.angle + planes[pos].xform.base_angle;
}
}
void SetBase(int pos, fixed_t y, angle_t o)
{
planes[pos].xform.base_yoffs = y;
planes[pos].xform.base_angle = o;
}
// Member variables // Member variables
fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); } fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }
fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (soundorg[0], soundorg[1]); } fixed_t CenterCeiling () const { return ceilingplane.ZatPoint (soundorg[0], soundorg[1]); }
@ -358,20 +468,6 @@ struct sector_t
// [RH] give floor and ceiling even more properties // [RH] give floor and ceiling even more properties
FDynamicColormap *ColorMap; // [RH] Per-sector colormap FDynamicColormap *ColorMap; // [RH] Per-sector colormap
// killough 3/7/98: floor and ceiling texture offsets
fixed_t floor_xoffs, floor_yoffs;
fixed_t ceiling_xoffs, ceiling_yoffs;
// [RH] floor and ceiling texture scales
fixed_t floor_xscale, floor_yscale;
fixed_t ceiling_xscale, ceiling_yscale;
// [RH] floor and ceiling texture rotation
angle_t floor_angle, ceiling_angle;
fixed_t base_ceiling_angle, base_ceiling_yoffs;
fixed_t base_floor_angle, base_floor_yoffs;
BYTE FloorLight, CeilingLight; BYTE FloorLight, CeilingLight;
BYTE FloorFlags, CeilingFlags; BYTE FloorFlags, CeilingFlags;
int floorpic, ceilingpic; int floorpic, ceilingpic;
@ -456,6 +552,9 @@ struct sector_t
extsector_t * e; // This stores data that requires construction/destruction. Such data must not be copied by R_FakeFlat. extsector_t * e; // This stores data that requires construction/destruction. Such data must not be copied by R_FakeFlat.
}; };
FArchive &operator<< (FArchive &arc, sector_t::splane &p);
struct ReverbContainer; struct ReverbContainer;
struct zone_t struct zone_t
{ {
@ -504,6 +603,11 @@ struct side_t
int GetLightLevel (bool foggy, int baselight) const; int GetLightLevel (bool foggy, int baselight) const;
void SetLight(SWORD l)
{
Light = l;
}
int GetTexture(int which) const int GetTexture(int which) const
{ {
return textures[which].texture; return textures[which].texture;

View file

@ -583,16 +583,8 @@ void DSectorScrollInterpolation::Destroy()
void DSectorScrollInterpolation::UpdateInterpolation() void DSectorScrollInterpolation::UpdateInterpolation()
{ {
if (!ceiling) oldx = sector->GetXOffset(ceiling);
{ oldy = sector->GetYOffset(ceiling, false);
oldx = sector->floor_xoffs;
oldy = sector->floor_yoffs;
}
else
{
oldx = sector->ceiling_xoffs;
oldy = sector->ceiling_yoffs;
}
} }
//========================================================================== //==========================================================================
@ -603,16 +595,8 @@ void DSectorScrollInterpolation::UpdateInterpolation()
void DSectorScrollInterpolation::Restore() void DSectorScrollInterpolation::Restore()
{ {
if (!ceiling) sector->SetXOffset(ceiling, bakx);
{ sector->SetYOffset(ceiling, bakx);
sector->floor_xoffs = bakx;
sector->floor_yoffs = baky;
}
else
{
sector->ceiling_xoffs = bakx;
sector->ceiling_yoffs = baky;
}
} }
//========================================================================== //==========================================================================
@ -623,25 +607,11 @@ void DSectorScrollInterpolation::Restore()
void DSectorScrollInterpolation::Interpolate(fixed_t smoothratio) void DSectorScrollInterpolation::Interpolate(fixed_t smoothratio)
{ {
fixed_t *px; bakx = sector->GetXOffset(ceiling);
fixed_t *py; baky = sector->GetYOffset(ceiling, false);
if (!ceiling) sector->SetXOffset(ceiling, oldx + FixedMul(bakx - oldx, smoothratio));
{ sector->SetYOffset(ceiling, oldy + FixedMul(baky - oldy, smoothratio));
px = &sector->floor_xoffs;
py = &sector->floor_yoffs;
}
else
{
px = &sector->ceiling_xoffs;
py = &sector->ceiling_yoffs;
}
bakx = *px;
baky = *py;
*px = oldx + FixedMul(bakx - oldx, smoothratio);
*py = oldy + FixedMul(baky - oldy, smoothratio);
} }
//========================================================================== //==========================================================================

View file

@ -1683,16 +1683,6 @@ bool R_AlignFlat (int linenum, int side, int fc)
dist = -dist; dist = -dist;
} }
if (fc) sec->SetBase(fc, dist & ((1<<(FRACBITS+8))-1), 0-angle);
{
sec->base_ceiling_angle = 0-angle;
sec->base_ceiling_yoffs = dist & ((1<<(FRACBITS+8))-1);
}
else
{
sec->base_floor_angle = 0-angle;
sec->base_floor_yoffs = dist & ((1<<(FRACBITS+8))-1);
}
return true; return true;
} }

View file

@ -1300,10 +1300,10 @@ void RP_AddLine (seg_t *line)
|| curline->sidedef->GetTexture(side_t::mid) != 0 || curline->sidedef->GetTexture(side_t::mid) != 0
// killough 3/7/98: Take flats offsets into account: // killough 3/7/98: Take flats offsets into account:
|| backsector->floor_xoffs != frontsector->floor_xoffs || backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
|| (backsector->floor_yoffs + backsector->base_floor_yoffs) != (frontsector->floor_yoffs + backsector->base_floor_yoffs) || backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor)
|| backsector->ceiling_xoffs != frontsector->ceiling_xoffs || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling)
|| (backsector->ceiling_yoffs + backsector->base_ceiling_yoffs) != (frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs) || backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
|| backsector->FloorLight != frontsector->FloorLight || backsector->FloorLight != frontsector->FloorLight
|| backsector->CeilingLight != frontsector->CeilingLight || backsector->CeilingLight != frontsector->CeilingLight
@ -1314,14 +1314,14 @@ void RP_AddLine (seg_t *line)
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
// [RH] and scaling // [RH] and scaling
|| backsector->floor_xscale != frontsector->floor_xscale || backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|| backsector->floor_yscale != frontsector->floor_yscale || backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|| backsector->ceiling_xscale != frontsector->ceiling_xscale || backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|| backsector->ceiling_yscale != frontsector->ceiling_yscale || backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
// [RH] and rotation // [RH] and rotation
|| (backsector->floor_angle + backsector->base_floor_angle) != (frontsector->floor_angle + frontsector->base_floor_angle) || backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|| (backsector->ceiling_angle + backsector->base_ceiling_angle) != (frontsector->ceiling_angle + frontsector->base_ceiling_angle) || backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
) )
{ {
solid = false; solid = false;

View file

@ -1268,8 +1268,8 @@ void R_NewWall (bool needlights)
|| backsector->floorpic != frontsector->floorpic || backsector->floorpic != frontsector->floorpic
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->floor_xoffs != frontsector->floor_xoffs || backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
|| (backsector->floor_yoffs + backsector->base_floor_yoffs) != (frontsector->floor_yoffs + frontsector->base_floor_yoffs) || backsector->GetYOffset(sector_t::floor) != frontsector->GetYOffset(sector_t::floor)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
// from bleeding through deep water // from bleeding through deep water
@ -1281,10 +1281,10 @@ void R_NewWall (bool needlights)
// [RH] Add checks for colormaps // [RH] Add checks for colormaps
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
|| backsector->floor_xscale != frontsector->floor_xscale || backsector->GetXScale(sector_t::floor) != frontsector->GetXScale(sector_t::floor)
|| backsector->floor_yscale != frontsector->floor_yscale || backsector->GetYScale(sector_t::floor) != frontsector->GetYScale(sector_t::floor)
|| (backsector->floor_angle + backsector->base_floor_angle) != (frontsector->floor_angle + frontsector->base_floor_angle) || backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|| (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX)) || (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
; ;
@ -1297,8 +1297,8 @@ void R_NewWall (bool needlights)
|| backsector->ceilingpic != frontsector->ceilingpic || backsector->ceilingpic != frontsector->ceilingpic
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->ceiling_xoffs != frontsector->ceiling_xoffs || backsector->GetXOffset(sector_t::ceiling) != frontsector->GetXOffset(sector_t::ceiling)
|| (backsector->ceiling_yoffs + backsector->base_ceiling_yoffs) != (frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs) || backsector->GetYOffset(sector_t::ceiling) != frontsector->GetYOffset(sector_t::ceiling)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
// from bleeding through fake ceilings // from bleeding through fake ceilings
@ -1310,10 +1310,10 @@ void R_NewWall (bool needlights)
// [RH] Add check for colormaps // [RH] Add check for colormaps
|| backsector->ColorMap != frontsector->ColorMap || backsector->ColorMap != frontsector->ColorMap
|| backsector->ceiling_xscale != frontsector->ceiling_xscale || backsector->GetXScale(sector_t::ceiling) != frontsector->GetXScale(sector_t::ceiling)
|| backsector->ceiling_yscale != frontsector->ceiling_yscale || backsector->GetYScale(sector_t::ceiling) != frontsector->GetYScale(sector_t::ceiling)
|| (backsector->ceiling_angle + backsector->base_ceiling_angle) != (frontsector->ceiling_angle + frontsector->base_ceiling_angle) || backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
|| (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX)) || (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
); );

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1028 #define MINSAVEVER 1033
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need // Never write a savegame with a version lower than what we need