- changed side_t's linenum into a linedef pointer.

SVN r1800 (trunk)
This commit is contained in:
Christoph Oelckers 2009-09-06 18:19:28 +00:00
parent 93f6f1d701
commit e6aadca409
10 changed files with 46 additions and 42 deletions

View file

@ -1,4 +1,5 @@
September 6, 2009 (Changes by Graf Zahl) September 6, 2009 (Changes by Graf Zahl)
- changed side_t's linenum into a linedef pointer.
- Added PinkSilver's SetActorVelocity code submission (with optimizations.) - Added PinkSilver's SetActorVelocity code submission (with optimizations.)
September 5, 2009 September 5, 2009

View file

@ -174,7 +174,7 @@ void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
void DBaseDecal::GetXY (side_t *wall, fixed_t &ox, fixed_t &oy) const void DBaseDecal::GetXY (side_t *wall, fixed_t &ox, fixed_t &oy) const
{ {
line_t *line = &lines[wall->linenum]; line_t *line = wall->linedef;
DWORD wallnum = DWORD(wall - sides); DWORD wallnum = DWORD(wall - sides);
vertex_t *v1, *v2; vertex_t *v1, *v2;
@ -234,7 +234,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
line_t *line; line_t *line;
FTextureID tex; FTextureID tex;
line = &lines[wall->linenum]; line = wall->linedef;
if (line->sidenum[0] == DWORD(wall - sides)) if (line->sidenum[0] == DWORD(wall - sides))
{ {
front = line->frontsector; front = line->frontsector;
@ -304,7 +304,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
fixed_t DBaseDecal::GetRealZ (const side_t *wall) const fixed_t DBaseDecal::GetRealZ (const side_t *wall) const
{ {
const line_t *line = &lines[wall->linenum]; const line_t *line = wall->linedef;
const sector_t *front, *back; const sector_t *front, *back;
if (line->sidenum[0] == DWORD(wall - sides)) if (line->sidenum[0] == DWORD(wall - sides))
@ -358,7 +358,7 @@ fixed_t DBaseDecal::GetRealZ (const side_t *wall) const
void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y) void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y)
{ {
line_t *line = &lines[wall->linenum]; line_t *line = line = wall->linedef;
DWORD wallnum = DWORD(wall - sides); DWORD wallnum = DWORD(wall - sides);
vertex_t *v1, *v2; vertex_t *v1, *v2;
@ -392,7 +392,7 @@ void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y)
static void GetWallStuff (side_t *wall, vertex_t *&v1, fixed_t &ldx, fixed_t &ldy) static void GetWallStuff (side_t *wall, vertex_t *&v1, fixed_t &ldx, fixed_t &ldy)
{ {
line_t *line = &lines[wall->linenum]; line_t *line = line = wall->linedef;
if (line->sidenum[0] == DWORD(wall - sides)) if (line->sidenum[0] == DWORD(wall - sides))
{ {
v1 = line->v1; v1 = line->v1;
@ -414,7 +414,7 @@ static fixed_t Length (fixed_t dx, fixed_t dy)
static side_t *NextWall (const side_t *wall) static side_t *NextWall (const side_t *wall)
{ {
line_t *line = &lines[wall->linenum]; line_t *line = line = wall->linedef;;
DWORD wallnum = DWORD(wall - sides); DWORD wallnum = DWORD(wall - sides);
if (line->sidenum[0] == wallnum) if (line->sidenum[0] == wallnum)
@ -540,7 +540,7 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fix
// Then try spreading right // Then try spreading right
SpreadRight (rorg + DecalRight, wall, SpreadRight (rorg + DecalRight, wall,
Length (lines[wall->linenum].dx, lines[wall->linenum].dy), ffloor); Length (wall->linedef->dx, wall->linedef->dy), ffloor);
SpreadStack.Clear (); SpreadStack.Clear ();
} }

View file

@ -519,11 +519,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
if (walls[i].nextwall >= 0 && walls[i].nextwall <= i) if (walls[i].nextwall >= 0 && walls[i].nextwall <= i)
{ {
sides[i].linenum = sides[walls[i].nextwall].linenum; sides[i].linedef = sides[walls[i].nextwall].linedef;
} }
else else
{ {
sides[i].linenum = numlines++; sides[i].linedef = (line_t*)(intptr_t)(numlines++);
} }
} }
@ -538,7 +538,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
continue; continue;
} }
j = sides[i].linenum; j = int(intptr_t(sides[i].linedef));
lines[j].sidenum[0] = i; lines[j].sidenum[0] = i;
lines[j].sidenum[1] = walls[i].nextwall; lines[j].sidenum[1] = walls[i].nextwall;
lines[j].v1 = FindVertex (walls[i].x, walls[i].y); lines[j].v1 = FindVertex (walls[i].x, walls[i].y);
@ -620,17 +620,20 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
slope.z[0] = slope.z[1] = slope.z[2] = -bsec->ceilingz; slope.z[0] = slope.z[1] = slope.z[2] = -bsec->ceilingz;
CalcPlane (slope, sectors[i].ceilingplane); CalcPlane (slope, sectors[i].ceilingplane);
} }
int linenum = int(intptr_t(sides[bsec->wallptr].linedef));
if (bsec->floorstat & 64) if (bsec->floorstat & 64)
{ // floor is aligned to first wall { // floor is aligned to first wall
R_AlignFlat (sides[bsec->wallptr].linenum, R_AlignFlat (linenum, lines[linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
lines[sides[bsec->wallptr].linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
} }
if (bsec->ceilingstat & 64) if (bsec->ceilingstat & 64)
{ // ceiling is aligned to first wall { // ceiling is aligned to first wall
R_AlignFlat (sides[bsec->wallptr].linenum, R_AlignFlat (linenum, lines[linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
lines[sides[bsec->wallptr].linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
} }
} }
for(i = 0; i < numsides; i++)
{
sides[i].linedef = &lines[intptr_t(sides[i].linedef)];
}
} }
//========================================================================== //==========================================================================

View file

@ -1867,8 +1867,8 @@ static void SetWallScroller (int id, int sidechoice, fixed_t dx, fixed_t dy, int
{ {
int wallnum = scroller->GetWallNum (); int wallnum = scroller->GetWallNum ();
if (wallnum >= 0 && lines[sides[wallnum].linenum].id == id && if (wallnum >= 0 && sides[wallnum].linedef->id == id &&
lines[sides[wallnum].linenum].sidenum[sidechoice] == (DWORD)wallnum && sides[wallnum].linedef->sidenum[sidechoice] == (DWORD)wallnum &&
Where == scroller->GetScrollParts()) Where == scroller->GetScrollParts())
{ {
scroller->Destroy (); scroller->Destroy ();
@ -1886,8 +1886,8 @@ static void SetWallScroller (int id, int sidechoice, fixed_t dx, fixed_t dy, int
while ( (collect.Obj = iterator.Next ()) ) while ( (collect.Obj = iterator.Next ()) )
{ {
if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 && if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 &&
lines[sides[collect.RefNum].linenum].id == id && sides[collect.RefNum].linedef->id == id &&
lines[sides[collect.RefNum].linenum].sidenum[sidechoice] == (DWORD)collect.RefNum && sides[collect.RefNum].linedef->sidenum[sidechoice] == (DWORD)collect.RefNum &&
Where == ((DScroller *)collect.Obj)->GetScrollParts()) Where == ((DScroller *)collect.Obj)->GetScrollParts())
{ {
((DScroller *)collect.Obj)->SetRate (dx, dy); ((DScroller *)collect.Obj)->SetRate (dx, dy);

View file

@ -1755,13 +1755,13 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
if (ld->sidenum[0] != NO_SIDE) if (ld->sidenum[0] != NO_SIDE)
{ {
sides[ld->sidenum[0]].linenum = linenum; sides[ld->sidenum[0]].linedef = ld;
sides[ld->sidenum[0]].TexelLength = len; sides[ld->sidenum[0]].TexelLength = len;
} }
if (ld->sidenum[1] != NO_SIDE) if (ld->sidenum[1] != NO_SIDE)
{ {
sides[ld->sidenum[1]].linenum = linenum; sides[ld->sidenum[1]].linedef = ld;
sides[ld->sidenum[1]].TexelLength = len; sides[ld->sidenum[1]].TexelLength = len;
} }
@ -2056,7 +2056,7 @@ static void P_LoopSidedefs ()
{ {
// For each vertex, build a list of sidedefs that use that vertex // For each vertex, build a list of sidedefs that use that vertex
// as their left edge. // as their left edge.
line_t *line = &lines[sides[i].linenum]; line_t *line = sides[i].linedef;
int lineside = (line->sidenum[0] != (DWORD)i); int lineside = (line->sidenum[0] != (DWORD)i);
int vert = int((lineside ? line->v2 : line->v1) - vertexes); int vert = int((lineside ? line->v2 : line->v1) - vertexes);
@ -2075,7 +2075,7 @@ static void P_LoopSidedefs ()
for (i = 0; i < numsides; ++i) for (i = 0; i < numsides; ++i)
{ {
DWORD right; DWORD right;
line_t *line = &lines[sides[i].linenum]; line_t *line = sides[i].linedef;
// If the side's line only exists in a single sector, // If the side's line only exists in a single sector,
// then consider that line to be a self-contained loop // then consider that line to be a self-contained loop
@ -2110,7 +2110,7 @@ static void P_LoopSidedefs ()
line_t *leftline, *rightline; line_t *leftline, *rightline;
angle_t ang1, ang2, ang; angle_t ang1, ang2, ang;
leftline = &lines[sides[i].linenum]; leftline = sides[i].linedef;
ang1 = R_PointToAngle2 (0, 0, leftline->dx, leftline->dy); ang1 = R_PointToAngle2 (0, 0, leftline->dx, leftline->dy);
if (!sidetemp[i].b.lineside) if (!sidetemp[i].b.lineside)
{ {
@ -2121,7 +2121,7 @@ static void P_LoopSidedefs ()
{ {
if (sides[right].LeftSide == NO_SIDE) if (sides[right].LeftSide == NO_SIDE)
{ {
rightline = &lines[sides[right].linenum]; rightline = sides[right].linedef;
if (rightline->frontsector != rightline->backsector) if (rightline->frontsector != rightline->backsector)
{ {
ang2 = R_PointToAngle2 (0, 0, rightline->dx, rightline->dy); ang2 = R_PointToAngle2 (0, 0, rightline->dx, rightline->dy);
@ -2332,7 +2332,7 @@ void P_LoadSideDefs2 (MapData * map)
sd->SetTextureYOffset(LittleShort(msd->rowoffset)<<FRACBITS); sd->SetTextureYOffset(LittleShort(msd->rowoffset)<<FRACBITS);
sd->SetTextureXScale(FRACUNIT); sd->SetTextureXScale(FRACUNIT);
sd->SetTextureYScale(FRACUNIT); sd->SetTextureYScale(FRACUNIT);
sd->linenum = NO_INDEX; sd->linedef = NULL;
sd->Flags = 0; sd->Flags = 0;
sd->Index = i; sd->Index = i;

View file

@ -1146,8 +1146,8 @@ void DScroller::Tick ()
sides[m_Affectee].AddTextureXOffset(side_t::top, dx); sides[m_Affectee].AddTextureXOffset(side_t::top, dx);
sides[m_Affectee].AddTextureYOffset(side_t::top, dy); sides[m_Affectee].AddTextureYOffset(side_t::top, dy);
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL || if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX))) !(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
sides[m_Affectee].AddTextureXOffset(side_t::mid, dx); sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
sides[m_Affectee].AddTextureYOffset(side_t::mid, dy); sides[m_Affectee].AddTextureYOffset(side_t::mid, dy);
@ -1226,8 +1226,8 @@ DScroller::DScroller (EScrollType type, fixed_t dx, fixed_t dy,
{ {
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL || if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX))) !(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
} }
@ -1298,8 +1298,8 @@ DScroller::DScroller (fixed_t dx, fixed_t dy, const line_t *l,
{ {
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL || if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX))) !(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
} }

View file

@ -576,7 +576,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
// facing a big sector (and which wasn't necessarily for the // facing a big sector (and which wasn't necessarily for the
// button just activated, either). // button just activated, either).
fixed_t pt[2]; fixed_t pt[2];
line_t *line = &lines[side->linenum]; line_t *line = side->linedef;
bool playsound; bool playsound;
pt[0] = line->v1->x + (line->dx >> 1); pt[0] = line->v1->x + (line->dx >> 1);

View file

@ -1306,7 +1306,7 @@ struct UDMFParser
{ {
int mapside = lines[line].sidenum[sd]; int mapside = lines[line].sidenum[sd];
sides[side] = ParsedSides[mapside]; sides[side] = ParsedSides[mapside];
sides[side].linenum = line; sides[side].linedef = &lines[line];
sides[side].sector = &sectors[intptr_t(sides[side].sector)]; sides[side].sector = &sectors[intptr_t(sides[side].sector)];
lines[line].sidenum[sd] = side; lines[line].sidenum[sd] = side;

View file

@ -156,6 +156,7 @@ public:
// //
class DSectorEffect; class DSectorEffect;
struct sector_t; struct sector_t;
struct line_t;
struct FRemapTable; struct FRemapTable;
enum enum
@ -348,10 +349,6 @@ struct FExtraLight
void InsertLight (const secplane_t &plane, line_t *line, int type); void InsertLight (const secplane_t &plane, line_t *line, int type);
}; };
// this substructure contains a few sector properties that are stored in dynamic arrays
// These must not be copied by R_FakeFlat etc. or bad things will happen.
struct sector_t;
struct FLinkedSector struct FLinkedSector
{ {
sector_t *Sector; sector_t *Sector;
@ -359,6 +356,8 @@ struct FLinkedSector
}; };
// this substructure contains a few sector properties that are stored in dynamic arrays
// These must not be copied by R_FakeFlat etc. or bad things will happen.
struct extsector_t struct extsector_t
{ {
// Boom sector transfer information // Boom sector transfer information
@ -747,7 +746,8 @@ struct side_t
sector_t* sector; // Sector the SideDef is facing. sector_t* sector; // Sector the SideDef is facing.
DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
part textures[3]; part textures[3];
DWORD linenum; line_t *linedef;
//DWORD linenum;
DWORD LeftSide, RightSide; // [RH] Group walls into loops DWORD LeftSide, RightSide; // [RH] Group walls into loops
WORD TexelLength; WORD TexelLength;
SWORD Light; SWORD Light;

View file

@ -1465,19 +1465,19 @@ int side_t::GetLightLevel (bool foggy, int baselight) const
if (!(Flags & WALLF_NOFAKECONTRAST)) if (!(Flags & WALLF_NOFAKECONTRAST))
{ {
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) && if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) &&
lines[linenum].dx != 0) linedef->dx != 0)
{ {
baselight += int // OMG LEE KILLOUGH LIVES! :/ baselight += int // OMG LEE KILLOUGH LIVES! :/
( (
(float(level.WallHorizLight) (float(level.WallHorizLight)
+abs(atan(float(lines[linenum].dy)/float(lines[linenum].dx))/float(1.57079)) +abs(atan(float(linedef->dy)/float(linedef->dx))/float(1.57079))
*float(level.WallVertLight - level.WallHorizLight)) *float(level.WallVertLight - level.WallHorizLight))
); );
} }
else else
{ {
baselight += lines[linenum].dx==0? level.WallVertLight : baselight += linedef->dx==0? level.WallVertLight :
lines[linenum].dy==0? level.WallHorizLight : 0; linedef->dy==0? level.WallHorizLight : 0;
} }
} }
if (!(Flags & WALLF_ABSLIGHTING)) if (!(Flags & WALLF_ABSLIGHTING))