- Added new Scroll_Wall special to allow more control over wall scrolling.

Since it uses fixed point parameters it can only be used in scripts though.
- Added flags parameters to all wall scroller specials that didn't use
  all 5 args.
- Separated scrolling of the 3 different texture parts of a sidedef.
  While doing this I did some more restructuring of the sidedef structure
  and changed it so that all state changes to sidedefs that affect rendering 
  have to be made with access functions. This is not of much use to the
  software renderer but it allows far easier caching of rendering data
  for OpenGL because the only place I need to check is in the access functions.


SVN r832 (trunk)
This commit is contained in:
Christoph Oelckers 2008-03-21 17:35:49 +00:00
commit e77f83fbf6
29 changed files with 529 additions and 333 deletions

View file

@ -92,7 +92,8 @@ void DScroller::Serialize (FArchive &arc)
<< m_Control
<< m_LastHeight
<< m_vdx << m_vdy
<< m_Accel;
<< m_Accel
<< m_Parts;
}
DPusher::DPusher ()
@ -1109,8 +1110,22 @@ void DScroller::Tick ()
switch (m_Type)
{
case sc_side: // killough 3/7/98: Scroll wall texture
sides[m_Affectee].textureoffset += dx;
sides[m_Affectee].rowoffset += dy;
if (m_Parts & scw_top)
{
sides[m_Affectee].AddTextureXOffset(side_t::top, dx);
sides[m_Affectee].AddTextureYOffset(side_t::top, dy);
}
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{
sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
sides[m_Affectee].AddTextureYOffset(side_t::mid, dy);
}
if (m_Parts & scw_bottom)
{
sides[m_Affectee].AddTextureXOffset(side_t::bottom, dx);
sides[m_Affectee].AddTextureYOffset(side_t::bottom, dy);
}
break;
case sc_floor: // killough 3/7/98: Scroll floor texture
@ -1153,13 +1168,14 @@ void DScroller::Tick ()
//
DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
int control, int affectee, int accel)
int control, int affectee, int accel, int scrollpos)
: DThinker (STAT_SCROLLER)
{
m_Type = type;
m_dx = dx;
m_dy = dy;
m_Accel = accel;
m_Parts = scrollpos;
m_vdx = m_vdy = 0;
if ((m_Control = control) != -1)
m_LastHeight =
@ -1173,7 +1189,19 @@ DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
case sc_side:
sides[affectee].Flags |= WALLF_NOAUTODECALS;
setinterpolation (INTERP_WallPanning, &sides[affectee]);
if (m_Parts & scw_top)
{
sides[m_Affectee].SetInterpolation(side_t::top);
}
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{
sides[m_Affectee].SetInterpolation(side_t::mid);
}
if (m_Parts & scw_bottom)
{
sides[m_Affectee].SetInterpolation(side_t::bottom);
}
break;
case sc_floor:
@ -1194,7 +1222,19 @@ DScroller::~DScroller ()
switch (m_Type)
{
case sc_side:
stopinterpolation (INTERP_WallPanning, &sides[m_Affectee]);
if (m_Parts & scw_top)
{
sides[m_Affectee].StopInterpolation(side_t::top);
}
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{
sides[m_Affectee].StopInterpolation(side_t::mid);
}
if (m_Parts & scw_bottom)
{
sides[m_Affectee].StopInterpolation(side_t::bottom);
}
break;
case sc_floor:
@ -1218,7 +1258,7 @@ DScroller::~DScroller ()
// killough 5/25/98: cleaned up arithmetic to avoid drift due to roundoff
DScroller::DScroller (fixed_t dx, fixed_t dy, const line_t *l,
int control, int accel)
int control, int accel, int scrollpos)
: DThinker (STAT_SCROLLER)
{
fixed_t x = abs(l->dx), y = abs(l->dy), d;
@ -1234,16 +1274,30 @@ DScroller::DScroller (fixed_t dx, fixed_t dy, const line_t *l,
m_dy = y;
m_vdx = m_vdy = 0;
m_Accel = accel;
m_Parts = scrollpos;
if ((m_Control = control) != -1)
m_LastHeight = sectors[control].CenterFloor() + sectors[control].CenterCeiling();
m_Affectee = *l->sidenum;
sides[m_Affectee].Flags |= WALLF_NOAUTODECALS;
setinterpolation (INTERP_WallPanning, &sides[m_Affectee]);
if (m_Parts & scw_top)
{
sides[m_Affectee].SetInterpolation(side_t::top);
}
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
{
sides[m_Affectee].SetInterpolation(side_t::mid);
}
if (m_Parts & scw_bottom)
{
sides[m_Affectee].SetInterpolation(side_t::bottom);
}
}
// Amount (dx,dy) vector linedef is shifted right to get scroll amount
#define SCROLL_SHIFT 5
#define SCROLLTYPE(i) ((i)<=0 ? 7:(i))
// Initialize the scrollers
static void P_SpawnScrollers(void)
@ -1333,28 +1387,28 @@ static void P_SpawnScrollers(void)
case Scroll_Texture_Offsets:
// killough 3/2/98: scroll according to sidedef offsets
s = lines[i].sidenum[0];
new DScroller (DScroller::sc_side, -sides[s].textureoffset,
sides[s].rowoffset, -1, s, accel);
new DScroller (DScroller::sc_side, -sides[s].GetTextureXOffset(side_t::mid),
sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
break;
case Scroll_Texture_Left:
new DScroller (DScroller::sc_side, l->args[0] * (FRACUNIT/64), 0,
-1, lines[i].sidenum[0], accel);
-1, lines[i].sidenum[0], accel, SCROLLTYPE(l->args[1]));
break;
case Scroll_Texture_Right:
new DScroller (DScroller::sc_side, l->args[0] * (-FRACUNIT/64), 0,
-1, lines[i].sidenum[0], accel);
-1, lines[i].sidenum[0], accel, SCROLLTYPE(l->args[1]));
break;
case Scroll_Texture_Up:
new DScroller (DScroller::sc_side, 0, l->args[0] * (FRACUNIT/64),
-1, lines[i].sidenum[0], accel);
-1, lines[i].sidenum[0], accel, SCROLLTYPE(l->args[1]));
break;
case Scroll_Texture_Down:
new DScroller (DScroller::sc_side, 0, l->args[0] * (-FRACUNIT/64),
-1, lines[i].sidenum[0], accel);
-1, lines[i].sidenum[0], accel, SCROLLTYPE(l->args[1]));
break;
case Scroll_Texture_Both: