mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- changed side_t's linenum into a linedef pointer.
SVN r1800 (trunk)
This commit is contained in:
parent
93f6f1d701
commit
e6aadca409
10 changed files with 46 additions and 42 deletions
|
@ -1,4 +1,5 @@
|
|||
September 6, 2009 (Changes by Graf Zahl)
|
||||
- changed side_t's linenum into a linedef pointer.
|
||||
- Added PinkSilver's SetActorVelocity code submission (with optimizations.)
|
||||
|
||||
September 5, 2009
|
||||
|
|
|
@ -174,7 +174,7 @@ void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
|
|||
|
||||
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);
|
||||
vertex_t *v1, *v2;
|
||||
|
||||
|
@ -234,7 +234,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
|
|||
line_t *line;
|
||||
FTextureID tex;
|
||||
|
||||
line = &lines[wall->linenum];
|
||||
line = wall->linedef;
|
||||
if (line->sidenum[0] == DWORD(wall - sides))
|
||||
{
|
||||
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
|
||||
{
|
||||
const line_t *line = &lines[wall->linenum];
|
||||
const line_t *line = wall->linedef;
|
||||
const sector_t *front, *back;
|
||||
|
||||
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)
|
||||
{
|
||||
line_t *line = &lines[wall->linenum];
|
||||
line_t *line = line = wall->linedef;
|
||||
DWORD wallnum = DWORD(wall - sides);
|
||||
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)
|
||||
{
|
||||
line_t *line = &lines[wall->linenum];
|
||||
line_t *line = line = wall->linedef;
|
||||
if (line->sidenum[0] == DWORD(wall - sides))
|
||||
{
|
||||
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)
|
||||
{
|
||||
line_t *line = &lines[wall->linenum];
|
||||
line_t *line = line = wall->linedef;;
|
||||
DWORD wallnum = DWORD(wall - sides);
|
||||
|
||||
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
|
||||
SpreadRight (rorg + DecalRight, wall,
|
||||
Length (lines[wall->linenum].dx, lines[wall->linenum].dy), ffloor);
|
||||
Length (wall->linedef->dx, wall->linedef->dy), ffloor);
|
||||
SpreadStack.Clear ();
|
||||
}
|
||||
|
||||
|
|
|
@ -519,11 +519,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
|
||||
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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
j = sides[i].linenum;
|
||||
j = int(intptr_t(sides[i].linedef));
|
||||
lines[j].sidenum[0] = i;
|
||||
lines[j].sidenum[1] = walls[i].nextwall;
|
||||
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;
|
||||
CalcPlane (slope, sectors[i].ceilingplane);
|
||||
}
|
||||
int linenum = int(intptr_t(sides[bsec->wallptr].linedef));
|
||||
if (bsec->floorstat & 64)
|
||||
{ // floor is aligned to first wall
|
||||
R_AlignFlat (sides[bsec->wallptr].linenum,
|
||||
lines[sides[bsec->wallptr].linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
|
||||
R_AlignFlat (linenum, lines[linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
|
||||
}
|
||||
if (bsec->ceilingstat & 64)
|
||||
{ // ceiling is aligned to first wall
|
||||
R_AlignFlat (sides[bsec->wallptr].linenum,
|
||||
lines[sides[bsec->wallptr].linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
|
||||
R_AlignFlat (linenum, lines[linenum].sidenum[1] == (DWORD)bsec->wallptr, 0);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < numsides; i++)
|
||||
{
|
||||
sides[i].linedef = &lines[intptr_t(sides[i].linedef)];
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -1867,8 +1867,8 @@ static void SetWallScroller (int id, int sidechoice, fixed_t dx, fixed_t dy, int
|
|||
{
|
||||
int wallnum = scroller->GetWallNum ();
|
||||
|
||||
if (wallnum >= 0 && lines[sides[wallnum].linenum].id == id &&
|
||||
lines[sides[wallnum].linenum].sidenum[sidechoice] == (DWORD)wallnum &&
|
||||
if (wallnum >= 0 && sides[wallnum].linedef->id == id &&
|
||||
sides[wallnum].linedef->sidenum[sidechoice] == (DWORD)wallnum &&
|
||||
Where == scroller->GetScrollParts())
|
||||
{
|
||||
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 ()) )
|
||||
{
|
||||
if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 &&
|
||||
lines[sides[collect.RefNum].linenum].id == id &&
|
||||
lines[sides[collect.RefNum].linenum].sidenum[sidechoice] == (DWORD)collect.RefNum &&
|
||||
sides[collect.RefNum].linedef->id == id &&
|
||||
sides[collect.RefNum].linedef->sidenum[sidechoice] == (DWORD)collect.RefNum &&
|
||||
Where == ((DScroller *)collect.Obj)->GetScrollParts())
|
||||
{
|
||||
((DScroller *)collect.Obj)->SetRate (dx, dy);
|
||||
|
|
|
@ -1755,13 +1755,13 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
|
||||
if (ld->sidenum[0] != NO_SIDE)
|
||||
{
|
||||
sides[ld->sidenum[0]].linenum = linenum;
|
||||
sides[ld->sidenum[0]].linedef = ld;
|
||||
sides[ld->sidenum[0]].TexelLength = len;
|
||||
|
||||
}
|
||||
if (ld->sidenum[1] != NO_SIDE)
|
||||
{
|
||||
sides[ld->sidenum[1]].linenum = linenum;
|
||||
sides[ld->sidenum[1]].linedef = ld;
|
||||
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
|
||||
// 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 vert = int((lineside ? line->v2 : line->v1) - vertexes);
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ static void P_LoopSidedefs ()
|
|||
for (i = 0; i < numsides; ++i)
|
||||
{
|
||||
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,
|
||||
// then consider that line to be a self-contained loop
|
||||
|
@ -2110,7 +2110,7 @@ static void P_LoopSidedefs ()
|
|||
line_t *leftline, *rightline;
|
||||
angle_t ang1, ang2, ang;
|
||||
|
||||
leftline = &lines[sides[i].linenum];
|
||||
leftline = sides[i].linedef;
|
||||
ang1 = R_PointToAngle2 (0, 0, leftline->dx, leftline->dy);
|
||||
if (!sidetemp[i].b.lineside)
|
||||
{
|
||||
|
@ -2121,7 +2121,7 @@ static void P_LoopSidedefs ()
|
|||
{
|
||||
if (sides[right].LeftSide == NO_SIDE)
|
||||
{
|
||||
rightline = &lines[sides[right].linenum];
|
||||
rightline = sides[right].linedef;
|
||||
if (rightline->frontsector != rightline->backsector)
|
||||
{
|
||||
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->SetTextureXScale(FRACUNIT);
|
||||
sd->SetTextureYScale(FRACUNIT);
|
||||
sd->linenum = NO_INDEX;
|
||||
sd->linedef = NULL;
|
||||
sd->Flags = 0;
|
||||
sd->Index = i;
|
||||
|
||||
|
|
|
@ -1146,8 +1146,8 @@ void DScroller::Tick ()
|
|||
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)))
|
||||
if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
|
||||
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);
|
||||
}
|
||||
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
|
||||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
|
||||
if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
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);
|
||||
}
|
||||
if (m_Parts & scw_mid && (lines[sides[m_Affectee].linenum].backsector == NULL ||
|
||||
!(lines[sides[m_Affectee].linenum].flags&ML_3DMIDTEX)))
|
||||
if (m_Parts & scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
// button just activated, either).
|
||||
fixed_t pt[2];
|
||||
line_t *line = &lines[side->linenum];
|
||||
line_t *line = side->linedef;
|
||||
bool playsound;
|
||||
|
||||
pt[0] = line->v1->x + (line->dx >> 1);
|
||||
|
|
|
@ -1306,7 +1306,7 @@ struct UDMFParser
|
|||
{
|
||||
int mapside = lines[line].sidenum[sd];
|
||||
sides[side] = ParsedSides[mapside];
|
||||
sides[side].linenum = line;
|
||||
sides[side].linedef = &lines[line];
|
||||
sides[side].sector = §ors[intptr_t(sides[side].sector)];
|
||||
lines[line].sidenum[sd] = side;
|
||||
|
||||
|
|
10
src/r_defs.h
10
src/r_defs.h
|
@ -156,6 +156,7 @@ public:
|
|||
//
|
||||
class DSectorEffect;
|
||||
struct sector_t;
|
||||
struct line_t;
|
||||
struct FRemapTable;
|
||||
|
||||
enum
|
||||
|
@ -348,10 +349,6 @@ struct FExtraLight
|
|||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
// Boom sector transfer information
|
||||
|
@ -747,7 +746,8 @@ struct side_t
|
|||
sector_t* sector; // Sector the SideDef is facing.
|
||||
DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
|
||||
part textures[3];
|
||||
DWORD linenum;
|
||||
line_t *linedef;
|
||||
//DWORD linenum;
|
||||
DWORD LeftSide, RightSide; // [RH] Group walls into loops
|
||||
WORD TexelLength;
|
||||
SWORD Light;
|
||||
|
|
|
@ -1465,19 +1465,19 @@ int side_t::GetLightLevel (bool foggy, int baselight) const
|
|||
if (!(Flags & WALLF_NOFAKECONTRAST))
|
||||
{
|
||||
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) &&
|
||||
lines[linenum].dx != 0)
|
||||
linedef->dx != 0)
|
||||
{
|
||||
baselight += int // OMG LEE KILLOUGH LIVES! :/
|
||||
(
|
||||
(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))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
baselight += lines[linenum].dx==0? level.WallVertLight :
|
||||
lines[linenum].dy==0? level.WallHorizLight : 0;
|
||||
baselight += linedef->dx==0? level.WallVertLight :
|
||||
linedef->dy==0? level.WallHorizLight : 0;
|
||||
}
|
||||
}
|
||||
if (!(Flags & WALLF_ABSLIGHTING))
|
||||
|
|
Loading…
Reference in a new issue