mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
# Conflicts: # src/r_bsp.cpp # src/r_plane.cpp # src/r_things.cpp
This commit is contained in:
commit
05662e5c4d
136 changed files with 1273 additions and 1162 deletions
|
@ -1168,7 +1168,6 @@ set (PCH_SOURCES
|
|||
p_udmf.cpp
|
||||
p_usdf.cpp
|
||||
p_user.cpp
|
||||
p_writemap.cpp
|
||||
p_xlat.cpp
|
||||
parsecontext.cpp
|
||||
po_man.cpp
|
||||
|
|
|
@ -779,14 +779,7 @@ public:
|
|||
// set translation
|
||||
void SetTranslation(FName trname);
|
||||
|
||||
double GetBobOffset(double ticfrac = 0) const
|
||||
{
|
||||
if (!(flags2 & MF2_FLOATBOB))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return BobSin(FloatBobPhase + level.maptime + ticfrac);
|
||||
}
|
||||
double GetBobOffset(double ticfrac = 0) const;
|
||||
|
||||
// Enter the crash state
|
||||
void Crash();
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "po_man.h"
|
||||
#include "a_keys.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
@ -601,23 +602,21 @@ CUSTOM_CVAR (Int, am_showalllines, -1, 0) // This is a cheat so don't save it.
|
|||
{
|
||||
int flagged = 0;
|
||||
int total = 0;
|
||||
if (self > 0 && numlines > 0)
|
||||
if (self > 0 && level.lines.Size() > 0)
|
||||
{
|
||||
for(int i=0;i<numlines;i++)
|
||||
for(auto &line : level.lines)
|
||||
{
|
||||
line_t *line = &lines[i];
|
||||
|
||||
// disregard intra-sector lines
|
||||
if (line->frontsector == line->backsector) continue;
|
||||
if (line.frontsector == line.backsector) continue;
|
||||
|
||||
// disregard control sectors for deep water
|
||||
if (line->frontsector->e->FakeFloor.Sectors.Size() > 0) continue;
|
||||
if (line.frontsector->e->FakeFloor.Sectors.Size() > 0) continue;
|
||||
|
||||
// disregard control sectors for 3D-floors
|
||||
if (line->frontsector->e->XFloor.attached.Size() > 0) continue;
|
||||
if (line.frontsector->e->XFloor.attached.Size() > 0) continue;
|
||||
|
||||
total++;
|
||||
if (line->flags & ML_DONTDRAW) flagged++;
|
||||
if (line.flags & ML_DONTDRAW) flagged++;
|
||||
}
|
||||
am_showallenabled = (flagged * 100 / total >= self);
|
||||
}
|
||||
|
@ -1030,17 +1029,17 @@ static void AM_findMinMaxBoundaries ()
|
|||
min_x = min_y = FLT_MAX;
|
||||
max_x = max_y = FIXED_MIN;
|
||||
|
||||
for (int i = 0; i < numvertexes; i++)
|
||||
for (auto &vert : level.vertexes)
|
||||
{
|
||||
if (vertexes[i].fX() < min_x)
|
||||
min_x = vertexes[i].fX();
|
||||
else if (vertexes[i].fX() > max_x)
|
||||
max_x = vertexes[i].fX();
|
||||
if (vert.fX() < min_x)
|
||||
min_x = vert.fX();
|
||||
else if (vert.fX() > max_x)
|
||||
max_x = vert.fX();
|
||||
|
||||
if (vertexes[i].fY() < min_y)
|
||||
min_y = vertexes[i].fY();
|
||||
else if (vertexes[i].fY() > max_y)
|
||||
max_y = vertexes[i].fY();
|
||||
if (vert.fY() < min_y)
|
||||
min_y = vert.fY();
|
||||
else if (vert.fY() > max_y)
|
||||
max_y = vert.fY();
|
||||
}
|
||||
|
||||
max_w = max_x - min_x;
|
||||
|
@ -2382,7 +2381,6 @@ bool AM_isLockBoundary (line_t &line, int *lockptr = NULL)
|
|||
|
||||
void AM_drawWalls (bool allmap)
|
||||
{
|
||||
int i;
|
||||
static mline_t l;
|
||||
int lock, color;
|
||||
|
||||
|
@ -2393,18 +2391,18 @@ void AM_drawWalls (bool allmap)
|
|||
if (p == MapPortalGroup) continue;
|
||||
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
int pg;
|
||||
|
||||
if (lines[i].sidedef[0]->Flags & WALLF_POLYOBJ)
|
||||
if (line.sidedef[0]->Flags & WALLF_POLYOBJ)
|
||||
{
|
||||
// For polyobjects we must test the surrounding sector to get the proper group.
|
||||
pg = P_PointInSector(lines[i].v1->fX() + lines[i].Delta().X / 2, lines[i].v1->fY() + lines[i].Delta().Y / 2)->PortalGroup;
|
||||
pg = P_PointInSector(line.v1->fX() + line.Delta().X / 2, line.v1->fY() + line.Delta().Y / 2)->PortalGroup;
|
||||
}
|
||||
else
|
||||
{
|
||||
pg = lines[i].frontsector->PortalGroup;
|
||||
pg = line.frontsector->PortalGroup;
|
||||
}
|
||||
DVector2 offset;
|
||||
bool portalmode = numportalgroups > 0 && pg != MapPortalGroup;
|
||||
|
@ -2418,10 +2416,10 @@ void AM_drawWalls (bool allmap)
|
|||
}
|
||||
else continue;
|
||||
|
||||
l.a.x = (lines[i].v1->fX() + offset.X);
|
||||
l.a.y = (lines[i].v1->fY() + offset.Y);
|
||||
l.b.x = (lines[i].v2->fX() + offset.X);
|
||||
l.b.y = (lines[i].v2->fY() + offset.Y);
|
||||
l.a.x = (line.v1->fX() + offset.X);
|
||||
l.a.y = (line.v1->fY() + offset.Y);
|
||||
l.b.x = (line.v2->fX() + offset.X);
|
||||
l.b.y = (line.v2->fY() + offset.Y);
|
||||
|
||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||
{
|
||||
|
@ -2429,9 +2427,9 @@ void AM_drawWalls (bool allmap)
|
|||
AM_rotatePoint(&l.b.x, &l.b.y);
|
||||
}
|
||||
|
||||
if (am_cheat != 0 || (lines[i].flags & ML_MAPPED))
|
||||
if (am_cheat != 0 || (line.flags & ML_MAPPED))
|
||||
{
|
||||
if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4))
|
||||
if ((line.flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4))
|
||||
{
|
||||
if (!am_showallenabled || CheckCheatmode(false))
|
||||
{
|
||||
|
@ -2443,27 +2441,27 @@ void AM_drawWalls (bool allmap)
|
|||
{
|
||||
AM_drawMline(&l, AMColors.PortalColor);
|
||||
}
|
||||
else if (AM_CheckSecret(&lines[i]))
|
||||
else if (AM_CheckSecret(&line))
|
||||
{
|
||||
// map secret sectors like Boom
|
||||
AM_drawMline(&l, AMColors.SecretSectorColor);
|
||||
}
|
||||
else if (lines[i].flags & ML_SECRET)
|
||||
else if (line.flags & ML_SECRET)
|
||||
{ // secret door
|
||||
if (am_cheat != 0 && lines[i].backsector != NULL)
|
||||
if (am_cheat != 0 && line.backsector != NULL)
|
||||
AM_drawMline(&l, AMColors.SecretWallColor);
|
||||
else
|
||||
AM_drawMline(&l, AMColors.WallColor);
|
||||
}
|
||||
else if (AM_isTeleportBoundary(lines[i]) && AMColors.isValid(AMColors.IntraTeleportColor))
|
||||
else if (AM_isTeleportBoundary(line) && AMColors.isValid(AMColors.IntraTeleportColor))
|
||||
{ // intra-level teleporters
|
||||
AM_drawMline(&l, AMColors.IntraTeleportColor);
|
||||
}
|
||||
else if (AM_isExitBoundary(lines[i]) && AMColors.isValid(AMColors.InterTeleportColor))
|
||||
else if (AM_isExitBoundary(line) && AMColors.isValid(AMColors.InterTeleportColor))
|
||||
{ // inter-level/game-ending teleporters
|
||||
AM_drawMline(&l, AMColors.InterTeleportColor);
|
||||
}
|
||||
else if (AM_isLockBoundary(lines[i], &lock))
|
||||
else if (AM_isLockBoundary(line, &lock))
|
||||
{
|
||||
if (AMColors.displayLocks)
|
||||
{
|
||||
|
@ -2483,25 +2481,25 @@ void AM_drawWalls (bool allmap)
|
|||
}
|
||||
else if (am_showtriggerlines
|
||||
&& AMColors.isValid(AMColors.SpecialWallColor)
|
||||
&& AM_isTriggerBoundary(lines[i]))
|
||||
&& AM_isTriggerBoundary(line))
|
||||
{
|
||||
AM_drawMline(&l, AMColors.SpecialWallColor); // wall with special non-door action the player can do
|
||||
}
|
||||
else if (lines[i].backsector == NULL)
|
||||
else if (line.backsector == NULL)
|
||||
{
|
||||
AM_drawMline(&l, AMColors.WallColor); // one-sided wall
|
||||
}
|
||||
else if (lines[i].backsector->floorplane
|
||||
!= lines[i].frontsector->floorplane)
|
||||
else if (line.backsector->floorplane
|
||||
!= line.frontsector->floorplane)
|
||||
{
|
||||
AM_drawMline(&l, AMColors.FDWallColor); // floor level change
|
||||
}
|
||||
else if (lines[i].backsector->ceilingplane
|
||||
!= lines[i].frontsector->ceilingplane)
|
||||
else if (line.backsector->ceilingplane
|
||||
!= line.frontsector->ceilingplane)
|
||||
{
|
||||
AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change
|
||||
}
|
||||
else if (AM_Check3DFloors(&lines[i]))
|
||||
else if (AM_Check3DFloors(&line))
|
||||
{
|
||||
AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border
|
||||
}
|
||||
|
@ -2512,7 +2510,7 @@ void AM_drawWalls (bool allmap)
|
|||
}
|
||||
else if (allmap)
|
||||
{
|
||||
if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4))
|
||||
if ((line.flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4))
|
||||
{
|
||||
if (!am_showallenabled || CheckCheatmode(false))
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "d_player.h"
|
||||
#include "g_level.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "c_functions.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
extern FILE *Logfile;
|
||||
extern bool insave;
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "d_player.h"
|
||||
#include "gstrings.h"
|
||||
#include "c_consolebuffer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "p_tags.h"
|
||||
#include "r_state.h"
|
||||
#include "w_wad.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -475,9 +476,9 @@ void SetCompatibilityParams()
|
|||
{
|
||||
case CP_CLEARFLAGS:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
line_t *line = &lines[CompatParams[i+1]];
|
||||
line_t *line = &level.lines[CompatParams[i+1]];
|
||||
line->flags &= ~CompatParams[i+2];
|
||||
}
|
||||
i+=3;
|
||||
|
@ -485,9 +486,9 @@ void SetCompatibilityParams()
|
|||
}
|
||||
case CP_SETFLAGS:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
line_t *line = &lines[CompatParams[i+1]];
|
||||
line_t *line = &level.lines[CompatParams[i+1]];
|
||||
line->flags |= CompatParams[i+2];
|
||||
}
|
||||
i+=3;
|
||||
|
@ -495,9 +496,9 @@ void SetCompatibilityParams()
|
|||
}
|
||||
case CP_SETSPECIAL:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
line_t *line = &lines[CompatParams[i+1]];
|
||||
line_t *line = &level.lines[CompatParams[i+1]];
|
||||
line->special = CompatParams[i+2];
|
||||
for(int ii=0;ii<5;ii++)
|
||||
{
|
||||
|
@ -509,9 +510,9 @@ void SetCompatibilityParams()
|
|||
}
|
||||
case CP_CLEARSPECIAL:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
line_t *line = &lines[CompatParams[i+1]];
|
||||
line_t *line = &level.lines[CompatParams[i+1]];
|
||||
line->special = 0;
|
||||
memset(line->args, 0, sizeof(line->args));
|
||||
}
|
||||
|
@ -520,9 +521,9 @@ void SetCompatibilityParams()
|
|||
}
|
||||
case CP_SETACTIVATION:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
line_t *line = &lines[CompatParams[i+1]];
|
||||
line_t *line = &level.lines[CompatParams[i+1]];
|
||||
line->activation = CompatParams[i+2];
|
||||
}
|
||||
i += 3;
|
||||
|
@ -552,9 +553,9 @@ void SetCompatibilityParams()
|
|||
}
|
||||
case CP_SETWALLYSCALE:
|
||||
{
|
||||
if (CompatParams[i+1] < numlines)
|
||||
if ((unsigned)CompatParams[i+1] < level.lines.Size())
|
||||
{
|
||||
side_t *side = lines[CompatParams[i+1]].sidedef[CompatParams[i+2]];
|
||||
side_t *side = level.lines[CompatParams[i+1]].sidedef[CompatParams[i+2]];
|
||||
if (side != NULL)
|
||||
{
|
||||
side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4] / 65536.);
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
#include "p_local.h"
|
||||
#include "autosegs.h"
|
||||
#include "fragglescript/t_fs.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
EXTERN_CVAR(Bool, hud_althud)
|
||||
void DrawHUD();
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "a_keys.h"
|
||||
#include "intermission/intermission.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
EXTERN_CVAR (Int, disableautosave)
|
||||
EXTERN_CVAR (Int, autosavecount)
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "b_bot.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
FDecalLib DecalLibrary;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "dsectoreffect.h"
|
||||
#include "serializer.h"
|
||||
#include "virtual.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "menu/menu.h"
|
||||
#include "intermission/intermission.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -709,15 +710,15 @@ size_t DSectorMarker::PropagateMark()
|
|||
moretodo = true;
|
||||
}
|
||||
}
|
||||
if (!moretodo && sides != NULL)
|
||||
if (!moretodo && level.sides.Size() > 0)
|
||||
{
|
||||
for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < numsides; ++i)
|
||||
for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < (int)level.sides.Size(); ++i)
|
||||
{
|
||||
side_t *side = &sides[SideNum + i];
|
||||
side_t *side = &level.sides[SideNum + i];
|
||||
for(int j=0;j<3;j++) GC::Mark(side->textures[j].interpolation);
|
||||
}
|
||||
marked += i * sizeof(side_t);
|
||||
if (SideNum + i < numsides)
|
||||
if (SideNum + i < (int)level.sides.Size())
|
||||
{
|
||||
SideNum += i;
|
||||
moretodo = true;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "i_system.h"
|
||||
#include "g_level.h"
|
||||
#include "p_local.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
int SaveVersion;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "p_acs.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
struct FEDOptions : public FOptionalMapinfoData
|
||||
|
@ -705,7 +706,7 @@ void ProcessEDLinedef(line_t *ld, int recordnum)
|
|||
ld->flags = (ld->flags&~fmask) | eld->flags;
|
||||
ld->setAlpha(eld->alpha);
|
||||
memcpy(ld->args, eld->args, sizeof(ld->args));
|
||||
tagManager.AddLineID(int(ld - lines), eld->tag);
|
||||
tagManager.AddLineID(ld->Index(), eld->tag);
|
||||
}
|
||||
|
||||
void ProcessEDSector(sector_t *sec, int recordnum)
|
||||
|
@ -760,12 +761,12 @@ void ProcessEDSectors()
|
|||
auto numsectors = level.sectors.Size();
|
||||
int *sectorrecord = new int[numsectors];
|
||||
memset(sectorrecord, -1, numsectors * sizeof(int));
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
if (lines[i].special == Static_Init && lines[i].args[1] == Init_EDSector)
|
||||
if (line.special == Static_Init && line.args[1] == Init_EDSector)
|
||||
{
|
||||
sectorrecord[lines[i].frontsector->Index()] = lines[i].args[0];
|
||||
lines[i].special = 0;
|
||||
sectorrecord[line.frontsector->Index()] = line.args[0];
|
||||
line.special = 0;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < numsectors; i++)
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "g_level.h"
|
||||
#include "r_renderer.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "a_ammo.h"
|
||||
#include "math/cmath.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_script("FScript");
|
||||
|
||||
|
@ -2171,7 +2172,7 @@ void FParser::SF_SetLineBlocking(void)
|
|||
int i;
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
lines[i].flags = (lines[i].flags & ~(ML_BLOCKING | ML_BLOCKEVERYTHING)) | blocking;
|
||||
level.lines[i].flags = (level.lines[i].flags & ~(ML_BLOCKING | ML_BLOCKEVERYTHING)) | blocking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2194,7 +2195,7 @@ void FParser::SF_SetLineMonsterBlocking(void)
|
|||
int i;
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
lines[i].flags = (lines[i].flags & ~ML_BLOCKMONSTERS) | blocking;
|
||||
level.lines[i].flags = (level.lines[i].flags & ~ML_BLOCKMONSTERS) | blocking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2251,11 +2252,11 @@ void FParser::SF_SetLineTexture(void)
|
|||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
// bad sidedef, Hexen just SEGV'd here!
|
||||
if (lines[i].sidedef[side] != NULL)
|
||||
if (level.lines[i].sidedef[side] != NULL)
|
||||
{
|
||||
if (position >= 0 && position <= 2)
|
||||
{
|
||||
lines[i].sidedef[side]->SetTexture(position, texturenum);
|
||||
level.lines[i].sidedef[side]->SetTexture(position, texturenum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2270,7 +2271,7 @@ void FParser::SF_SetLineTexture(void)
|
|||
FLineIdIterator itr(tag);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
side_t *sided = lines[i].sidedef[side];
|
||||
side_t *sided = level.lines[i].sidedef[side];
|
||||
if(sided != NULL)
|
||||
{
|
||||
if(sections & 1) sided->SetTexture(side_t::top, picnum);
|
||||
|
@ -3363,19 +3364,19 @@ void FParser::SF_ObjState()
|
|||
void FParser::SF_LineFlag()
|
||||
{
|
||||
line_t* line;
|
||||
int linenum;
|
||||
unsigned linenum;
|
||||
int flagnum;
|
||||
|
||||
if (CheckArgs(2))
|
||||
{
|
||||
linenum = intvalue(t_argv[0]);
|
||||
if(linenum < 0 || linenum > numlines)
|
||||
if(linenum >= level.lines.Size())
|
||||
{
|
||||
script_error("LineFlag: Invalid line number.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
line = lines + linenum;
|
||||
line = &level.lines[linenum];
|
||||
|
||||
flagnum = intvalue(t_argv[1]);
|
||||
if(flagnum < 0 || (flagnum > 8 && flagnum!=15))
|
||||
|
@ -3987,9 +3988,9 @@ void FParser::SF_SetLineTrigger()
|
|||
mld.special = spec;
|
||||
mld.tag = tag;
|
||||
mld.flags = 0;
|
||||
int f = lines[i].flags;
|
||||
P_TranslateLineDef(&lines[i], &mld);
|
||||
lines[i].flags = (lines[i].flags & (ML_MONSTERSCANACTIVATE | ML_REPEAT_SPECIAL | ML_SPAC_MASK | ML_FIRSTSIDEONLY)) |
|
||||
int f = level.lines[i].flags;
|
||||
P_TranslateLineDef(&level.lines[i], &mld);
|
||||
level.lines[i].flags = (level.lines[i].flags & (ML_MONSTERSCANACTIVATE | ML_REPEAT_SPECIAL | ML_SPAC_MASK | ML_FIRSTSIDEONLY)) |
|
||||
(f & ~(ML_MONSTERSCANACTIVATE | ML_REPEAT_SPECIAL | ML_SPAC_MASK | ML_FIRSTSIDEONLY));
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "cmdlib.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "gi.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "xlat/xlat.h"
|
||||
|
||||
void T_Init();
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "doomerrors.h"
|
||||
#include "doomstat.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
#include <zlib.h>
|
||||
|
||||
#include "g_hub.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
static FRandom pr_dmspawn ("DMSpawn");
|
||||
|
@ -2241,7 +2242,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
|
|||
|
||||
// Do not even try, if we're not in a level. (Can happen after
|
||||
// a demo finishes playback.)
|
||||
if (lines == NULL || level.sectors.Size() == 0 || gamestate != GS_LEVEL)
|
||||
if (level.lines.Size() == 0 || level.sectors.Size() == 0 || gamestate != GS_LEVEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "gstrings.h"
|
||||
#include "wi_stuff.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "serializer.h"
|
||||
#include "r_utility.h"
|
||||
#include "virtual.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "virtual.h"
|
||||
#include "a_ammo.h"
|
||||
#include "c_functions.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
#include "gi.h"
|
||||
|
||||
#include "g_hub.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -376,77 +376,6 @@ struct level_info_t
|
|||
}
|
||||
};
|
||||
|
||||
struct FLevelLocals
|
||||
{
|
||||
void Tick ();
|
||||
void AddScroller (int secnum);
|
||||
|
||||
BYTE md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
|
||||
int time; // time in the hub
|
||||
int maptime; // time in the map
|
||||
int totaltime; // time in the game
|
||||
int starttime;
|
||||
int partime;
|
||||
int sucktime;
|
||||
|
||||
level_info_t *info;
|
||||
int cluster;
|
||||
int clusterflags;
|
||||
int levelnum;
|
||||
int lumpnum;
|
||||
FString LevelName;
|
||||
FString MapName; // the lump name (E1M1, MAP01, etc)
|
||||
FString NextMap; // go here when using the regular exit
|
||||
FString NextSecretMap; // map to go to when used secret exit
|
||||
EMapType maptype;
|
||||
|
||||
TStaticArray<sector_t> sectors;
|
||||
|
||||
DWORD flags;
|
||||
DWORD flags2;
|
||||
DWORD flags3;
|
||||
|
||||
DWORD fadeto; // The color the palette fades to (usually black)
|
||||
DWORD outsidefog; // The fog for sectors with sky ceilings
|
||||
|
||||
FString Music;
|
||||
int musicorder;
|
||||
int cdtrack;
|
||||
unsigned int cdid;
|
||||
FTextureID skytexture1;
|
||||
FTextureID skytexture2;
|
||||
|
||||
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
|
||||
float skyspeed2;
|
||||
|
||||
int total_secrets;
|
||||
int found_secrets;
|
||||
|
||||
int total_items;
|
||||
int found_items;
|
||||
|
||||
int total_monsters;
|
||||
int killed_monsters;
|
||||
|
||||
double gravity;
|
||||
double aircontrol;
|
||||
double airfriction;
|
||||
int airsupply;
|
||||
int DefaultEnvironment; // Default sound environment.
|
||||
|
||||
TArray<DVector2> Scrolls; // NULL if no DScrollers in this level
|
||||
|
||||
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
||||
SBYTE WallHorizLight;
|
||||
|
||||
bool FromSnapshot; // The current map was restored from a snapshot
|
||||
|
||||
double teamdamage;
|
||||
|
||||
bool IsJumpingAllowed() const;
|
||||
bool IsCrouchingAllowed() const;
|
||||
bool IsFreelookAllowed() const;
|
||||
};
|
||||
|
||||
struct cluster_info_t
|
||||
{
|
||||
|
@ -476,8 +405,6 @@ struct cluster_info_t
|
|||
#define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string
|
||||
#define CLUSTER_ALLOWINTERMISSION 0x00000100 // Allow intermissions between levels in a hub.
|
||||
|
||||
extern FLevelLocals level;
|
||||
|
||||
extern TArray<level_info_t> wadlevelinfos;
|
||||
extern TArray<cluster_info_t> wadclusterinfos;
|
||||
|
||||
|
|
101
src/g_levellocals.h
Normal file
101
src/g_levellocals.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
#pragma once
|
||||
|
||||
#include "g_level.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
struct FLevelLocals
|
||||
{
|
||||
void Tick ();
|
||||
void AddScroller (int secnum);
|
||||
|
||||
BYTE md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
|
||||
int time; // time in the hub
|
||||
int maptime; // time in the map
|
||||
int totaltime; // time in the game
|
||||
int starttime;
|
||||
int partime;
|
||||
int sucktime;
|
||||
|
||||
level_info_t *info;
|
||||
int cluster;
|
||||
int clusterflags;
|
||||
int levelnum;
|
||||
int lumpnum;
|
||||
FString LevelName;
|
||||
FString MapName; // the lump name (E1M1, MAP01, etc)
|
||||
FString NextMap; // go here when using the regular exit
|
||||
FString NextSecretMap; // map to go to when used secret exit
|
||||
EMapType maptype;
|
||||
|
||||
TStaticArray<vertex_t> vertexes;
|
||||
TStaticArray<sector_t> sectors;
|
||||
TStaticArray<line_t> lines;
|
||||
TStaticArray<side_t> sides;
|
||||
|
||||
DWORD flags;
|
||||
DWORD flags2;
|
||||
DWORD flags3;
|
||||
|
||||
DWORD fadeto; // The color the palette fades to (usually black)
|
||||
DWORD outsidefog; // The fog for sectors with sky ceilings
|
||||
|
||||
FString Music;
|
||||
int musicorder;
|
||||
int cdtrack;
|
||||
unsigned int cdid;
|
||||
FTextureID skytexture1;
|
||||
FTextureID skytexture2;
|
||||
|
||||
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
|
||||
float skyspeed2;
|
||||
|
||||
int total_secrets;
|
||||
int found_secrets;
|
||||
|
||||
int total_items;
|
||||
int found_items;
|
||||
|
||||
int total_monsters;
|
||||
int killed_monsters;
|
||||
|
||||
double gravity;
|
||||
double aircontrol;
|
||||
double airfriction;
|
||||
int airsupply;
|
||||
int DefaultEnvironment; // Default sound environment.
|
||||
|
||||
TArray<DVector2> Scrolls; // NULL if no DScrollers in this level
|
||||
|
||||
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
||||
SBYTE WallHorizLight;
|
||||
|
||||
bool FromSnapshot; // The current map was restored from a snapshot
|
||||
|
||||
double teamdamage;
|
||||
|
||||
bool IsJumpingAllowed() const;
|
||||
bool IsCrouchingAllowed() const;
|
||||
bool IsFreelookAllowed() const;
|
||||
};
|
||||
|
||||
extern FLevelLocals level;
|
||||
|
||||
inline int vertex_t::Index() const
|
||||
{
|
||||
return int(this - &level.vertexes[0]);
|
||||
}
|
||||
|
||||
inline int side_t::Index() const
|
||||
{
|
||||
return int(this - &level.sides[0]);
|
||||
}
|
||||
|
||||
inline int line_t::Index() const
|
||||
{
|
||||
return int(this - &level.lines[0]);
|
||||
}
|
||||
|
||||
inline int sector_t::Index() const
|
||||
{
|
||||
return int(this - &level.sectors[0]);
|
||||
}
|
|
@ -51,6 +51,7 @@
|
|||
#include "autosegs.h"
|
||||
#include "version.h"
|
||||
#include "v_text.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
TArray<cluster_info_t> wadclusterinfos;
|
||||
TArray<level_info_t> wadlevelinfos;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "serializer.h"
|
||||
#include "doomdata.h"
|
||||
#include "r_state.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static double DecalWidth, DecalLeft, DecalRight;
|
||||
static double SpreadZ;
|
||||
|
@ -415,7 +416,7 @@ void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor
|
|||
double x = v1->fX();
|
||||
double y = v1->fY();
|
||||
|
||||
feelwall = &sides[feelwall->LeftSide];
|
||||
feelwall = &level.sides[feelwall->LeftSide];
|
||||
GetWallStuff (feelwall, v1, ldx, ldy);
|
||||
double wallsize = Length (ldx, ldy);
|
||||
r += DecalLeft;
|
||||
|
@ -455,7 +456,7 @@ void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFl
|
|||
|
||||
while (r > wallsize && feelwall->RightSide != NO_SIDE)
|
||||
{
|
||||
feelwall = &sides[feelwall->RightSide];
|
||||
feelwall = &level.sides[feelwall->RightSide];
|
||||
|
||||
side_t *nextwall = NextWall (feelwall);
|
||||
if (nextwall != NULL && nextwall->LeftSide != NO_SIDE)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "b_bot.h"
|
||||
#include "p_checkposition.h"
|
||||
#include "virtual.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
IMPLEMENT_CLASS(AFastProjectile, false, false)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "g_level.h"
|
||||
#include "d_player.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
IMPLEMENT_CLASS(DFlashFader, false, true)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "g_level.h"
|
||||
#include "r_state.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_lightning ("Lightning");
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "d_player.h"
|
||||
#include "a_armor.h"
|
||||
#include "r_data/sprites.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_morphmonst ("MorphMonster");
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "p_lnspec.h"
|
||||
#include "doomstat.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
/*
|
||||
== InterpolationPoint: node along a camera's path
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "v_text.h"
|
||||
#include "doomstat.h"
|
||||
#include "doomdata.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
|
||||
static FRandom pr_randomspawn("RandomSpawn");
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "version.h"
|
||||
#include "cmdlib.h"
|
||||
#include "a_ammo.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
|
||||
enum
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "d_player.h"
|
||||
#include "r_utility.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "gstrings.h"
|
||||
#include "r_utility.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "v_font.h"
|
||||
#include "m_fixed.h"
|
||||
#include "gstrings.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
TArray<FSkillInfo> AllSkills;
|
||||
int DefaultSkill = -1;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// Number of tics to move the popscreen up and down.
|
||||
#define POP_TIME (TICRATE/8)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "i_system.h"
|
||||
#include "v_text.h"
|
||||
#include "r_utility.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/utility/gl_geometric.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "g_level.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
@ -547,7 +548,7 @@ CCMD(dumpgeometry)
|
|||
{
|
||||
Printf(PRINT_LOG, " (%4.4f, %4.4f), (%4.4f, %4.4f) - seg %d, linedef %d, side %d",
|
||||
seg->v1->fX(), seg->v1->fY(), seg->v2->fX(), seg->v2->fY(),
|
||||
int(seg-segs), int(seg->linedef-lines), seg->sidedef != seg->linedef->sidedef[0]);
|
||||
int(seg-segs), seg->linedef->Index(), seg->sidedef != seg->linedef->sidedef[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "gi.h"
|
||||
#include "g_level.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "gi.h"
|
||||
#include "p_setup.h"
|
||||
#include "g_level.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
@ -402,51 +403,50 @@ static void InitVertexData()
|
|||
|
||||
int i,j,k;
|
||||
|
||||
vt_sectorlists = new TArray<int>[numvertexes];
|
||||
vt_sectorlists = new TArray<int>[level.vertexes.Size()];
|
||||
|
||||
|
||||
for(i=0;i<numlines;i++)
|
||||
for(auto &line : level.lines)
|
||||
{
|
||||
line_t * line = &lines[i];
|
||||
|
||||
for(j=0;j<2;j++)
|
||||
{
|
||||
vertex_t * v = j==0? line->v1 : line->v2;
|
||||
vertex_t * v = j==0? line.v1 : line.v2;
|
||||
|
||||
for(k=0;k<2;k++)
|
||||
{
|
||||
sector_t * sec = k==0? line->frontsector : line->backsector;
|
||||
sector_t * sec = k==0? line.frontsector : line.backsector;
|
||||
|
||||
if (sec)
|
||||
{
|
||||
extsector_t::xfloor &x = sec->e->XFloor;
|
||||
|
||||
AddToVertex(sec, vt_sectorlists[v-vertexes]);
|
||||
if (sec->heightsec) AddToVertex(sec->heightsec, vt_sectorlists[v-vertexes]);
|
||||
AddToVertex(sec, vt_sectorlists[v->Index()]);
|
||||
if (sec->heightsec) AddToVertex(sec->heightsec, vt_sectorlists[v->Index()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<numvertexes;i++)
|
||||
for(i=0;i<level.vertexes.Size();i++)
|
||||
{
|
||||
auto vert = level.vertexes[i];
|
||||
int cnt = vt_sectorlists[i].Size();
|
||||
|
||||
vertexes[i].dirty = true;
|
||||
vertexes[i].numheights=0;
|
||||
vert.dirty = true;
|
||||
vert.numheights=0;
|
||||
if (cnt>1)
|
||||
{
|
||||
vertexes[i].numsectors= cnt;
|
||||
vertexes[i].sectors=new sector_t*[cnt];
|
||||
vertexes[i].heightlist = new float[cnt*2];
|
||||
vert.numsectors= cnt;
|
||||
vert.sectors=new sector_t*[cnt];
|
||||
vert.heightlist = new float[cnt*2];
|
||||
for(int j=0;j<cnt;j++)
|
||||
{
|
||||
vertexes[i].sectors[j] = &level.sectors[vt_sectorlists[i][j]];
|
||||
vert.sectors[j] = &level.sectors[vt_sectorlists[i][j]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vertexes[i].numsectors=0;
|
||||
vert.numsectors=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,8 +461,8 @@ static void InitVertexData()
|
|||
|
||||
static void GetSideVertices(int sdnum, DVector2 *v1, DVector2 *v2)
|
||||
{
|
||||
line_t *ln = sides[sdnum].linedef;
|
||||
if (ln->sidedef[0] == &sides[sdnum])
|
||||
line_t *ln = level.sides[sdnum].linedef;
|
||||
if (ln->sidedef[0] == &level.sides[sdnum])
|
||||
{
|
||||
*v1 = ln->v1->fPos();
|
||||
*v2 = ln->v2->fPos();
|
||||
|
@ -489,54 +489,25 @@ static int segcmp(const void *a, const void *b)
|
|||
|
||||
static void PrepareSegs()
|
||||
{
|
||||
auto numsides = level.sides.Size();
|
||||
int *segcount = new int[numsides];
|
||||
int realsegs = 0;
|
||||
|
||||
// Get floatng point coordinates of vertices
|
||||
for(int i = 0; i < numvertexes; i++)
|
||||
for(auto &v : level.vertexes)
|
||||
{
|
||||
vertexes[i].dirty = true;
|
||||
v.dirty = true;
|
||||
}
|
||||
|
||||
// count the segs
|
||||
memset(segcount, 0, numsides * sizeof(int));
|
||||
|
||||
// set up the extra data in case the map was loaded with regular nodes that might pass as GL nodes.
|
||||
if (glsegextras == NULL)
|
||||
{
|
||||
for(int i=0;i<numsegs;i++)
|
||||
{
|
||||
segs[i].PartnerSeg = NULL;
|
||||
}
|
||||
for (int i=0; i<numsubsectors; i++)
|
||||
{
|
||||
int seg = int(subsectors[i].firstline-segs);
|
||||
for(DWORD j=0;j<subsectors[i].numlines;j++)
|
||||
{
|
||||
segs[j+seg].Subsector = &subsectors[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<numsegs;i++)
|
||||
{
|
||||
seg_t *seg = &segs[i];
|
||||
|
||||
// Account for ZDoom space optimizations that cannot be done for GL
|
||||
unsigned int partner= glsegextras[i].PartnerSeg;
|
||||
if (partner < unsigned(numsegs)) seg->PartnerSeg = &segs[partner];
|
||||
else seg->PartnerSeg = NULL;
|
||||
seg->Subsector = glsegextras[i].Subsector;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<numsegs;i++)
|
||||
{
|
||||
seg_t *seg = &segs[i];
|
||||
|
||||
if (seg->sidedef == NULL) continue; // miniseg
|
||||
int sidenum = int(seg->sidedef - sides);
|
||||
int sidenum = seg->sidedef->Index();
|
||||
|
||||
realsegs++;
|
||||
segcount[sidenum]++;
|
||||
|
@ -550,13 +521,13 @@ static void PrepareSegs()
|
|||
}
|
||||
|
||||
// allocate memory
|
||||
sides[0].segs = new seg_t*[realsegs];
|
||||
sides[0].numsegs = 0;
|
||||
level.sides[0].segs = new seg_t*[realsegs];
|
||||
level.sides[0].numsegs = 0;
|
||||
|
||||
for(int i = 1; i < numsides; i++)
|
||||
{
|
||||
sides[i].segs = sides[i-1].segs + segcount[i-1];
|
||||
sides[i].numsegs = 0;
|
||||
level.sides[i].segs = level.sides[i-1].segs + segcount[i-1];
|
||||
level.sides[i].numsegs = 0;
|
||||
}
|
||||
delete [] segcount;
|
||||
|
||||
|
@ -570,7 +541,7 @@ static void PrepareSegs()
|
|||
// sort the segs
|
||||
for(int i = 0; i < numsides; i++)
|
||||
{
|
||||
if (sides[i].numsegs > 1) qsort(sides[i].segs, sides[i].numsegs, sizeof(seg_t*), segcmp);
|
||||
if (level.sides[i].numsegs > 1) qsort(level.sides[i].segs, level.sides[i].numsegs, sizeof(seg_t*), segcmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -586,8 +557,8 @@ void gl_PreprocessLevel()
|
|||
PrepareSegs();
|
||||
PrepareSectorData();
|
||||
InitVertexData();
|
||||
int *checkmap = new int[numvertexes];
|
||||
memset(checkmap, -1, sizeof(int)*numvertexes);
|
||||
int *checkmap = new int[level.vertexes.Size()];
|
||||
memset(checkmap, -1, sizeof(int)*level.vertexes.Size());
|
||||
for(auto &sec : level.sectors)
|
||||
{
|
||||
int i = sec.sectornum;
|
||||
|
@ -598,21 +569,21 @@ void gl_PreprocessLevel()
|
|||
{
|
||||
if (l->sidedef[0]->Flags & WALLF_POLYOBJ) continue; // don't bother with polyobjects
|
||||
|
||||
int vtnum1 = int(l->v1 - vertexes);
|
||||
int vtnum2 = int(l->v2 - vertexes);
|
||||
int vtnum1 = l->v1->Index();
|
||||
int vtnum2 = l->v2->Index();
|
||||
|
||||
if (checkmap[vtnum1] < i)
|
||||
{
|
||||
checkmap[vtnum1] = i;
|
||||
sec.e->vertices.Push(&vertexes[vtnum1]);
|
||||
vertexes[vtnum1].dirty = true;
|
||||
sec.e->vertices.Push(&level.vertexes[vtnum1]);
|
||||
level.vertexes[vtnum1].dirty = true;
|
||||
}
|
||||
|
||||
if (checkmap[vtnum2] < i)
|
||||
{
|
||||
checkmap[vtnum2] = i;
|
||||
sec.e->vertices.Push(&vertexes[vtnum2]);
|
||||
vertexes[vtnum2].dirty = true;
|
||||
sec.e->vertices.Push(&level.vertexes[vtnum2]);
|
||||
level.vertexes[vtnum2].dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -652,27 +623,24 @@ void gl_CleanLevelData()
|
|||
mo=next;
|
||||
}
|
||||
|
||||
if (vertexes != NULL)
|
||||
for(auto &v : level.vertexes) if (v.numsectors > 0)
|
||||
{
|
||||
for(int i = 0; i < numvertexes; i++) if (vertexes[i].numsectors > 0)
|
||||
if (v.sectors != nullptr)
|
||||
{
|
||||
if (vertexes[i].sectors != NULL)
|
||||
{
|
||||
delete [] vertexes[i].sectors;
|
||||
vertexes[i].sectors = NULL;
|
||||
}
|
||||
if (vertexes[i].heightlist != NULL)
|
||||
{
|
||||
delete [] vertexes[i].heightlist;
|
||||
vertexes[i].heightlist = NULL;
|
||||
}
|
||||
delete [] v.sectors;
|
||||
v.sectors = nullptr;
|
||||
}
|
||||
if (v.heightlist != nullptr)
|
||||
{
|
||||
delete [] v.heightlist;
|
||||
v.heightlist = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (sides && sides[0].segs)
|
||||
if (level.sides.Size() > 0 && level.sides[0].segs)
|
||||
{
|
||||
delete [] sides[0].segs;
|
||||
sides[0].segs = NULL;
|
||||
delete [] level.sides[0].segs;
|
||||
level.sides[0].segs = NULL;
|
||||
}
|
||||
if (level.sectors.Size() > 0 && level.sectors[0].subsectors)
|
||||
{
|
||||
|
@ -712,7 +680,7 @@ CCMD(listmapsections)
|
|||
{
|
||||
if (subsectors[j].mapsection == i)
|
||||
{
|
||||
Printf("Mapsection %d, sector %d, line %d\n", i, subsectors[j].render_sector->sectornum, int(subsectors[j].firstline->linedef-lines));
|
||||
Printf("Mapsection %d, sector %d, line %d\n", i, subsectors[j].render_sector->Index(), subsectors[j].firstline->linedef->Index());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "r_state.h"
|
||||
#include "m_argv.h"
|
||||
#include "c_cvars.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "portal.h"
|
||||
#include "doomstat.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "zstring.h"
|
||||
#include "d_dehacked.h"
|
||||
#include "v_text.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "g_level.h"
|
||||
#include "r_state.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
//#include "resources/voxels.h"
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "p_local.h"
|
||||
#include "g_level.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// externally settable lighting properties
|
||||
static float distfogtable[2][256]; // light to fog conversion table for black fog
|
||||
|
|
|
@ -87,7 +87,7 @@ static sector_t *currentsector;
|
|||
static void AddLine (seg_t *seg, bool portalclip)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (seg->linedef - lines == 38)
|
||||
if (seg->linedef->Index() == 38)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "r_state.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "d_player.h"
|
||||
#include "portal.h"
|
||||
#include "templates.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "r_defs.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_level.h"
|
||||
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "p_local.h"
|
||||
#include "gl/gl_functions.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/dynlights/gl_lightbuffer.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "doomdata.h"
|
||||
#include "portal.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/data/gl_data.h"
|
||||
|
@ -51,7 +52,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
|
|||
memset(this, 0, sizeof(*this));
|
||||
if ((sky1 & PL_SKYFLAT) && (sky1 & (PL_SKYFLAT - 1)))
|
||||
{
|
||||
const line_t *l = &lines[(sky1&(PL_SKYFLAT - 1)) - 1];
|
||||
const line_t *l = &level.lines[(sky1&(PL_SKYFLAT - 1)) - 1];
|
||||
const side_t *s = l->sidedef[0];
|
||||
int pos;
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "a_pickups.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "doomdata.h"
|
||||
#include "portal.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
@ -326,7 +327,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent)
|
|||
//::SplitWall.Clock();
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (seg->linedef-lines==1)
|
||||
if (seg->linedef->Index() == 1)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
@ -1414,7 +1415,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
|||
sector_t * segback;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (seg->linedef - lines < 4)
|
||||
if (seg->linedef->Index() == 1)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
@ -1547,7 +1548,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
|||
zbottom[1] = zfloor[1];
|
||||
PutPortal(PORTALTYPE_LINETOLINE);
|
||||
}
|
||||
else if (seg->linedef->portaltransferred > 0)
|
||||
else if (seg->linedef->GetTransferredPortal())
|
||||
{
|
||||
SkyLine(frontsector, seg->linedef);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "d_player.h"
|
||||
#include "g_level.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "r_utility.h"
|
||||
#include "v_video.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/utility/gl_clock.h"
|
||||
#include "gl/utility/gl_convert.h"
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "gstrings.h"
|
||||
#include "d_net.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "p_conversation.h"
|
||||
#include "menu/menu.h"
|
||||
#include "d_net.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
FIntermissionDescriptorList IntermissionDescriptors;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "a_morph.h"
|
||||
#include "a_armor.h"
|
||||
#include "a_ammo.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// [RH] Actually handle the cheat. The cheat code in st_stuff.c now just
|
||||
// writes some bytes to the network data stream, and the network code
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "v_video.h"
|
||||
#include "g_level.h"
|
||||
#include "gi.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
class DReadThisMenu : public DMenu
|
||||
|
|
|
@ -209,10 +209,10 @@ public:
|
|||
bool makeGLNodes);
|
||||
~FNodeBuilder ();
|
||||
|
||||
void Extract (node_t *&nodes, int &nodeCount,
|
||||
seg_t *&segs, glsegextra_t *&glsegextras, int &segCount,
|
||||
void Extract(node_t *&nodes, int &nodeCount,
|
||||
seg_t *&segs, int &segCount,
|
||||
subsector_t *&ssecs, int &subCount,
|
||||
vertex_t *&verts, int &vertCount);
|
||||
TStaticArray<vertex_t> &vertexes);
|
||||
const int *GetOldVertexTable();
|
||||
|
||||
// These are used for building sub-BSP trees for polyobjects.
|
||||
|
|
|
@ -53,14 +53,14 @@
|
|||
#endif
|
||||
|
||||
void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
||||
seg_t *&outSegs, glsegextra_t *&outSegExtras, int &segCount,
|
||||
seg_t *&outSegs, int &segCount,
|
||||
subsector_t *&outSubs, int &subCount,
|
||||
vertex_t *&outVerts, int &vertCount)
|
||||
TStaticArray<vertex_t> &outVerts)
|
||||
{
|
||||
int i;
|
||||
|
||||
vertCount = Vertices.Size ();
|
||||
outVerts = new vertex_t[vertCount];
|
||||
int vertCount = Vertices.Size ();
|
||||
outVerts.Alloc(vertCount);
|
||||
|
||||
for (i = 0; i < vertCount; ++i)
|
||||
{
|
||||
|
@ -109,14 +109,13 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
|
||||
for (i = 0; i < subCount; ++i)
|
||||
{
|
||||
DWORD numsegs = CloseSubsector (segs, i, outVerts);
|
||||
DWORD numsegs = CloseSubsector (segs, i, &outVerts[0]);
|
||||
outSubs[i].numlines = numsegs;
|
||||
outSubs[i].firstline = (seg_t *)(size_t)(segs.Size() - numsegs);
|
||||
}
|
||||
|
||||
segCount = segs.Size ();
|
||||
outSegs = new seg_t[segCount];
|
||||
outSegExtras = new glsegextra_t[segCount];
|
||||
|
||||
for (i = 0; i < segCount; ++i)
|
||||
{
|
||||
|
@ -124,11 +123,11 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
|
||||
if (segs[i].Partner != DWORD_MAX)
|
||||
{
|
||||
outSegExtras[i].PartnerSeg = Segs[segs[i].Partner].storedseg;
|
||||
outSegs[i].PartnerSeg = &outSegs[Segs[segs[i].Partner].storedseg];
|
||||
}
|
||||
else
|
||||
{
|
||||
outSegExtras[i].PartnerSeg = DWORD_MAX;
|
||||
outSegs[i].PartnerSeg = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +136,6 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
memcpy (outSubs, &Subsectors[0], subCount*sizeof(subsector_t));
|
||||
segCount = Segs.Size ();
|
||||
outSegs = new seg_t[segCount];
|
||||
outSegExtras = NULL;
|
||||
for (i = 0; i < segCount; ++i)
|
||||
{
|
||||
const FPrivSeg *org = &Segs[SegList[i].SegNum];
|
||||
|
@ -145,12 +143,13 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
|
||||
D(Printf(PRINT_LOG, "Seg %d: v1(%d) -> v2(%d)\n", i, org->v1, org->v2));
|
||||
|
||||
out->v1 = outVerts + org->v1;
|
||||
out->v2 = outVerts + org->v2;
|
||||
out->v1 = &outVerts[org->v1];
|
||||
out->v2 = &outVerts[org->v2];
|
||||
out->backsector = org->backsector;
|
||||
out->frontsector = org->frontsector;
|
||||
out->linedef = Level.Lines + org->linedef;
|
||||
out->sidedef = Level.Sides + org->sidedef;
|
||||
out->PartnerSeg = nullptr;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < subCount; ++i)
|
||||
|
@ -162,8 +161,8 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
|
||||
for (i = 0; i < Level.NumLines; ++i)
|
||||
{
|
||||
Level.Lines[i].v1 = outVerts + (size_t)Level.Lines[i].v1;
|
||||
Level.Lines[i].v2 = outVerts + (size_t)Level.Lines[i].v2;
|
||||
Level.Lines[i].v1 = &outVerts[(size_t)Level.Lines[i].v1];
|
||||
Level.Lines[i].v2 = &outVerts[(size_t)Level.Lines[i].v2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "i_system.h"
|
||||
#include "po_man.h"
|
||||
#include "r_state.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "math/cmath.h"
|
||||
|
||||
static const int PO_LINE_START = 1;
|
||||
|
@ -186,7 +187,7 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
|
|||
}
|
||||
seg.linedef = linenum;
|
||||
side_t *sd = Level.Lines[linenum].sidedef[sidenum];
|
||||
seg.sidedef = sd != NULL? int(sd - sides) : int(NO_SIDE);
|
||||
seg.sidedef = sd != NULL? sd->Index() : int(NO_SIDE);
|
||||
seg.nextforvert = Vertices[seg.v1].segs;
|
||||
seg.nextforvert2 = Vertices[seg.v2].segs2;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "p_spec.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
EXTERN_CVAR(Int, vid_renderer)
|
||||
|
||||
|
@ -850,16 +851,14 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
|
|||
void P_Spawn3DFloors (void)
|
||||
{
|
||||
static int flagvals[] = {512, 2+512, 512+1024};
|
||||
int i;
|
||||
line_t * line;
|
||||
|
||||
for (i=0,line=lines;i<numlines;i++,line++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
switch(line->special)
|
||||
switch(line.special)
|
||||
{
|
||||
case ExtraFloor_LightOnly:
|
||||
if (line->args[1] < 0 || line->args[1] > 2) line->args[1] = 0;
|
||||
P_Set3DFloor(line, 3, flagvals[line->args[1]], 0);
|
||||
if (line.args[1] < 0 || line.args[1] > 2) line.args[1] = 0;
|
||||
P_Set3DFloor(&line, 3, flagvals[line.args[1]], 0);
|
||||
break;
|
||||
|
||||
case Sector_Set3DFloor:
|
||||
|
@ -868,24 +867,24 @@ void P_Spawn3DFloors (void)
|
|||
// In Doom format the translators can take full integers for the tag and the line ID always is the same as the tag.
|
||||
if (level.maptype == MAPTYPE_HEXEN)
|
||||
{
|
||||
if (line->args[1]&8)
|
||||
if (line.args[1]&8)
|
||||
{
|
||||
tagManager.AddLineID(i, line->args[4]);
|
||||
tagManager.AddLineID(line.Index(), line.args[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
line->args[0]+=256*line->args[4];
|
||||
line->args[4]=0;
|
||||
line.args[0]+=256*line.args[4];
|
||||
line.args[4]=0;
|
||||
}
|
||||
}
|
||||
P_Set3DFloor(line, line->args[1]&~8, line->args[2], line->args[3]);
|
||||
P_Set3DFloor(&line, line.args[1]&~8, line.args[2], line.args[3]);
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
line->special=0;
|
||||
line->args[0] = line->args[1] = line->args[2] = line->args[3] = line->args[4] = 0;
|
||||
line.special=0;
|
||||
line.args[0] = line.args[1] = line.args[2] = line.args[3] = line.args[4] = 0;
|
||||
}
|
||||
// kg3D - do it in software
|
||||
for (auto &sec : level.sectors)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "p_terrain.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
@ -121,10 +122,10 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c
|
|||
extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor;
|
||||
|
||||
// Bit arrays that mark whether a line or sector is to be attached.
|
||||
BYTE *found_lines = new BYTE[(numlines+7)/8];
|
||||
BYTE *found_lines = new BYTE[(level.lines.Size()+7)/8];
|
||||
BYTE *found_sectors = new BYTE[(level.sectors.Size()+7)/8];
|
||||
|
||||
memset(found_lines, 0, sizeof (BYTE) * ((numlines+7)/8));
|
||||
memset(found_lines, 0, sizeof (BYTE) * ((level.lines.Size()+7)/8));
|
||||
memset(found_sectors, 0, sizeof (BYTE) * ((level.sectors.Size()+7)/8));
|
||||
|
||||
// mark all lines and sectors that are already attached to this one
|
||||
|
@ -132,13 +133,13 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c
|
|||
// from the marker arrays.
|
||||
for (unsigned i=0; i < scrollplane.AttachedLines.Size(); i++)
|
||||
{
|
||||
int line = int(scrollplane.AttachedLines[i] - lines);
|
||||
int line = scrollplane.AttachedLines[i]->Index();
|
||||
found_lines[line>>3] |= 1 << (line&7);
|
||||
}
|
||||
|
||||
for (unsigned i=0; i < scrollplane.AttachedSectors.Size(); i++)
|
||||
{
|
||||
int sec = scrollplane.AttachedSectors[i]->sectornum;
|
||||
int sec = scrollplane.AttachedSectors[i]->Index();
|
||||
found_sectors[sec>>3] |= 1 << (sec&7);
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c
|
|||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *ln = &lines[line];
|
||||
line_t *ln = &level.lines[line];
|
||||
|
||||
if (ln->frontsector == NULL || ln->backsector == NULL || !(ln->flags & ML_3DMIDTEX))
|
||||
{
|
||||
|
@ -176,24 +177,25 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c
|
|||
// Only consider two-sided lines with the 3DMIDTEX flag
|
||||
continue;
|
||||
}
|
||||
int lineno = int(ln-lines);
|
||||
found_lines[lineno>>3] |= 1 << (lineno&7);
|
||||
int lineno = ln->Index();
|
||||
found_lines[lineno >> 3] |= 1 << (lineno & 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int i=0; i < numlines; i++)
|
||||
for(unsigned i=0; i < level.lines.Size(); i++)
|
||||
{
|
||||
if (found_lines[i>>3] & (1 << (i&7)))
|
||||
{
|
||||
scrollplane.AttachedLines.Push(&lines[i]);
|
||||
auto &line = level.lines[i];
|
||||
scrollplane.AttachedLines.Push(&line);
|
||||
|
||||
v = lines[i].frontsector->sectornum;
|
||||
v = line.frontsector->Index();
|
||||
assert(v < (int)level.sectors.Size());
|
||||
found_sectors[v>>3] |= 1 << (v&7);
|
||||
|
||||
v = lines[i].backsector->sectornum;
|
||||
v = line.backsector->Index();
|
||||
assert(v < (int)level.sectors.Size());
|
||||
found_sectors[v>>3] |= 1 << (v&7);
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "a_armor.h"
|
||||
#include "a_ammo.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
extern FILE *Logfile;
|
||||
|
||||
|
@ -3284,7 +3285,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
|
|||
int linenum = -1;
|
||||
const char *texname = FBehavior::StaticLookupString (name);
|
||||
|
||||
if (texname == NULL)
|
||||
if (texname == nullptr)
|
||||
return;
|
||||
|
||||
side = !!side;
|
||||
|
@ -3296,8 +3297,8 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
|
|||
{
|
||||
side_t *sidedef;
|
||||
|
||||
sidedef = lines[linenum].sidedef[side];
|
||||
if (sidedef == NULL)
|
||||
sidedef = level.lines[linenum].sidedef[side];
|
||||
if (sidedef == nullptr)
|
||||
continue;
|
||||
|
||||
switch (position)
|
||||
|
@ -3332,16 +3333,14 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
|
|||
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
|
||||
for (int i = 0; i < numsides; ++i)
|
||||
for (auto &side : level.sides)
|
||||
{
|
||||
side_t *wal = &sides[i];
|
||||
|
||||
for(int j=0;j<3;j++)
|
||||
{
|
||||
static BYTE bits[]={NOT_TOP, NOT_MIDDLE, NOT_BOTTOM};
|
||||
if (!(flags & bits[j]) && wal->GetTexture(j) == picnum1)
|
||||
if (!(flags & bits[j]) && side.GetTexture(j) == picnum1)
|
||||
{
|
||||
wal->SetTexture(j, picnum2);
|
||||
side.SetTexture(j, picnum2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4428,14 +4427,14 @@ int DLevelScript::SideFromID(int id, int side)
|
|||
{
|
||||
if (activationline == NULL) return -1;
|
||||
if (activationline->sidedef[side] == NULL) return -1;
|
||||
return activationline->sidedef[side]->Index;
|
||||
return activationline->sidedef[side]->UDMFIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
int line = P_FindFirstLineFromID(id);
|
||||
if (line == -1) return -1;
|
||||
if (lines[line].sidedef[side] == NULL) return -1;
|
||||
return lines[line].sidedef[side]->Index;
|
||||
if (level.lines[line].sidedef[side] == NULL) return -1;
|
||||
return level.lines[line].sidedef[side]->UDMFIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4444,7 +4443,7 @@ int DLevelScript::LineFromID(int id)
|
|||
if (id == 0)
|
||||
{
|
||||
if (activationline == NULL) return -1;
|
||||
return int(activationline - lines);
|
||||
return activationline->Index();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5695,7 +5694,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
FLineIdIterator itr(args[0]);
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
lines[line].activation = args[1];
|
||||
level.lines[line].activation = args[1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -5704,7 +5703,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
if (argCount > 0)
|
||||
{
|
||||
int line = P_FindFirstLineFromID(args[0]);
|
||||
return line >= 0 ? lines[line].activation : 0;
|
||||
return line >= 0 ? level.lines[line].activation : 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -7742,7 +7741,7 @@ scriptwait:
|
|||
if (activationline != NULL)
|
||||
{
|
||||
activationline->special = 0;
|
||||
DPrintf(DMSG_SPAMMY, "Cleared line special on line %d\n", (int)(activationline - lines));
|
||||
DPrintf(DMSG_SPAMMY, "Cleared line special on line %d\n", activationline->Index());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -8307,32 +8306,33 @@ scriptwait:
|
|||
|
||||
case PCD_SETLINEBLOCKING:
|
||||
{
|
||||
int line;
|
||||
int lineno;
|
||||
|
||||
FLineIdIterator itr(STACK(2));
|
||||
while ((line = itr.Next()) >= 0)
|
||||
while ((lineno = itr.Next()) >= 0)
|
||||
{
|
||||
auto &line = level.lines[lineno];
|
||||
switch (STACK(1))
|
||||
{
|
||||
case BLOCK_NOTHING:
|
||||
lines[line].flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING|ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
line.flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING|ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
break;
|
||||
case BLOCK_CREATURES:
|
||||
default:
|
||||
lines[line].flags &= ~(ML_BLOCKEVERYTHING|ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
lines[line].flags |= ML_BLOCKING;
|
||||
line.flags &= ~(ML_BLOCKEVERYTHING|ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
line.flags |= ML_BLOCKING;
|
||||
break;
|
||||
case BLOCK_EVERYTHING:
|
||||
lines[line].flags &= ~(ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
lines[line].flags |= ML_BLOCKING|ML_BLOCKEVERYTHING;
|
||||
line.flags &= ~(ML_RAILING|ML_BLOCK_PLAYERS);
|
||||
line.flags |= ML_BLOCKING|ML_BLOCKEVERYTHING;
|
||||
break;
|
||||
case BLOCK_RAILING:
|
||||
lines[line].flags &= ~(ML_BLOCKEVERYTHING|ML_BLOCK_PLAYERS);
|
||||
lines[line].flags |= ML_RAILING|ML_BLOCKING;
|
||||
line.flags &= ~(ML_BLOCKEVERYTHING|ML_BLOCK_PLAYERS);
|
||||
line.flags |= ML_RAILING|ML_BLOCKING;
|
||||
break;
|
||||
case BLOCK_PLAYERS:
|
||||
lines[line].flags &= ~(ML_BLOCKEVERYTHING|ML_BLOCKING|ML_RAILING);
|
||||
lines[line].flags |= ML_BLOCK_PLAYERS;
|
||||
line.flags &= ~(ML_BLOCKEVERYTHING|ML_BLOCKING|ML_RAILING);
|
||||
line.flags |= ML_BLOCK_PLAYERS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8349,9 +8349,9 @@ scriptwait:
|
|||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
if (STACK(1))
|
||||
lines[line].flags |= ML_BLOCKMONSTERS;
|
||||
level.lines[line].flags |= ML_BLOCKMONSTERS;
|
||||
else
|
||||
lines[line].flags &= ~ML_BLOCKMONSTERS;
|
||||
level.lines[line].flags &= ~ML_BLOCKMONSTERS;
|
||||
}
|
||||
|
||||
sp -= 2;
|
||||
|
@ -8374,7 +8374,7 @@ scriptwait:
|
|||
FLineIdIterator itr(STACK(7));
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *line = &lines[linenum];
|
||||
line_t *line = &level.lines[linenum];
|
||||
line->special = specnum;
|
||||
line->args[0] = arg0;
|
||||
line->args[1] = STACK(4);
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
#include "math/cmath.h"
|
||||
#include "a_armor.h"
|
||||
#include "a_health.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
AActor *SingleActorFromTID(int tid, AActor *defactor);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "gi.h"
|
||||
#include "p_spec.h"
|
||||
|
||||
#if 0
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
//#define SHADE2LIGHT(s) (160-2*(s))
|
||||
|
@ -487,7 +488,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
// Setting numvertexes to the same as numwalls is overly conservative,
|
||||
// but the extra vertices will be removed during the BSP building pass.
|
||||
numsides = numvertexes = numwalls;
|
||||
numlines = 0;
|
||||
int numlines = 0;
|
||||
|
||||
sides = new side_t[numsides];
|
||||
memset (sides, 0, numsides*sizeof(side_t));
|
||||
|
@ -562,8 +563,8 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
}
|
||||
|
||||
// Set line properties that Doom doesn't store per-sidedef
|
||||
lines = new line_t[numlines];
|
||||
memset (lines, 0, numlines*sizeof(line_t));
|
||||
level.lines.Alloc(numlines);
|
||||
memset (&level.lines[0], 0, numlines*sizeof(line_t));
|
||||
|
||||
for (i = 0, j = -1; i < numwalls; ++i)
|
||||
{
|
||||
|
@ -573,6 +574,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
}
|
||||
|
||||
j = int(intptr_t(sides[i].linedef));
|
||||
auto &lines = level.lines;
|
||||
lines[j].sidedef[0] = (side_t*)(intptr_t)i;
|
||||
lines[j].sidedef[1] = (side_t*)(intptr_t)walls[i].nextwall;
|
||||
lines[j].v1 = FindVertex (walls[i].x, walls[i].y);
|
||||
|
@ -654,8 +656,8 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
slope.z[0] = slope.z[1] = slope.z[2] = -bsec->ceilingZ;
|
||||
CalcPlane (slope, sec.ceilingplane);
|
||||
}
|
||||
int linenum = int(intptr_t(sides[bsec->wallptr].linedef));
|
||||
int sidenum = int(intptr_t(lines[linenum].sidedef[1]));
|
||||
int linenum = sides[bsec->wallptr].linedef->Index();
|
||||
int sidenum = int(intptr_t(level.lines[linenum].sidedef[1] - sides));
|
||||
if (bsec->floorstat & 64)
|
||||
{ // floor is aligned to first wall
|
||||
P_AlignFlat (linenum, sidenum == bsec->wallptr, 0);
|
||||
|
@ -667,8 +669,8 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
}
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
intptr_t front = intptr_t(lines[i].sidedef[0]);
|
||||
intptr_t back = intptr_t(lines[i].sidedef[1]);
|
||||
intptr_t front = intptr_t(level.lines[i].sidedef[0]-sides);
|
||||
intptr_t back = intptr_t(level.lines[i].sidedef[1]-sides);
|
||||
lines[i].sidedef[0] = front >= 0 ? &sides[front] : NULL;
|
||||
lines[i].sidedef[1] = back >= 0 ? &sides[back] : NULL;
|
||||
}
|
||||
|
@ -851,6 +853,7 @@ static void Decrypt (void *to_, const void *from_, int len, int key)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//==========================================================================
|
||||
//
|
||||
// Just an actor to make the Build sprites show up. It doesn't do anything
|
||||
|
@ -892,3 +895,4 @@ void ACustomSprite::BeginPlay ()
|
|||
// set face/wall/floor flags
|
||||
renderflags |= ActorRenderFlags::FromInt (((cstat >> 4) & 3) << 12);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "gi.h"
|
||||
#include "serializer.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "p_local.h"
|
||||
#include "menu/menu.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// The conversations as they exist inside a SCRIPTxx lump.
|
||||
struct Response
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "serializer.h"
|
||||
#include "d_player.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "d_player.h"
|
||||
#include "r_utility.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE);
|
||||
CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE);
|
||||
|
@ -272,7 +273,7 @@ void P_ThinkParticles ()
|
|||
auto oldtrans = particle->alpha;
|
||||
particle->alpha -= particle->fadestep;
|
||||
particle->size += particle->sizestep;
|
||||
if (oldtrans < particle->alpha || --particle->ttl <= 0 || (particle->size <= 0))
|
||||
if (particle->alpha <= 0 || oldtrans < particle->alpha || --particle->ttl <= 0 || (particle->size <= 0))
|
||||
{ // The particle has expired, so free it
|
||||
memset (particle, 0, sizeof(particle_t));
|
||||
if (prev)
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "p_checkposition.h"
|
||||
#include "math/cmath.h"
|
||||
#include "a_ammo.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "p_3dmidtex.h"
|
||||
#include "p_spec.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "m_misc.h"
|
||||
#include "r_utility.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors);
|
||||
|
||||
|
@ -129,6 +130,7 @@ struct gl5_mapnode_t
|
|||
|
||||
static int CheckForMissingSegs()
|
||||
{
|
||||
auto numsides = level.sides.Size();
|
||||
double *added_seglen = new double[numsides];
|
||||
int missing = 0;
|
||||
|
||||
|
@ -141,13 +143,13 @@ static int CheckForMissingSegs()
|
|||
{
|
||||
// check all the segs and calculate the length they occupy on their sidedef
|
||||
DVector2 vec1(seg->v2->fX() - seg->v1->fX(), seg->v2->fY() - seg->v1->fY());
|
||||
added_seglen[seg->sidedef - sides] += vec1.Length();
|
||||
added_seglen[seg->sidedef->Index()] += vec1.Length();
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<numsides;i++)
|
||||
for(unsigned i=0;i<numsides;i++)
|
||||
{
|
||||
double linelen = sides[i].linedef->Delta().Length();
|
||||
double linelen = level.sides[i].linedef->Delta().Length();
|
||||
missing += (added_seglen[i] < linelen - 1.);
|
||||
}
|
||||
|
||||
|
@ -222,7 +224,7 @@ static bool LoadGLVertexes(FileReader * lump)
|
|||
BYTE *gldata;
|
||||
int i;
|
||||
|
||||
firstglvertex = numvertexes;
|
||||
firstglvertex = level.vertexes.Size();
|
||||
|
||||
int gllen=lump->GetLength();
|
||||
|
||||
|
@ -247,23 +249,23 @@ static bool LoadGLVertexes(FileReader * lump)
|
|||
}
|
||||
else format5=false;
|
||||
|
||||
mapglvertex_t* mgl;
|
||||
mapglvertex_t* mgl = (mapglvertex_t *)(gldata + GL_VERT_OFFSET);
|
||||
unsigned numvertexes = firstglvertex + (gllen - GL_VERT_OFFSET)/sizeof(mapglvertex_t);
|
||||
|
||||
vertex_t * oldvertexes = vertexes;
|
||||
numvertexes += (gllen - GL_VERT_OFFSET)/sizeof(mapglvertex_t);
|
||||
vertexes = new vertex_t[numvertexes];
|
||||
mgl = (mapglvertex_t *) (gldata + GL_VERT_OFFSET);
|
||||
TStaticArray<vertex_t> oldvertexes = std::move(level.vertexes);
|
||||
level.vertexes.Alloc(numvertexes);
|
||||
|
||||
memcpy(vertexes, oldvertexes, firstglvertex * sizeof(vertex_t));
|
||||
for(i=0;i<numlines;i++)
|
||||
memcpy(&level.vertexes[0], &oldvertexes[0], firstglvertex * sizeof(vertex_t));
|
||||
for(auto &line : level.lines)
|
||||
{
|
||||
lines[i].v1 = vertexes + (lines[i].v1 - oldvertexes);
|
||||
lines[i].v2 = vertexes + (lines[i].v2 - oldvertexes);
|
||||
// Remap vertex pointers in linedefs
|
||||
line.v1 = &level.vertexes[line.v1 - &oldvertexes[0]];
|
||||
line.v2 = &level.vertexes[line.v2 - &oldvertexes[0]];
|
||||
}
|
||||
|
||||
for (i = firstglvertex; i < numvertexes; i++)
|
||||
for (i = firstglvertex; i < (int)numvertexes; i++)
|
||||
{
|
||||
vertexes[i].set(LittleLong(mgl->x)/65536., LittleLong(mgl->y)/65536.);
|
||||
level.vertexes[i].set(LittleLong(mgl->x)/65536., LittleLong(mgl->y)/65536.);
|
||||
mgl++;
|
||||
}
|
||||
delete[] gldata;
|
||||
|
@ -317,18 +319,16 @@ static bool LoadGLSegs(FileReader * lump)
|
|||
numsegs/=sizeof(glseg_t);
|
||||
segs = new seg_t[numsegs];
|
||||
memset(segs,0,sizeof(seg_t)*numsegs);
|
||||
glsegextras = new glsegextra_t[numsegs];
|
||||
|
||||
glseg_t * ml = (glseg_t*)data;
|
||||
for(i = 0; i < numsegs; i++)
|
||||
{ // check for gl-vertices
|
||||
segs[i].v1 = &vertexes[checkGLVertex(LittleShort(ml->v1))];
|
||||
segs[i].v2 = &vertexes[checkGLVertex(LittleShort(ml->v2))];
|
||||
|
||||
glsegextras[i].PartnerSeg = ml->partner == 0xFFFF ? DWORD_MAX : LittleShort(ml->partner);
|
||||
segs[i].v1 = &level.vertexes[checkGLVertex(LittleShort(ml->v1))];
|
||||
segs[i].v2 = &level.vertexes[checkGLVertex(LittleShort(ml->v2))];
|
||||
segs[i].PartnerSeg = ml->partner == 0xFFFF ? nullptr : &segs[LittleShort(ml->partner)];
|
||||
if(ml->linedef != 0xffff)
|
||||
{
|
||||
ldef = &lines[LittleShort(ml->linedef)];
|
||||
ldef = &level.lines[LittleShort(ml->linedef)];
|
||||
segs[i].linedef = ldef;
|
||||
|
||||
|
||||
|
@ -370,19 +370,17 @@ static bool LoadGLSegs(FileReader * lump)
|
|||
numsegs/=sizeof(glseg3_t);
|
||||
segs = new seg_t[numsegs];
|
||||
memset(segs,0,sizeof(seg_t)*numsegs);
|
||||
glsegextras = new glsegextra_t[numsegs];
|
||||
|
||||
glseg3_t * ml = (glseg3_t*)(data+ (format5? 0:4));
|
||||
for(i = 0; i < numsegs; i++)
|
||||
{ // check for gl-vertices
|
||||
segs[i].v1 = &vertexes[checkGLVertex3(LittleLong(ml->v1))];
|
||||
segs[i].v2 = &vertexes[checkGLVertex3(LittleLong(ml->v2))];
|
||||
|
||||
glsegextras[i].PartnerSeg = LittleLong(ml->partner);
|
||||
segs[i].v1 = &level.vertexes[checkGLVertex3(LittleLong(ml->v1))];
|
||||
segs[i].v2 = &level.vertexes[checkGLVertex3(LittleLong(ml->v2))];
|
||||
segs[i].PartnerSeg = LittleLong(ml->partner) == 0xffffffffu? nullptr : &segs[LittleLong(ml->partner)];
|
||||
|
||||
if(ml->linedef != 0xffff) // skip minisegs
|
||||
{
|
||||
ldef = &lines[LittleLong(ml->linedef)];
|
||||
ldef = &level.lines[LittleLong(ml->linedef)];
|
||||
segs[i].linedef = ldef;
|
||||
|
||||
|
||||
|
@ -1000,18 +998,18 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
|
|||
P_GetPolySpots (map, polyspots, anchors);
|
||||
FNodeBuilder::FLevel leveldata =
|
||||
{
|
||||
vertexes, numvertexes,
|
||||
sides, numsides,
|
||||
lines, numlines,
|
||||
&level.vertexes[0], (int)level.vertexes.Size(),
|
||||
&level.sides[0], (int)level.sides.Size(),
|
||||
&level.lines[0], (int)level.lines.Size(),
|
||||
0, 0, 0, 0
|
||||
};
|
||||
leveldata.FindMapBounds ();
|
||||
FNodeBuilder builder (leveldata, polyspots, anchors, true);
|
||||
delete[] vertexes;
|
||||
|
||||
builder.Extract (nodes, numnodes,
|
||||
segs, glsegextras, numsegs,
|
||||
segs, numsegs,
|
||||
subsectors, numsubsectors,
|
||||
vertexes, numvertexes);
|
||||
level.vertexes);
|
||||
endTime = I_FPSTime ();
|
||||
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
|
||||
buildtime = endTime - startTime;
|
||||
|
@ -1093,11 +1091,11 @@ static void CreateCachedNodes(MapData *map)
|
|||
MemFile ZNodes;
|
||||
|
||||
WriteLong(ZNodes, 0);
|
||||
WriteLong(ZNodes, numvertexes);
|
||||
for(int i=0;i<numvertexes;i++)
|
||||
WriteLong(ZNodes, level.vertexes.Size());
|
||||
for(auto &vert : level.vertexes)
|
||||
{
|
||||
WriteLong(ZNodes, vertexes[i].fixX());
|
||||
WriteLong(ZNodes, vertexes[i].fixY());
|
||||
WriteLong(ZNodes, vert.fixX());
|
||||
WriteLong(ZNodes, vert.fixY());
|
||||
}
|
||||
|
||||
WriteLong(ZNodes, numsubsectors);
|
||||
|
@ -1109,12 +1107,11 @@ static void CreateCachedNodes(MapData *map)
|
|||
WriteLong(ZNodes, numsegs);
|
||||
for(int i=0;i<numsegs;i++)
|
||||
{
|
||||
WriteLong(ZNodes, DWORD(segs[i].v1 - vertexes));
|
||||
if (glsegextras != NULL) WriteLong(ZNodes, DWORD(glsegextras[i].PartnerSeg));
|
||||
else WriteLong(ZNodes, 0);
|
||||
WriteLong(ZNodes, segs[i].v1->Index());
|
||||
WriteLong(ZNodes, segs[i].PartnerSeg == nullptr? 0xffffffffu : DWORD(segs[i].PartnerSeg - segs));
|
||||
if (segs[i].linedef)
|
||||
{
|
||||
WriteLong(ZNodes, DWORD(segs[i].linedef - lines));
|
||||
WriteLong(ZNodes, DWORD(segs[i].linedef->Index()));
|
||||
WriteByte(ZNodes, segs[i].sidedef == segs[i].linedef->sidedef[0]? 0:1);
|
||||
}
|
||||
else
|
||||
|
@ -1156,7 +1153,7 @@ static void CreateCachedNodes(MapData *map)
|
|||
|
||||
uLongf outlen = ZNodes.Size();
|
||||
BYTE *compressed;
|
||||
int offset = numlines * 8 + 12 + 16;
|
||||
int offset = level.lines.Size() * 8 + 12 + 16;
|
||||
int r;
|
||||
do
|
||||
{
|
||||
|
@ -1171,13 +1168,13 @@ static void CreateCachedNodes(MapData *map)
|
|||
while (r == Z_BUF_ERROR);
|
||||
|
||||
memcpy(compressed, "CACH", 4);
|
||||
DWORD len = LittleLong(numlines);
|
||||
DWORD len = LittleLong(level.lines.Size());
|
||||
memcpy(compressed+4, &len, 4);
|
||||
map->GetChecksum(compressed+8);
|
||||
for(int i=0;i<numlines;i++)
|
||||
for (unsigned i = 0; i < level.lines.Size(); i++)
|
||||
{
|
||||
DWORD ndx[2] = {LittleLong(DWORD(lines[i].v1 - vertexes)), LittleLong(DWORD(lines[i].v2 - vertexes)) };
|
||||
memcpy(compressed+8+16+8*i, ndx, 8);
|
||||
DWORD ndx[2] = { LittleLong(DWORD(level.lines[i].v1->Index())), LittleLong(DWORD(level.lines[i].v2->Index())) };
|
||||
memcpy(compressed + 8 + 16 + 8 * i, ndx, 8);
|
||||
}
|
||||
memcpy(compressed + offset - 4, "ZGL3", 4);
|
||||
|
||||
|
@ -1219,7 +1216,7 @@ static bool CheckCachedNodes(MapData *map)
|
|||
|
||||
if (fread(&numlin, 4, 1, f) != 1) goto errorout;
|
||||
numlin = LittleLong(numlin);
|
||||
if ((int)numlin != numlines) goto errorout;
|
||||
if (numlin != level.lines.Size()) goto errorout;
|
||||
|
||||
if (fread(md5, 1, 16, f) != 16) goto errorout;
|
||||
map->GetChecksum(md5map);
|
||||
|
@ -1261,10 +1258,11 @@ static bool CheckCachedNodes(MapData *map)
|
|||
goto errorout;
|
||||
}
|
||||
|
||||
for(int i=0;i<numlines;i++)
|
||||
for(auto &line : level.lines)
|
||||
{
|
||||
lines[i].v1 = &vertexes[LittleLong(verts[i*2])];
|
||||
lines[i].v2 = &vertexes[LittleLong(verts[i*2+1])];
|
||||
int i = line.Index();
|
||||
line.v1 = &level.vertexes[LittleLong(verts[i*2])];
|
||||
line.v2 = &level.vertexes[LittleLong(verts[i*2+1])];
|
||||
}
|
||||
delete [] verts;
|
||||
|
||||
|
@ -1437,40 +1435,32 @@ void P_SetRenderSector()
|
|||
#endif
|
||||
|
||||
// Check for incorrect partner seg info so that the following code does not crash.
|
||||
if (glsegextras == NULL)
|
||||
|
||||
for (i = 0; i < numsegs; i++)
|
||||
{
|
||||
// This can be normal nodes, mistakenly identified as GL nodes so we must fill
|
||||
// in the missing pieces differently.
|
||||
|
||||
for (i = 0; i < numsubsectors; i++)
|
||||
auto p = segs[i].PartnerSeg;
|
||||
if (p != nullptr)
|
||||
{
|
||||
ss = &subsectors[i];
|
||||
ss->render_sector = ss->sector;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int partner = (int)(p - segs);
|
||||
|
||||
for(i=0;i<numsegs;i++)
|
||||
{
|
||||
int partner = (int)glsegextras[i].PartnerSeg;
|
||||
if (partner < 0 || partner >= numsegs)
|
||||
{
|
||||
segs[i].PartnerSeg = nullptr;
|
||||
}
|
||||
|
||||
if (partner<0 || partner>=numsegs/*eh? || &segs[partner]!=glsegextras[i].PartnerSeg*/)
|
||||
{
|
||||
glsegextras[i].PartnerSeg=DWORD_MAX;
|
||||
// glbsp creates such incorrect references for Strife.
|
||||
if (segs[i].linedef && segs[i].PartnerSeg != nullptr && !segs[i].PartnerSeg->linedef)
|
||||
{
|
||||
segs[i].PartnerSeg = segs[i].PartnerSeg->PartnerSeg = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// glbsp creates such incorrect references for Strife.
|
||||
if (segs[i].linedef && glsegextras[i].PartnerSeg != DWORD_MAX && !segs[glsegextras[i].PartnerSeg].linedef)
|
||||
for (i = 0; i < numsegs; i++)
|
||||
{
|
||||
glsegextras[i].PartnerSeg = glsegextras[glsegextras[i].PartnerSeg].PartnerSeg = DWORD_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<numsegs;i++)
|
||||
{
|
||||
if (glsegextras[i].PartnerSeg != DWORD_MAX && glsegextras[glsegextras[i].PartnerSeg].PartnerSeg!=(DWORD)i)
|
||||
{
|
||||
glsegextras[i].PartnerSeg=DWORD_MAX;
|
||||
if (segs[i].PartnerSeg != nullptr && segs[i].PartnerSeg->PartnerSeg != &segs[i])
|
||||
{
|
||||
segs[i].PartnerSeg = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1498,7 +1488,7 @@ void P_SetRenderSector()
|
|||
seg = ss->firstline;
|
||||
for(j=0; j<ss->numlines; j++)
|
||||
{
|
||||
if(seg->sidedef && (glsegextras[seg - segs].PartnerSeg == DWORD_MAX || seg->sidedef->sector!=segs[glsegextras[seg - segs].PartnerSeg].sidedef->sector))
|
||||
if(seg->sidedef && (seg->PartnerSeg == nullptr || seg->sidedef->sector!=seg->PartnerSeg->sidedef->sector))
|
||||
{
|
||||
ss->render_sector = seg->sidedef->sector;
|
||||
break;
|
||||
|
@ -1522,15 +1512,14 @@ void P_SetRenderSector()
|
|||
|
||||
for(j=0; j<ss->numlines; j++)
|
||||
{
|
||||
DWORD partner = glsegextras[seg - segs].PartnerSeg;
|
||||
if (partner != DWORD_MAX && glsegextras[partner].Subsector)
|
||||
if (seg->PartnerSeg != nullptr && seg->PartnerSeg->Subsector)
|
||||
{
|
||||
sector_t * backsec = glsegextras[partner].Subsector->render_sector;
|
||||
sector_t * backsec = seg->PartnerSeg->Subsector->render_sector;
|
||||
if (backsec)
|
||||
{
|
||||
ss->render_sector=backsec;
|
||||
ss->render_sector = backsec;
|
||||
undetermined.Delete(i);
|
||||
deleted=1;
|
||||
deleted = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "a_morph.h"
|
||||
#include "virtual.h"
|
||||
#include "a_health.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_obituary ("Obituary");
|
||||
static FRandom pr_botrespawn ("BotRespawn");
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "p_lnspec.h"
|
||||
#include "doomstat.h"
|
||||
#include "p_maputl.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// State.
|
||||
#include "r_state.h"
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -360,7 +361,7 @@ void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling)
|
|||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *ld = &lines[line];
|
||||
line_t *ld = &level.lines[line];
|
||||
|
||||
if (ld->special == Static_Init && ld->args[1] == Init_SectorLink)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "r_data/colormaps.h"
|
||||
#include "fragglescript/t_fs.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// Remaps EE sector change types to Generic_Floor values. According to the Eternity Wiki:
|
||||
/*
|
||||
|
@ -2604,7 +2605,7 @@ FUNC(LS_Line_SetTextureOffset)
|
|||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
side_t *side = lines[line].sidedef[arg3];
|
||||
side_t *side = level.lines[line].sidedef[arg3];
|
||||
if (side != NULL)
|
||||
{
|
||||
|
||||
|
@ -2659,7 +2660,7 @@ FUNC(LS_Line_SetTextureScale)
|
|||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
side_t *side = lines[line].sidedef[arg3];
|
||||
side_t *side = level.lines[line].sidedef[arg3];
|
||||
if (side != NULL)
|
||||
{
|
||||
if ((arg4&8)==0)
|
||||
|
@ -2733,7 +2734,7 @@ FUNC(LS_Line_SetBlocking)
|
|||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
lines[line].flags = (lines[line].flags & ~clearflags) | setflags;
|
||||
level.lines[line].flags = (level.lines[line].flags & ~clearflags) | setflags;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3028,14 +3029,14 @@ FUNC(LS_TranslucentLine)
|
|||
int linenum;
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
lines[linenum].alpha = clamp(arg1, 0, 255) / 255.;
|
||||
level.lines[linenum].alpha = clamp(arg1, 0, 255) / 255.;
|
||||
if (arg2 == 0)
|
||||
{
|
||||
lines[linenum].flags &= ~ML_ADDTRANS;
|
||||
level.lines[linenum].flags &= ~ML_ADDTRANS;
|
||||
}
|
||||
else if (arg2 == 1)
|
||||
{
|
||||
lines[linenum].flags |= ML_ADDTRANS;
|
||||
level.lines[linenum].flags |= ML_ADDTRANS;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "r_data/r_translate.h"
|
||||
#include "g_level.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE)
|
||||
CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)
|
||||
|
@ -183,7 +184,7 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines
|
|||
if (ffcf_verbose)
|
||||
{
|
||||
Printf("Hit line %d at position %f,%f, group %d\n",
|
||||
int(ld - lines), cres.Position.X, cres.Position.Y, ld->frontsector->PortalGroup);
|
||||
ld->Index(), cres.Position.X, cres.Position.Y, ld->frontsector->PortalGroup);
|
||||
}
|
||||
|
||||
if (!ld->backsector)
|
||||
|
@ -3296,7 +3297,6 @@ bool FSlide::BounceTraverse(const DVector2 &start, const DVector2 &end)
|
|||
}
|
||||
|
||||
li = in->d.line;
|
||||
assert(((size_t)li - (size_t)lines) % sizeof(line_t) == 0);
|
||||
if (li->flags & ML_BLOCKEVERYTHING)
|
||||
{
|
||||
goto bounceblocking;
|
||||
|
@ -3907,7 +3907,7 @@ struct aim_t
|
|||
int frontflag = P_PointOnLineSidePrecise(startpos, li);
|
||||
|
||||
if (aimdebug)
|
||||
Printf("Found line %d: ___toppitch = %f, ___bottompitch = %f\n", int(li - lines), toppitch.Degrees, bottompitch.Degrees);
|
||||
Printf("Found line %d: toppitch = %f, bottompitch = %f\n", li->Index(), toppitch.Degrees, bottompitch.Degrees);
|
||||
|
||||
if (li->isLinePortal() && frontflag == 0)
|
||||
{
|
||||
|
@ -3951,7 +3951,7 @@ struct aim_t
|
|||
return;
|
||||
|
||||
if (aimdebug)
|
||||
Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", int(li - lines), toppitch.Degrees, bottompitch.Degrees, planestocheck);
|
||||
Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", li->Index(), toppitch.Degrees, bottompitch.Degrees, planestocheck);
|
||||
|
||||
sector_t *entersec = frontflag ? li->frontsector : li->backsector;
|
||||
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "r_state.h"
|
||||
#include "templates.h"
|
||||
#include "po_man.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
sector_t *P_PointInSectorBuggy(double x, double y);
|
||||
int P_VanillaPointOnDivlineSide(double x, double y, const divline_t* line);
|
||||
|
@ -330,7 +331,7 @@ bool AActor::FixMapthingPos()
|
|||
|
||||
for (list = blockmaplump + blockmap[blocky*bmapwidth + blockx] + 1; *list != -1; ++list)
|
||||
{
|
||||
line_t *ldef = &lines[*list];
|
||||
line_t *ldef = &level.lines[*list];
|
||||
|
||||
if (ldef->frontsector == ldef->backsector)
|
||||
{ // Skip two-sided lines inside a single sector
|
||||
|
@ -367,10 +368,10 @@ bool AActor::FixMapthingPos()
|
|||
|
||||
if (distance < radius)
|
||||
{
|
||||
DPrintf(DMSG_NOTIFY, "%s at (%f,%f) lies on %s line %td, distance = %f\n",
|
||||
DPrintf(DMSG_NOTIFY, "%s at (%f,%f) lies on %s line %d, distance = %f\n",
|
||||
this->GetClass()->TypeName.GetChars(), X(), Y(),
|
||||
ldef->Delta().X == 0 ? "vertical" : ldef->Delta().Y == 0 ? "horizontal" : "diagonal",
|
||||
ldef - lines, distance);
|
||||
ldef->Index(), distance);
|
||||
DAngle ang = ldef->Delta().Angle();
|
||||
if (ldef->backsector != NULL && ldef->backsector == secstart)
|
||||
{
|
||||
|
@ -709,7 +710,7 @@ line_t *FBlockLinesIterator::Next()
|
|||
{
|
||||
while (*list != -1)
|
||||
{
|
||||
line_t *ld = &lines[*list];
|
||||
line_t *ld = &level.lines[*list];
|
||||
|
||||
list++;
|
||||
if (ld->validcount != validcount)
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "a_armor.h"
|
||||
#include "a_ammo.h"
|
||||
#include "a_health.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -7539,6 +7540,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
|
|||
return 0;
|
||||
}
|
||||
|
||||
double AActor::GetBobOffset(double ticfrac) const
|
||||
{
|
||||
if (!(flags2 & MF2_FLOATBOB))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return BobSin(FloatBobPhase + level.maptime + ticfrac);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_FLOAT_DEF(frac);
|
||||
ACTION_RETURN_FLOAT(self->GetBobOffset(frac));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7639,13 +7656,6 @@ DEFINE_ACTION_FUNCTION(AActor, GetDefaultByType)
|
|||
ACTION_RETURN_OBJECT(cls == nullptr? nullptr : GetDefaultByType(cls));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_FLOAT_DEF(frac);
|
||||
ACTION_RETURN_FLOAT(self->GetBobOffset(frac));
|
||||
}
|
||||
|
||||
// This combines all 3 variations of the internal function
|
||||
DEFINE_ACTION_FUNCTION(AActor, VelFromAngle)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "s_sndseq.h"
|
||||
#include "serializer.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
IMPLEMENT_CLASS(DPillar, false, true)
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "gi.h"
|
||||
#include "serializer.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_doplat ("DoPlat");
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "serializer.h"
|
||||
#include "v_text.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "p_local.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
CVAR(Bool, var_pushers, true, CVAR_SERVERINFO);
|
||||
|
||||
|
@ -358,11 +359,10 @@ AActor *P_GetPushThing (int s)
|
|||
|
||||
void P_SpawnPushers ()
|
||||
{
|
||||
int i;
|
||||
line_t *l = lines;
|
||||
line_t *l = &level.lines[0];
|
||||
int s;
|
||||
|
||||
for (i = 0; i < numlines; i++, l++)
|
||||
for (unsigned i = 0; i < level.lines.Size(); i++, l++)
|
||||
{
|
||||
switch (l->special)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,11 @@
|
|||
#include "r_sky.h"
|
||||
#include "r_renderer.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static TStaticArray<sector_t> loadsectors;
|
||||
static TStaticArray<line_t> loadlines;
|
||||
static TStaticArray<side_t> loadsides;
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
@ -353,6 +358,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, subsector_t *&ss, subs
|
|||
str = &encoded[0];
|
||||
if (arc.BeginArray(key))
|
||||
{
|
||||
auto numvertexes = level.vertexes.Size();
|
||||
arc(nullptr, numvertexes)
|
||||
(nullptr, numsubsectors)
|
||||
.StringPtr(nullptr, str)
|
||||
|
@ -371,7 +377,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, subsector_t *&ss, subs
|
|||
.StringPtr(nullptr, str)
|
||||
.EndArray();
|
||||
|
||||
if (num_verts == numvertexes && num_subs == numsubsectors && hasglnodes)
|
||||
if (num_verts == level.vertexes.Size() && num_subs == numsubsectors && hasglnodes)
|
||||
{
|
||||
success = true;
|
||||
int sub = 0;
|
||||
|
@ -898,8 +904,8 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
// deep down in the deserializer or just a crash if the few insufficient safeguards were not triggered.
|
||||
BYTE chk[16] = { 0 };
|
||||
arc.Array("checksum", chk, 16);
|
||||
if (arc.GetSize("linedefs") != (unsigned)numlines ||
|
||||
arc.GetSize("sidedefs") != (unsigned)numsides ||
|
||||
if (arc.GetSize("linedefs") != level.lines.Size() ||
|
||||
arc.GetSize("sidedefs") != level.sides.Size() ||
|
||||
arc.GetSize("sectors") != level.sectors.Size() ||
|
||||
arc.GetSize("polyobjs") != (unsigned)po_NumPolyobjs ||
|
||||
memcmp(chk, level.md5, 16))
|
||||
|
@ -952,8 +958,8 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
|
||||
FBehavior::StaticSerializeModuleStates(arc);
|
||||
// The order here is important: First world state, then portal state, then thinkers, and last polyobjects.
|
||||
arc.Array("linedefs", lines, &loadlines[0], numlines);
|
||||
arc.Array("sidedefs", sides, &loadsides[0], numsides);
|
||||
arc.Array("linedefs", &level.lines[0], &loadlines[0], level.lines.Size());
|
||||
arc.Array("sidedefs", &level.sides[0], &loadsides[0], level.sides.Size());
|
||||
arc.Array("sectors", &level.sectors[0], &loadsectors[0], level.sectors.Size());
|
||||
arc("zones", Zones);
|
||||
arc("lineportals", linePortals);
|
||||
|
@ -988,4 +994,18 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
|
||||
}
|
||||
|
||||
// Create a backup of the map data so the savegame code can toss out all fields that haven't changed in order to reduce processing time and file size.
|
||||
|
||||
void P_BackupMapData()
|
||||
{
|
||||
loadsectors = level.sectors;
|
||||
loadlines = level.lines;
|
||||
loadsides = level.sides;
|
||||
}
|
||||
|
||||
void P_FreeMapDataBackup()
|
||||
{
|
||||
loadsectors.Clear();
|
||||
loadlines.Clear();
|
||||
loadsides.Clear();
|
||||
}
|
|
@ -46,4 +46,7 @@ void P_WriteACSDefereds (FSerializer &);
|
|||
|
||||
void G_SerializeLevel(FSerializer &arc, bool hubLoad);
|
||||
|
||||
void P_BackupMapData();
|
||||
void P_FreeMapDataBackup();
|
||||
|
||||
#endif // __P_SAVEG_H__
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "serializer.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -191,19 +192,19 @@ void DScroller::Tick ()
|
|||
case EScroll::sc_side: // killough 3/7/98: Scroll wall texture
|
||||
if (m_Parts & EScrollPos::scw_top)
|
||||
{
|
||||
sides[m_Affectee].AddTextureXOffset(side_t::top, dx);
|
||||
sides[m_Affectee].AddTextureYOffset(side_t::top, dy);
|
||||
level.sides[m_Affectee].AddTextureXOffset(side_t::top, dx);
|
||||
level.sides[m_Affectee].AddTextureYOffset(side_t::top, dy);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
|
||||
sides[m_Affectee].AddTextureYOffset(side_t::mid, dy);
|
||||
level.sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
|
||||
level.sides[m_Affectee].AddTextureYOffset(side_t::mid, dy);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_bottom)
|
||||
{
|
||||
sides[m_Affectee].AddTextureXOffset(side_t::bottom, dx);
|
||||
sides[m_Affectee].AddTextureYOffset(side_t::bottom, dy);
|
||||
level.sides[m_Affectee].AddTextureXOffset(side_t::bottom, dx);
|
||||
level.sides[m_Affectee].AddTextureYOffset(side_t::bottom, dy);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -276,19 +277,19 @@ DScroller::DScroller (EScroll type, double dx, double dy,
|
|||
break;
|
||||
|
||||
case EScroll::sc_side:
|
||||
sides[affectee].Flags |= WALLF_NOAUTODECALS;
|
||||
level.sides[affectee].Flags |= WALLF_NOAUTODECALS;
|
||||
if (m_Parts & EScrollPos::scw_top)
|
||||
{
|
||||
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
|
||||
m_Interpolations[0] = level.sides[m_Affectee].SetInterpolation(side_t::top);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == nullptr ||
|
||||
!(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
|
||||
m_Interpolations[1] = level.sides[m_Affectee].SetInterpolation(side_t::mid);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_bottom)
|
||||
{
|
||||
m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom);
|
||||
m_Interpolations[2] = level.sides[m_Affectee].SetInterpolation(side_t::bottom);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -349,22 +350,22 @@ DScroller::DScroller (double dx, double dy, const line_t *l,
|
|||
m_LastHeight = 0;
|
||||
if ((m_Control = control) != -1)
|
||||
m_LastHeight = level.sectors[control].CenterFloor() + level.sectors[control].CenterCeiling();
|
||||
m_Affectee = int(l->sidedef[0] - sides);
|
||||
sides[m_Affectee].Flags |= WALLF_NOAUTODECALS;
|
||||
m_Affectee = l->sidedef[0]->Index();
|
||||
level.sides[m_Affectee].Flags |= WALLF_NOAUTODECALS;
|
||||
m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL;
|
||||
|
||||
if (m_Parts & EScrollPos::scw_top)
|
||||
{
|
||||
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top);
|
||||
m_Interpolations[0] = level.sides[m_Affectee].SetInterpolation(side_t::top);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == NULL ||
|
||||
!(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
|
||||
{
|
||||
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid);
|
||||
m_Interpolations[1] = level.sides[m_Affectee].SetInterpolation(side_t::mid);
|
||||
}
|
||||
if (m_Parts & EScrollPos::scw_bottom)
|
||||
{
|
||||
m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom);
|
||||
m_Interpolations[2] = level.sides[m_Affectee].SetInterpolation(side_t::bottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,24 +381,23 @@ DScroller::DScroller (double dx, double dy, const line_t *l,
|
|||
|
||||
void P_SpawnScrollers(void)
|
||||
{
|
||||
int i;
|
||||
line_t *l = lines;
|
||||
line_t *l = &level.lines[0];
|
||||
TArray<int> copyscrollers;
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
if (lines[i].special == Sector_CopyScroller)
|
||||
if (line.special == Sector_CopyScroller)
|
||||
{
|
||||
// don't allow copying the scroller if the sector has the same tag as it would just duplicate it.
|
||||
if (!tagManager.SectorHasTag(lines[i].frontsector, lines[i].args[0]))
|
||||
if (!tagManager.SectorHasTag(line.frontsector, line.args[0]))
|
||||
{
|
||||
copyscrollers.Push(i);
|
||||
copyscrollers.Push(line.Index());
|
||||
}
|
||||
lines[i].special = 0;
|
||||
line.special = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < numlines; i++, l++)
|
||||
for (unsigned i = 0; i < level.lines.Size(); i++, l++)
|
||||
{
|
||||
double dx; // direction and speed of scrolling
|
||||
double dy;
|
||||
|
@ -474,7 +474,7 @@ void P_SpawnScrollers(void)
|
|||
}
|
||||
for (unsigned j = 0; j < copyscrollers.Size(); j++)
|
||||
{
|
||||
line_t *line = &lines[copyscrollers[j]];
|
||||
line_t *line = &level.lines[copyscrollers[j]];
|
||||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 1))
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ void P_SpawnScrollers(void)
|
|||
}
|
||||
for(unsigned j = 0;j < copyscrollers.Size(); j++)
|
||||
{
|
||||
line_t *line = &lines[copyscrollers[j]];
|
||||
line_t *line = &level.lines[copyscrollers[j]];
|
||||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 2))
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ void P_SpawnScrollers(void)
|
|||
}
|
||||
for(unsigned j = 0;j < copyscrollers.Size(); j++)
|
||||
{
|
||||
line_t *line = &lines[copyscrollers[j]];
|
||||
line_t *line = &level.lines[copyscrollers[j]];
|
||||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 4))
|
||||
{
|
||||
|
@ -530,48 +530,48 @@ void P_SpawnScrollers(void)
|
|||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
if (s != i)
|
||||
new DScroller(dx, dy, lines + s, control, accel);
|
||||
new DScroller(dx, dy, &level.lines[s], control, accel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Scroll_Texture_Offsets:
|
||||
// killough 3/2/98: scroll according to sidedef offsets
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffset(side_t::mid),
|
||||
sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
new DScroller (EScroll::sc_side, -level.sides[s].GetTextureXOffset(side_t::mid),
|
||||
level.sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Left:
|
||||
l->special = special; // Restore the special, for compat_useblocking's benefit.
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
new DScroller (EScroll::sc_side, l->args[0] / 64., 0,
|
||||
-1, s, accel, SCROLLTYPE(l->args[1]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Right:
|
||||
l->special = special;
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
new DScroller (EScroll::sc_side, -l->args[0] / 64., 0,
|
||||
-1, s, accel, SCROLLTYPE(l->args[1]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Up:
|
||||
l->special = special;
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
new DScroller (EScroll::sc_side, 0, l->args[0] / 64.,
|
||||
-1, s, accel, SCROLLTYPE(l->args[1]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Down:
|
||||
l->special = special;
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
new DScroller (EScroll::sc_side, 0, -l->args[0] / 64.,
|
||||
-1, s, accel, SCROLLTYPE(l->args[1]));
|
||||
break;
|
||||
|
||||
case Scroll_Texture_Both:
|
||||
s = int(lines[i].sidedef[0] - sides);
|
||||
s = level.lines[i].sidedef[0]->Index();
|
||||
if (l->args[0] == 0) {
|
||||
dx = (l->args[1] - l->args[2]) / 64.;
|
||||
dy = (l->args[4] - l->args[3]) / 64.;
|
||||
|
@ -608,8 +608,8 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
|
|||
{
|
||||
int wallnum = scroller->GetWallNum ();
|
||||
|
||||
if (wallnum >= 0 && tagManager.LineHasID(sides[wallnum].linedef, id) &&
|
||||
int(sides[wallnum].linedef->sidedef[sidechoice] - sides) == wallnum &&
|
||||
if (wallnum >= 0 && tagManager.LineHasID(level.sides[wallnum].linedef, id) &&
|
||||
level.sides[wallnum].linedef->sidedef[sidechoice]->Index() == wallnum &&
|
||||
Where == scroller->GetScrollParts())
|
||||
{
|
||||
scroller->Destroy ();
|
||||
|
@ -628,8 +628,8 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
|
|||
while ( (collect.Obj = iterator.Next ()) )
|
||||
{
|
||||
if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 &&
|
||||
tagManager.LineHasID(sides[collect.RefNum].linedef, id) &&
|
||||
int(sides[collect.RefNum].linedef->sidedef[sidechoice] - sides) == collect.RefNum &&
|
||||
tagManager.LineHasID(level.sides[collect.RefNum].linedef, id) &&
|
||||
level.sides[collect.RefNum].linedef->sidedef[sidechoice]->Index() == collect.RefNum &&
|
||||
Where == ((DScroller *)collect.Obj)->GetScrollParts())
|
||||
{
|
||||
((DScroller *)collect.Obj)->SetRate (dx, dy);
|
||||
|
@ -645,9 +645,9 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
|
|||
FLineIdIterator itr(id);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
if (lines[linenum].sidedef[sidechoice] != NULL)
|
||||
if (level.lines[linenum].sidedef[sidechoice] != NULL)
|
||||
{
|
||||
int sidenum = int(lines[linenum].sidedef[sidechoice] - sides);
|
||||
int sidenum = level.lines[linenum].sidedef[sidechoice]->Index();
|
||||
unsigned int i;
|
||||
for (i = 0; i < numcollected; i++)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "p_local.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
// [RH]
|
||||
|
@ -710,7 +711,7 @@ double sector_t::FindHighestFloorPoint (vertex_t **v) const
|
|||
{
|
||||
if (v != NULL)
|
||||
{
|
||||
if (Lines.Size() == 0) *v = &vertexes[0];
|
||||
if (Lines.Size() == 0) *v = &level.vertexes[0];
|
||||
else *v = Lines[0]->v1;
|
||||
}
|
||||
return -floorplane.fD();
|
||||
|
@ -759,7 +760,7 @@ double sector_t::FindLowestCeilingPoint (vertex_t **v) const
|
|||
{
|
||||
if (v != NULL)
|
||||
{
|
||||
if (Lines.Size() == 0) *v = &vertexes[0];
|
||||
if (Lines.Size() == 0) *v = &level.vertexes[0];
|
||||
else *v = Lines[0]->v1;
|
||||
}
|
||||
return ceilingplane.fD();
|
||||
|
@ -1772,6 +1773,205 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
|
|||
ACTION_RETURN_FLOAT(self->CenterCeiling());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, Index)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
unsigned ndx = self->Index();
|
||||
if (ndx >= level.sectors.Size())
|
||||
{
|
||||
// This qualifies as an array out of bounds exception. Normally it can only happen when a sector copy is concerned which scripts should not be able to create.
|
||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Accessed invalid sector");
|
||||
}
|
||||
ACTION_RETURN_INT(ndx);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// line_t exports
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, isLinePortal)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_BOOL(self->isLinePortal());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, isVisualPortal)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_BOOL(self->isVisualPortal());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalDestination)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_POINTER(self->getPortalDestination());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalAlignment)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_INT(self->getPortalAlignment());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, Index)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
unsigned ndx = self->Index();
|
||||
if (ndx >= level.lines.Size())
|
||||
{
|
||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Accessed invalid line");
|
||||
}
|
||||
ACTION_RETURN_INT(ndx);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTexture)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_INT(self->GetTexture(which).GetIndex());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTexture)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_INT(tex);
|
||||
self->SetTexture(which, FSetTextureID(tex));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureXOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, AddTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->AddTextureXOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureXOffset(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureYOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, AddTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->AddTextureYOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureYOffset(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureXScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->MultiplyTextureXScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureXScale(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureYScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->MultiplyTextureYScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureYScale(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, V1)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_POINTER(self->V1());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, V2)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_POINTER(self->V2());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, Index)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_INT(self->Index());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Vertex, Index)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(vertex_t);
|
||||
ACTION_RETURN_INT(self->Index());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -1838,7 +2038,7 @@ bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) cons
|
|||
|
||||
bool P_AlignFlat (int linenum, int side, int fc)
|
||||
{
|
||||
line_t *line = lines + linenum;
|
||||
line_t *line = &level.lines[linenum];
|
||||
sector_t *sec = side ? line->backsector : line->frontsector;
|
||||
|
||||
if (!sec)
|
||||
|
@ -1871,10 +2071,10 @@ void subsector_t::BuildPolyBSP()
|
|||
assert((BSP == NULL || BSP->bDirty) && "BSP computed more than once");
|
||||
|
||||
// Set up level information for the node builder.
|
||||
PolyNodeLevel.Sides = sides;
|
||||
PolyNodeLevel.NumSides = numsides;
|
||||
PolyNodeLevel.Lines = lines;
|
||||
PolyNodeLevel.NumLines = numlines;
|
||||
PolyNodeLevel.Sides = &level.sides[0];
|
||||
PolyNodeLevel.NumSides = level.sides.Size();
|
||||
PolyNodeLevel.Lines = &level.lines[0];
|
||||
PolyNodeLevel.NumLines = numlines; // is this correct???
|
||||
|
||||
// Feed segs to the nodebuilder and build the nodes.
|
||||
PolyNodeBuilder.Clear();
|
||||
|
@ -2100,6 +2300,12 @@ DEFINE_FIELD_X(Line, line_t, backsector)
|
|||
DEFINE_FIELD_X(Line, line_t, validcount)
|
||||
DEFINE_FIELD_X(Line, line_t, locknumber)
|
||||
DEFINE_FIELD_X(Line, line_t, portalindex)
|
||||
DEFINE_FIELD_X(Line, line_t, portaltransferred)
|
||||
|
||||
DEFINE_FIELD_X(Side, side_t, sector)
|
||||
DEFINE_FIELD_X(Side, side_t, linedef)
|
||||
DEFINE_FIELD_X(Side, side_t, Light)
|
||||
DEFINE_FIELD_X(Side, side_t, Flags)
|
||||
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, normal)
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, D)
|
||||
|
|
345
src/p_setup.cpp
345
src/p_setup.cpp
|
@ -73,6 +73,8 @@
|
|||
#include "p_blockmap.h"
|
||||
#include "r_utility.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_saveg.h"
|
||||
#include "g_levellocals.h"
|
||||
#ifndef NO_EDATA
|
||||
#include "edata.h"
|
||||
#endif
|
||||
|
@ -88,7 +90,6 @@ void BloodCrypt (void *data, int key, int len);
|
|||
void P_ClearUDMFKeys();
|
||||
|
||||
extern AActor *P_SpawnMapThing (FMapThing *mthing, int position);
|
||||
extern bool P_LoadBuildMap (BYTE *mapdata, size_t len, FMapThing **things, int *numthings);
|
||||
|
||||
extern void P_TranslateTeleportThings (void);
|
||||
|
||||
|
@ -106,25 +107,25 @@ CVAR (Bool, showloadtimes, false, 0);
|
|||
|
||||
static void P_Shutdown ();
|
||||
|
||||
bool P_IsBuildMap(MapData *map);
|
||||
inline bool P_IsBuildMap(MapData *map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool P_LoadBuildMap(BYTE *mapdata, size_t len, FMapThing **things, int *numthings)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MAP related Lookup tables.
|
||||
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
|
||||
//
|
||||
int numvertexes;
|
||||
vertex_t* vertexes;
|
||||
int numvertexdatas;
|
||||
vertexdata_t* vertexdatas;
|
||||
TArray<vertexdata_t> vertexdatas;
|
||||
|
||||
int numsegs;
|
||||
seg_t* segs;
|
||||
glsegextra_t* glsegextras;
|
||||
|
||||
//int numsectors;
|
||||
//sector_t* sectors;
|
||||
TArray<sector_t> loadsectors;
|
||||
|
||||
int numsubsectors;
|
||||
subsector_t* subsectors;
|
||||
|
@ -132,14 +133,6 @@ subsector_t* subsectors;
|
|||
int numnodes;
|
||||
node_t* nodes;
|
||||
|
||||
int numlines;
|
||||
line_t* lines;
|
||||
TArray<line_t> loadlines;
|
||||
|
||||
int numsides;
|
||||
side_t* sides;
|
||||
TArray<side_t> loadsides;
|
||||
|
||||
TArray<zone_t> Zones;
|
||||
|
||||
node_t * gamenodes;
|
||||
|
@ -195,7 +188,7 @@ TArray<FPlayerStart> deathmatchstarts (16);
|
|||
FPlayerStart playerstarts[MAXPLAYERS];
|
||||
TArray<FPlayerStart> AllPlayerStarts;
|
||||
|
||||
static void P_AllocateSideDefs (int count);
|
||||
static void P_AllocateSideDefs (MapData *map, int count);
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
@ -594,11 +587,11 @@ static void SetTexture (side_t *side, int position, const char *name, FMissingTe
|
|||
{
|
||||
// Print an error that lists all references to this sidedef.
|
||||
// We must scan the linedefs manually for all references to this sidedef.
|
||||
for(int i = 0; i < numlines; i++)
|
||||
for(unsigned i = 0; i < level.lines.Size(); i++)
|
||||
{
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
if (lines[i].sidedef[j] == side)
|
||||
if (level.lines[i].sidedef[j] == side)
|
||||
{
|
||||
Printf(TEXTCOLOR_RED"Unknown %s texture '"
|
||||
TEXTCOLOR_ORANGE "%s" TEXTCOLOR_RED
|
||||
|
@ -836,12 +829,9 @@ void P_FloodZones ()
|
|||
|
||||
void P_LoadVertexes (MapData * map)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Determine number of vertices:
|
||||
// total lump length / vertex record length.
|
||||
numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t);
|
||||
numvertexdatas = 0;
|
||||
unsigned numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t);
|
||||
|
||||
if (numvertexes == 0)
|
||||
{
|
||||
|
@ -849,18 +839,18 @@ void P_LoadVertexes (MapData * map)
|
|||
}
|
||||
|
||||
// Allocate memory for buffer.
|
||||
vertexes = new vertex_t[numvertexes];
|
||||
vertexdatas = NULL;
|
||||
level.vertexes.Alloc(numvertexes);
|
||||
vertexdatas.Clear();
|
||||
|
||||
map->Seek(ML_VERTEXES);
|
||||
|
||||
// Copy and convert vertex coordinates, internal representation as fixed.
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
for (auto &v : level.vertexes)
|
||||
{
|
||||
SWORD x, y;
|
||||
int16_t x, y;
|
||||
|
||||
(*map->file) >> x >> y;
|
||||
vertexes[i].set(double(x), double(y));
|
||||
v.set(double(x), double(y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,9 +871,9 @@ void P_LoadZSegs (FileReaderBase &data)
|
|||
|
||||
data >> v1 >> v2 >> line >> side;
|
||||
|
||||
segs[i].v1 = &vertexes[v1];
|
||||
segs[i].v2 = &vertexes[v2];
|
||||
segs[i].linedef = ldef = &lines[line];
|
||||
segs[i].v1 = &level.vertexes[v1];
|
||||
segs[i].v2 = &level.vertexes[v2];
|
||||
segs[i].linedef = ldef = &level.lines[line];
|
||||
segs[i].sidedef = ldef->sidedef[side];
|
||||
segs[i].frontsector = ldef->sidedef[side]->sector;
|
||||
if (ldef->flags & ML_TWOSIDED && ldef->sidedef[side^1] != NULL)
|
||||
|
@ -931,7 +921,7 @@ void P_LoadGLZSegs (FileReaderBase &data, int type)
|
|||
data >> side;
|
||||
|
||||
seg = subsectors[i].firstline + j;
|
||||
seg->v1 = &vertexes[v1];
|
||||
seg->v1 = &level.vertexes[v1];
|
||||
if (j == 0)
|
||||
{
|
||||
seg[subsectors[i].numlines - 1].v2 = seg->v1;
|
||||
|
@ -940,12 +930,12 @@ void P_LoadGLZSegs (FileReaderBase &data, int type)
|
|||
{
|
||||
seg[-1].v2 = seg->v1;
|
||||
}
|
||||
glsegextras[seg - segs].PartnerSeg = partner;
|
||||
seg->PartnerSeg = &segs[partner];
|
||||
if (line != 0xFFFFFFFF)
|
||||
{
|
||||
line_t *ldef;
|
||||
|
||||
seg->linedef = ldef = &lines[line];
|
||||
seg->linedef = ldef = &level.lines[line];
|
||||
seg->sidedef = ldef->sidedef[side];
|
||||
seg->frontsector = ldef->sidedef[side]->sector;
|
||||
if (ldef->flags & ML_TWOSIDED && ldef->sidedef[side^1] != NULL)
|
||||
|
@ -978,23 +968,26 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
|||
{
|
||||
// Read extra vertices added during node building
|
||||
DWORD orgVerts, newVerts;
|
||||
vertex_t *newvertarray;
|
||||
TStaticArray<vertex_t> newvertarray;
|
||||
unsigned int i;
|
||||
|
||||
data >> orgVerts >> newVerts;
|
||||
if (orgVerts > (DWORD)numvertexes)
|
||||
if (orgVerts > level.vertexes.Size())
|
||||
{ // These nodes are based on a map with more vertex data than we have.
|
||||
// We can't use them.
|
||||
throw CRecoverableError("Incorrect number of vertexes in nodes.\n");
|
||||
}
|
||||
if (orgVerts + newVerts == (DWORD)numvertexes)
|
||||
bool fix;
|
||||
if (orgVerts + newVerts == level.vertexes.Size())
|
||||
{
|
||||
newvertarray = vertexes;
|
||||
newvertarray = std::move(level.vertexes);
|
||||
fix = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
newvertarray = new vertex_t[orgVerts + newVerts];
|
||||
memcpy (newvertarray, vertexes, orgVerts * sizeof(vertex_t));
|
||||
newvertarray.Alloc(orgVerts + newVerts);
|
||||
memcpy (&newvertarray[0], &level.vertexes[0], orgVerts * sizeof(vertex_t));
|
||||
fix = true;
|
||||
}
|
||||
for (i = 0; i < newVerts; ++i)
|
||||
{
|
||||
|
@ -1002,16 +995,14 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
|||
data >> x >> y;
|
||||
newvertarray[i + orgVerts].set(x, y);
|
||||
}
|
||||
if (vertexes != newvertarray)
|
||||
if (fix)
|
||||
{
|
||||
for (i = 0; i < (DWORD)numlines; ++i)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
lines[i].v1 = lines[i].v1 - vertexes + newvertarray;
|
||||
lines[i].v2 = lines[i].v2 - vertexes + newvertarray;
|
||||
line.v1 = line.v1 - &level.vertexes[0] + &newvertarray[0];
|
||||
line.v2 = line.v2 - &level.vertexes[0] + &newvertarray[0];
|
||||
}
|
||||
delete[] vertexes;
|
||||
vertexes = newvertarray;
|
||||
numvertexes = orgVerts + newVerts;
|
||||
level.vertexes = std::move(newvertarray);
|
||||
}
|
||||
|
||||
// Read the subsectors
|
||||
|
@ -1047,7 +1038,6 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
|||
numsegs = numSegs;
|
||||
segs = new seg_t[numsegs];
|
||||
memset (segs, 0, numsegs*sizeof(seg_t));
|
||||
glsegextras = NULL;
|
||||
|
||||
for (i = 0; i < numSubs; ++i)
|
||||
{
|
||||
|
@ -1060,7 +1050,6 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
|||
}
|
||||
else
|
||||
{
|
||||
glsegextras = new glsegextra_t[numsegs];
|
||||
P_LoadGLZSegs (data, glnodes);
|
||||
}
|
||||
|
||||
|
@ -1215,9 +1204,9 @@ void P_LoadSegs (MapData * map)
|
|||
{
|
||||
int i;
|
||||
BYTE *data;
|
||||
int numvertexes = level.vertexes.Size();
|
||||
BYTE *vertchanged = new BYTE[numvertexes]; // phares 10/4/98
|
||||
DWORD segangle;
|
||||
line_t* line; // phares 10/4/98
|
||||
//int ptp_angle; // phares 10/4/98
|
||||
//int delta_angle; // phares 10/4/98
|
||||
int vnum1,vnum2; // phares 10/4/98
|
||||
|
@ -1252,10 +1241,9 @@ void P_LoadSegs (MapData * map)
|
|||
// Mark those used by linedefs. A marked vertex is one that is not a
|
||||
// candidate for movement further down.
|
||||
|
||||
line = lines;
|
||||
for (i = 0; i < numlines ; i++, line++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
vertchanged[line->v1 - vertexes] = vertchanged[line->v2 - vertexes] = 1;
|
||||
vertchanged[line.v1->Index()] = vertchanged[line.v2->Index()] = 1;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -1276,8 +1264,8 @@ void P_LoadSegs (MapData * map)
|
|||
throw badseg(0, i, MAX(vnum1, vnum2));
|
||||
}
|
||||
|
||||
li->v1 = &vertexes[vnum1];
|
||||
li->v2 = &vertexes[vnum2];
|
||||
li->v1 = &level.vertexes[vnum1];
|
||||
li->v2 = &level.vertexes[vnum2];
|
||||
|
||||
segangle = (WORD)LittleShort(ml->angle);
|
||||
|
||||
|
@ -1332,16 +1320,16 @@ void P_LoadSegs (MapData * map)
|
|||
}
|
||||
|
||||
linedef = LittleShort(ml->linedef);
|
||||
if ((unsigned)linedef >= (unsigned)numlines)
|
||||
if ((unsigned)linedef >= level.lines.Size())
|
||||
{
|
||||
throw badseg(1, i, linedef);
|
||||
}
|
||||
ldef = &lines[linedef];
|
||||
ldef = &level.lines[linedef];
|
||||
li->linedef = ldef;
|
||||
side = LittleShort(ml->side);
|
||||
if ((unsigned)(ldef->sidedef[side] - sides) >= (unsigned)numsides)
|
||||
if ((unsigned)(ldef->sidedef[side]->Index()) >= level.sides.Size())
|
||||
{
|
||||
throw badseg(2, i, int(ldef->sidedef[side] - sides));
|
||||
throw badseg(2, i, ldef->sidedef[side]->Index());
|
||||
}
|
||||
li->sidedef = ldef->sidedef[side];
|
||||
li->frontsector = ldef->sidedef[side]->sector;
|
||||
|
@ -1367,11 +1355,11 @@ void P_LoadSegs (MapData * map)
|
|||
break;
|
||||
|
||||
case 1:
|
||||
Printf ("Seg %d references a nonexistant linedef %d (max %d).\n", bad.badsegnum, bad.baddata, numlines);
|
||||
Printf ("Seg %d references a nonexistant linedef %d (max %u).\n", bad.badsegnum, bad.baddata, level.lines.Size());
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Printf ("The linedef for seg %d references a nonexistant sidedef %d (max %d).\n", bad.badsegnum, bad.baddata, numsides);
|
||||
Printf ("The linedef for seg %d references a nonexistant sidedef %d (max %d).\n", bad.badsegnum, bad.baddata, level.sides.Size());
|
||||
break;
|
||||
}
|
||||
Printf ("The BSP will be rebuilt.\n");
|
||||
|
@ -1981,7 +1969,7 @@ void P_SaveLineSpecial (line_t *ld)
|
|||
if (ld->sidedef[0] == NULL)
|
||||
return;
|
||||
|
||||
DWORD sidenum = DWORD(ld->sidedef[0]-sides);
|
||||
DWORD sidenum = ld->sidedef[0]->Index();
|
||||
// killough 4/4/98: support special sidedef interpretation below
|
||||
// [RH] Save Static_Init only if it's interested in the textures
|
||||
if (ld->special != Static_Init || ld->args[1] == Init_Color)
|
||||
|
@ -2003,7 +1991,7 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
ld->backsector = ld->sidedef[1] != NULL ? ld->sidedef[1]->sector : NULL;
|
||||
double dx = (ld->v2->fX() - ld->v1->fX());
|
||||
double dy = (ld->v2->fY() - ld->v1->fY());
|
||||
int linenum = int(ld-lines);
|
||||
int linenum = ld->Index();
|
||||
|
||||
if (ld->frontsector == NULL)
|
||||
{
|
||||
|
@ -2027,8 +2015,6 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
|
||||
switch (ld->special)
|
||||
{ // killough 4/11/98: handle special types
|
||||
int j;
|
||||
|
||||
case TranslucentLine: // killough 4/11/98: translucent 2s textures
|
||||
// [RH] Second arg controls how opaque it is.
|
||||
if (alpha == SHRT_MIN)
|
||||
|
@ -2053,14 +2039,14 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < numlines; j++)
|
||||
for (unsigned j = 0; j < level.lines.Size(); j++)
|
||||
{
|
||||
if (tagManager.LineHasID(j, ld->args[0]))
|
||||
{
|
||||
lines[j].alpha = dalpha;
|
||||
level.lines[j].alpha = dalpha;
|
||||
if (additive)
|
||||
{
|
||||
lines[j].flags |= ML_ADDTRANS;
|
||||
level.lines[j].flags |= ML_ADDTRANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2072,9 +2058,9 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
// killough 4/4/98: delay using sidedefs until they are loaded
|
||||
void P_FinishLoadingLineDefs ()
|
||||
{
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
P_FinishLoadingLineDef(&lines[i], sidetemp[lines[i].sidedef[0]-sides].a.alpha);
|
||||
P_FinishLoadingLineDef(&line, sidetemp[line.sidedef[0]->Index()].a.alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2084,10 +2070,10 @@ static void P_SetSideNum (side_t **sidenum_p, WORD sidenum)
|
|||
{
|
||||
*sidenum_p = NULL;
|
||||
}
|
||||
else if (sidecount < numsides)
|
||||
else if (sidecount < (int)level.sides.Size())
|
||||
{
|
||||
sidetemp[sidecount].a.map = sidenum;
|
||||
*sidenum_p = &sides[sidecount++];
|
||||
*sidenum_p = &level.sides[sidecount++];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2103,10 +2089,10 @@ void P_LoadLineDefs (MapData * map)
|
|||
char * mldf;
|
||||
maplinedef_t *mld;
|
||||
|
||||
numlines = lumplen / sizeof(maplinedef_t);
|
||||
lines = new line_t[numlines];
|
||||
int numlines = lumplen / sizeof(maplinedef_t);
|
||||
level.lines.Alloc(numlines);
|
||||
linemap.Resize(numlines);
|
||||
memset (lines, 0, numlines*sizeof(line_t));
|
||||
memset (&level.lines[0], 0, numlines*sizeof(line_t));
|
||||
|
||||
mldf = new char[lumplen];
|
||||
map->Read(ML_LINEDEFS, mldf);
|
||||
|
@ -2118,17 +2104,16 @@ void P_LoadLineDefs (MapData * map)
|
|||
for (skipped = sidecount = i = 0; i < numlines; )
|
||||
{
|
||||
mld = ((maplinedef_t*)mldf) + i;
|
||||
int v1 = LittleShort(mld->v1);
|
||||
int v2 = LittleShort(mld->v2);
|
||||
unsigned v1 = LittleShort(mld->v1);
|
||||
unsigned v2 = LittleShort(mld->v2);
|
||||
|
||||
if (v1 >= numvertexes || v2 >= numvertexes)
|
||||
if (v1 >= level.vertexes.Size() || v2 >= level.vertexes.Size())
|
||||
{
|
||||
delete [] mldf;
|
||||
I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %d vertices.", i+skipped, v1, v2, numvertexes);
|
||||
I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %u vertices.", i+skipped, v1, v2, level.vertexes.Size());
|
||||
}
|
||||
else if (v1 == v2 ||
|
||||
(vertexes[LittleShort(mld->v1)].fX() == vertexes[LittleShort(mld->v2)].fX() &&
|
||||
vertexes[LittleShort(mld->v1)].fY() == vertexes[LittleShort(mld->v2)].fY()))
|
||||
(level.vertexes[v1].fX() == level.vertexes[v2].fX() && level.vertexes[v1].fY() == level.vertexes[v2].fY()))
|
||||
{
|
||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
||||
|
@ -2153,14 +2138,15 @@ void P_LoadLineDefs (MapData * map)
|
|||
}
|
||||
}
|
||||
|
||||
P_AllocateSideDefs (sidecount);
|
||||
P_AllocateSideDefs (map, sidecount);
|
||||
|
||||
mld = (maplinedef_t *)mldf;
|
||||
ld = lines;
|
||||
ld = &level.lines[0];
|
||||
for (i = 0; i < numlines; i++, mld++, ld++)
|
||||
{
|
||||
ld->alpha = 1.; // [RH] Opaque by default
|
||||
ld->portalindex = UINT_MAX;
|
||||
ld->portaltransferred = UINT_MAX;
|
||||
|
||||
// [RH] Translate old linedef special and flags to be
|
||||
// compatible with the new format.
|
||||
|
@ -2178,8 +2164,8 @@ void P_LoadLineDefs (MapData * map)
|
|||
}
|
||||
#endif
|
||||
|
||||
ld->v1 = &vertexes[LittleShort(mld->v1)];
|
||||
ld->v2 = &vertexes[LittleShort(mld->v2)];
|
||||
ld->v1 = &level.vertexes[LittleShort(mld->v1)];
|
||||
ld->v2 = &level.vertexes[LittleShort(mld->v2)];
|
||||
|
||||
P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0]));
|
||||
P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1]));
|
||||
|
@ -2202,10 +2188,10 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
char * mldf;
|
||||
maplinedef2_t *mld;
|
||||
|
||||
numlines = lumplen / sizeof(maplinedef2_t);
|
||||
lines = new line_t[numlines];
|
||||
int numlines = lumplen / sizeof(maplinedef2_t);
|
||||
level.lines.Alloc(numlines);
|
||||
linemap.Resize(numlines);
|
||||
memset (lines, 0, numlines*sizeof(line_t));
|
||||
memset (&level.lines[0], 0, numlines*sizeof(line_t));
|
||||
|
||||
mldf = new char[lumplen];
|
||||
map->Read(ML_LINEDEFS, mldf);
|
||||
|
@ -2216,8 +2202,8 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
mld = ((maplinedef2_t*)mldf) + i;
|
||||
|
||||
if (mld->v1 == mld->v2 ||
|
||||
(vertexes[LittleShort(mld->v1)].fX() == vertexes[LittleShort(mld->v2)].fX() &&
|
||||
vertexes[LittleShort(mld->v1)].fY() == vertexes[LittleShort(mld->v2)].fY()))
|
||||
(level.vertexes[LittleShort(mld->v1)].fX() == level.vertexes[LittleShort(mld->v2)].fX() &&
|
||||
level.vertexes[LittleShort(mld->v1)].fY() == level.vertexes[LittleShort(mld->v2)].fY()))
|
||||
{
|
||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||
memmove (mld, mld+1, sizeof(*mld)*(numlines-i-1));
|
||||
|
@ -2245,15 +2231,16 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
ForceNodeBuild = true;
|
||||
}
|
||||
|
||||
P_AllocateSideDefs (sidecount);
|
||||
P_AllocateSideDefs (map, sidecount);
|
||||
|
||||
mld = (maplinedef2_t *)mldf;
|
||||
ld = lines;
|
||||
ld = &level.lines[0];
|
||||
for (i = 0; i < numlines; i++, mld++, ld++)
|
||||
{
|
||||
int j;
|
||||
|
||||
ld->portalindex = UINT_MAX;
|
||||
ld->portaltransferred = UINT_MAX;
|
||||
|
||||
for (j = 0; j < 5; j++)
|
||||
ld->args[j] = mld->args[j];
|
||||
|
@ -2261,8 +2248,8 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
ld->flags = LittleShort(mld->flags);
|
||||
ld->special = mld->special;
|
||||
|
||||
ld->v1 = &vertexes[LittleShort(mld->v1)];
|
||||
ld->v2 = &vertexes[LittleShort(mld->v2)];
|
||||
ld->v1 = &level.vertexes[LittleShort(mld->v1)];
|
||||
ld->v2 = &level.vertexes[LittleShort(mld->v2)];
|
||||
ld->alpha = 1.; // [RH] Opaque by default
|
||||
|
||||
P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0]));
|
||||
|
@ -2294,26 +2281,22 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
//
|
||||
// P_LoadSideDefs
|
||||
//
|
||||
// killough 4/4/98: split into two functions
|
||||
void P_LoadSideDefs (MapData * map)
|
||||
{
|
||||
numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
|
||||
}
|
||||
|
||||
static void P_AllocateSideDefs (int count)
|
||||
static void P_AllocateSideDefs (MapData *map, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
sides = new side_t[count];
|
||||
memset (sides, 0, count*sizeof(side_t));
|
||||
level.sides.Alloc(count);
|
||||
memset(&level.sides[0], 0, count * sizeof(side_t));
|
||||
|
||||
sidetemp = new sidei_t[MAX(count,numvertexes)];
|
||||
sidetemp = new sidei_t[MAX<int>(count, level.vertexes.Size())];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sidetemp[i].a.special = sidetemp[i].a.tag = 0;
|
||||
sidetemp[i].a.alpha = SHRT_MIN;
|
||||
sidetemp[i].a.map = NO_SIDE;
|
||||
}
|
||||
auto numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
|
||||
if (count < numsides)
|
||||
{
|
||||
Printf ("Map has %d unused sidedefs\n", numsides - count);
|
||||
|
@ -2334,9 +2317,10 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
{
|
||||
delete[] sidetemp;
|
||||
}
|
||||
sidetemp = new sidei_t[MAX(numvertexes, numsides)];
|
||||
int numsides = level.sides.Size();
|
||||
sidetemp = new sidei_t[MAX<int>(level.vertexes.Size(), numsides)];
|
||||
|
||||
for (i = 0; i < numvertexes; ++i)
|
||||
for (i = 0; i < (int)level.vertexes.Size(); ++i)
|
||||
{
|
||||
sidetemp[i].b.first = NO_SIDE;
|
||||
sidetemp[i].b.next = NO_SIDE;
|
||||
|
@ -2350,17 +2334,17 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
{
|
||||
// For each vertex, build a list of sidedefs that use that vertex
|
||||
// as their left edge.
|
||||
line_t *line = sides[i].linedef;
|
||||
int lineside = (line->sidedef[0] != &sides[i]);
|
||||
int vert = int((lineside ? line->v2 : line->v1) - vertexes);
|
||||
line_t *line = level.sides[i].linedef;
|
||||
int lineside = (line->sidedef[0] != &level.sides[i]);
|
||||
int vert = lineside ? line->v2->Index() : line->v1->Index();
|
||||
|
||||
sidetemp[i].b.lineside = lineside;
|
||||
sidetemp[i].b.next = sidetemp[vert].b.first;
|
||||
sidetemp[vert].b.first = i;
|
||||
|
||||
// Set each side so that it is the only member of its loop
|
||||
sides[i].LeftSide = NO_SIDE;
|
||||
sides[i].RightSide = NO_SIDE;
|
||||
level.sides[i].LeftSide = NO_SIDE;
|
||||
level.sides[i].RightSide = NO_SIDE;
|
||||
}
|
||||
|
||||
// For each side, find the side that is to its right and set the
|
||||
|
@ -2369,7 +2353,7 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
for (i = 0; i < numsides; ++i)
|
||||
{
|
||||
DWORD right;
|
||||
line_t *line = sides[i].linedef;
|
||||
line_t *line = level.sides[i].linedef;
|
||||
|
||||
// If the side's line only exists in a single sector,
|
||||
// then consider that line to be a self-contained loop
|
||||
|
@ -2381,21 +2365,21 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
if (NULL == rightside)
|
||||
{
|
||||
// There is no right side!
|
||||
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[unsigned(line-lines)]);
|
||||
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[line->Index()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
right = DWORD(rightside - sides);
|
||||
right = rightside->Index();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sidetemp[i].b.lineside)
|
||||
{
|
||||
right = int(line->v1 - vertexes);
|
||||
right = line->v1->Index();
|
||||
}
|
||||
else
|
||||
{
|
||||
right = int(line->v2 - vertexes);
|
||||
right = line->v2->Index();
|
||||
}
|
||||
|
||||
right = sidetemp[right].b.first;
|
||||
|
@ -2403,7 +2387,7 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
if (right == NO_SIDE)
|
||||
{
|
||||
// There is no right side!
|
||||
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[unsigned(line-lines)]);
|
||||
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[line->Index()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2414,7 +2398,7 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
line_t *leftline, *rightline;
|
||||
DAngle ang1, ang2, ang;
|
||||
|
||||
leftline = sides[i].linedef;
|
||||
leftline = level.sides[i].linedef;
|
||||
ang1 = leftline->Delta().Angle();
|
||||
if (!sidetemp[i].b.lineside)
|
||||
{
|
||||
|
@ -2423,9 +2407,9 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
|
||||
while (right != NO_SIDE)
|
||||
{
|
||||
if (sides[right].LeftSide == NO_SIDE)
|
||||
if (level.sides[right].LeftSide == NO_SIDE)
|
||||
{
|
||||
rightline = sides[right].linedef;
|
||||
rightline = level.sides[right].linedef;
|
||||
if (rightline->frontsector != rightline->backsector)
|
||||
{
|
||||
ang2 = rightline->Delta().Angle();
|
||||
|
@ -2450,8 +2434,8 @@ static void P_LoopSidedefs (bool firstloop)
|
|||
}
|
||||
assert((unsigned)i<(unsigned)numsides);
|
||||
assert(right<(unsigned)numsides);
|
||||
sides[i].RightSide = right;
|
||||
sides[right].LeftSide = i;
|
||||
level.sides[i].RightSide = right;
|
||||
level.sides[right].LeftSide = i;
|
||||
}
|
||||
|
||||
// We keep the sidedef init info around until after polyobjects are initialized,
|
||||
|
@ -2607,14 +2591,13 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps
|
|||
|
||||
void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
|
||||
{
|
||||
int i;
|
||||
char * msdf = new char[map->Size(ML_SIDEDEFS)];
|
||||
map->Read(ML_SIDEDEFS, msdf);
|
||||
|
||||
for (i = 0; i < numsides; i++)
|
||||
for (unsigned i = 0; i < level.sides.Size(); i++)
|
||||
{
|
||||
mapsidedef_t *msd = ((mapsidedef_t*)msdf) + sidetemp[i].a.map;
|
||||
side_t *sd = sides + i;
|
||||
side_t *sd = &level.sides[i];
|
||||
sector_t *sec;
|
||||
|
||||
// [RH] The Doom renderer ignored the patch y locations when
|
||||
|
@ -2631,7 +2614,7 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
|
|||
sd->SetTextureYScale(1.);
|
||||
sd->linedef = NULL;
|
||||
sd->Flags = 0;
|
||||
sd->Index = i;
|
||||
sd->UDMFIndex = i;
|
||||
|
||||
// killough 4/4/98: allow sidedef texture names to be overloaded
|
||||
// killough 4/11/98: refined to allow colormaps to work as wall
|
||||
|
@ -2773,22 +2756,21 @@ static void P_CreateBlockMap ()
|
|||
int bmapwidth, bmapheight;
|
||||
double dminx, dmaxx, dminy, dmaxy;
|
||||
int minx, maxx, miny, maxy;
|
||||
int i;
|
||||
int line;
|
||||
|
||||
if (numvertexes <= 0)
|
||||
if (level.vertexes.Size() == 0)
|
||||
return;
|
||||
|
||||
// Find map extents for the blockmap
|
||||
dminx = dmaxx = vertexes[0].fX();
|
||||
dminy = dmaxy = vertexes[0].fY();
|
||||
dminx = dmaxx = level.vertexes[0].fX();
|
||||
dminy = dmaxy = level.vertexes[0].fY();
|
||||
|
||||
for (i = 1; i < numvertexes; ++i)
|
||||
for (auto &vert : level.vertexes)
|
||||
{
|
||||
if (vertexes[i].fX() < dminx) dminx = vertexes[i].fX();
|
||||
else if (vertexes[i].fX() > dmaxx) dmaxx = vertexes[i].fX();
|
||||
if (vertexes[i].fY() < dminy) dminy = vertexes[i].fY();
|
||||
else if (vertexes[i].fY() > dmaxy) dmaxy = vertexes[i].fY();
|
||||
if (vert.fX() < dminx) dminx = vert.fX();
|
||||
else if (vert.fX() > dmaxx) dmaxx = vert.fX();
|
||||
if (vert.fY() < dminy) dminy = vert.fY();
|
||||
else if (vert.fY() > dmaxy) dmaxy = vert.fY();
|
||||
}
|
||||
|
||||
minx = int(dminx);
|
||||
|
@ -2808,12 +2790,12 @@ static void P_CreateBlockMap ()
|
|||
|
||||
BlockLists = new TArray<int>[bmapwidth * bmapheight];
|
||||
|
||||
for (line = 0; line < numlines; ++line)
|
||||
for (line = 0; line < (int)level.lines.Size(); ++line)
|
||||
{
|
||||
int x1 = int(lines[line].v1->fX());
|
||||
int y1 = int(lines[line].v1->fY());
|
||||
int x2 = int(lines[line].v2->fX());
|
||||
int y2 = int(lines[line].v2->fY());
|
||||
int x1 = int(level.lines[line].v1->fX());
|
||||
int y1 = int(level.lines[line].v1->fY());
|
||||
int x2 = int(level.lines[line].v2->fX());
|
||||
int y2 = int(level.lines[line].v2->fY());
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
int bx = (x1 - minx) >> BLOCKBITS;
|
||||
|
@ -2996,7 +2978,7 @@ static bool P_VerifyBlockMap(int count)
|
|||
// scan the list for out-of-range linedef indicies in list
|
||||
for(tmplist = list; *tmplist != -1; tmplist++)
|
||||
{
|
||||
if(*tmplist < 0 || *tmplist >= numlines)
|
||||
if((unsigned)*tmplist >= level.lines.Size())
|
||||
{
|
||||
Printf(PRINT_HIGH, "P_VerifyBlockMap: index >= numlines\n");
|
||||
return false;
|
||||
|
@ -3105,14 +3087,11 @@ static void P_GroupLines (bool buildmap)
|
|||
{
|
||||
subsectors[i].sector = subsectors[i].firstline->sidedef->sector;
|
||||
}
|
||||
if (glsegextras != NULL)
|
||||
for (int i = 0; i < numsubsectors; i++)
|
||||
{
|
||||
for (int i = 0; i < numsubsectors; i++)
|
||||
for (jj = 0; jj < subsectors[i].numlines; ++jj)
|
||||
{
|
||||
for (jj = 0; jj < subsectors[i].numlines; ++jj)
|
||||
{
|
||||
glsegextras[subsectors[i].firstline - segs + jj].Subsector = &subsectors[i];
|
||||
}
|
||||
subsectors[i].firstline[jj].Subsector = &subsectors[i];
|
||||
}
|
||||
}
|
||||
times[0].Unclock();
|
||||
|
@ -3120,9 +3099,9 @@ static void P_GroupLines (bool buildmap)
|
|||
// count number of lines in each sector
|
||||
times[1].Clock();
|
||||
total = 0;
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (unsigned i = 0; i < level.lines.Size(); i++)
|
||||
{
|
||||
auto li = &lines[i];
|
||||
auto li = &level.lines[i];
|
||||
if (li->frontsector == NULL)
|
||||
{
|
||||
if (!flaggedNoFronts)
|
||||
|
@ -3174,9 +3153,9 @@ static void P_GroupLines (bool buildmap)
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (unsigned i = 0; i < level.lines.Size(); i++)
|
||||
{
|
||||
auto li = &lines[i];
|
||||
auto li = &level.lines[i];
|
||||
if (li->frontsector != NULL)
|
||||
{
|
||||
li->frontsector->Lines[linesDoneInEachSector[li->frontsector->Index()]++] = li;
|
||||
|
@ -3393,11 +3372,11 @@ static void P_PrecacheLevel()
|
|||
hitlist[level.sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
||||
for (i = numsides - 1; i >= 0; i--)
|
||||
for (i = level.sides.Size() - 1; i >= 0; i--)
|
||||
{
|
||||
hitlist[sides[i].GetTexture(side_t::top).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
hitlist[sides[i].GetTexture(side_t::mid).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
hitlist[sides[i].GetTexture(side_t::bottom).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
hitlist[level.sides[i].GetTexture(side_t::top).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
hitlist[level.sides[i].GetTexture(side_t::mid).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
hitlist[level.sides[i].GetTexture(side_t::bottom).GetIndex()] |= FTextureManager::HIT_Wall;
|
||||
}
|
||||
|
||||
// Sky texture is always present.
|
||||
|
@ -3431,6 +3410,7 @@ extern polyblock_t **PolyBlockMap;
|
|||
|
||||
void P_FreeLevelData ()
|
||||
{
|
||||
P_FreeMapDataBackup();
|
||||
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
||||
Renderer->CleanLevelData();
|
||||
FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.
|
||||
|
@ -3443,28 +3423,20 @@ void P_FreeLevelData ()
|
|||
wminfo.maxfrags = 0;
|
||||
|
||||
FBehavior::StaticUnloadModules ();
|
||||
if (vertexes != NULL)
|
||||
{
|
||||
delete[] vertexes;
|
||||
vertexes = NULL;
|
||||
}
|
||||
numvertexes = 0;
|
||||
if (segs != NULL)
|
||||
{
|
||||
delete[] segs;
|
||||
segs = NULL;
|
||||
}
|
||||
numsegs = 0;
|
||||
if (glsegextras != NULL)
|
||||
{
|
||||
delete[] glsegextras;
|
||||
glsegextras = NULL;
|
||||
}
|
||||
if (level.sectors.Size() > 0)
|
||||
{
|
||||
delete[] level.sectors[0].e;
|
||||
}
|
||||
level.sectors.Clear();
|
||||
level.lines.Clear();
|
||||
level.sides.Clear();
|
||||
level.vertexes.Clear();
|
||||
|
||||
if (gamenodes != NULL && gamenodes != nodes)
|
||||
{
|
||||
|
@ -3493,18 +3465,6 @@ void P_FreeLevelData ()
|
|||
numsubsectors = numgamesubsectors = 0;
|
||||
nodes = gamenodes = NULL;
|
||||
numnodes = numgamenodes = 0;
|
||||
if (lines != NULL)
|
||||
{
|
||||
delete[] lines;
|
||||
lines = NULL;
|
||||
}
|
||||
numlines = 0;
|
||||
if (sides != NULL)
|
||||
{
|
||||
delete[] sides;
|
||||
sides = NULL;
|
||||
}
|
||||
numsides = 0;
|
||||
|
||||
if (blockmaplump != NULL)
|
||||
{
|
||||
|
@ -3761,7 +3721,6 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
times[1].Unclock();
|
||||
|
||||
times[2].Clock();
|
||||
P_LoadSideDefs (map);
|
||||
times[2].Unclock();
|
||||
|
||||
times[3].Clock();
|
||||
|
@ -3925,9 +3884,9 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
P_GetPolySpots (map, polyspots, anchors);
|
||||
FNodeBuilder::FLevel leveldata =
|
||||
{
|
||||
vertexes, numvertexes,
|
||||
sides, numsides,
|
||||
lines, numlines,
|
||||
&level.vertexes[0], (int)level.vertexes.Size(),
|
||||
&level.sides[0], (int)level.sides.Size(),
|
||||
&level.lines[0], (int)level.lines.Size(),
|
||||
0, 0, 0, 0
|
||||
};
|
||||
leveldata.FindMapBounds ();
|
||||
|
@ -3935,11 +3894,10 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
// In case a sync critical game mode is started, also build GL nodes to avoid problems
|
||||
// if the different machines' am_textured setting differs.
|
||||
FNodeBuilder builder (leveldata, polyspots, anchors, BuildGLNodes);
|
||||
delete[] vertexes;
|
||||
builder.Extract (nodes, numnodes,
|
||||
segs, glsegextras, numsegs,
|
||||
segs, numsegs,
|
||||
subsectors, numsubsectors,
|
||||
vertexes, numvertexes);
|
||||
level.vertexes);
|
||||
endTime = I_FPSTime ();
|
||||
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
|
||||
oldvertextable = builder.GetOldVertexTable();
|
||||
|
@ -4193,18 +4151,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
MapThingsUserDataIndex.Clear();
|
||||
MapThingsUserData.Clear();
|
||||
|
||||
loadsectors.Resize(level.sectors.Size());
|
||||
memcpy(&loadsectors[0], &level.sectors[0], loadsectors.Size() * sizeof(sector_t));
|
||||
loadlines.Resize(numlines);
|
||||
memcpy(&loadlines[0], lines, numlines * sizeof(line_t));
|
||||
loadsides.Resize(numsides);
|
||||
memcpy(&loadsides[0], sides, numsides * sizeof(side_t));
|
||||
|
||||
if (glsegextras != NULL)
|
||||
{
|
||||
delete[] glsegextras;
|
||||
glsegextras = NULL;
|
||||
}
|
||||
P_BackupMapData();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -150,7 +150,6 @@ struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init
|
|||
};
|
||||
extern sidei_t *sidetemp;
|
||||
extern bool hasglnodes;
|
||||
extern struct glsegextra_t *glsegextras;
|
||||
|
||||
struct FMissingCount
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "r_state.h"
|
||||
|
||||
#include "stats.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
static FRandom pr_botchecksight ("BotCheckSight");
|
||||
static FRandom pr_checksight ("CheckSight");
|
||||
|
@ -116,6 +117,7 @@ public:
|
|||
sightend = t2->PosRelative(task->portalgroup);
|
||||
sightstart.Z += t1->Height * 0.75;
|
||||
|
||||
portalgroup = task->portalgroup;
|
||||
Startfrac = task->Frac;
|
||||
Trace = { sightstart.X, sightstart.Y, sightend.X - sightstart.X, sightend.Y - sightstart.Y };
|
||||
Lastztop = Lastzbottom = sightstart.Z;
|
||||
|
@ -482,7 +484,7 @@ int SightCheck::P_SightBlockLinesIterator (int x, int y)
|
|||
|
||||
for (list = blockmaplump + offset + 1; *list != -1; list++)
|
||||
{
|
||||
if (!P_SightCheckLine (&lines[*list]))
|
||||
if (!P_SightCheckLine (&level.lines[*list]))
|
||||
{
|
||||
if (!portalfound) return 0;
|
||||
else res = -1;
|
||||
|
@ -790,6 +792,7 @@ sightcounts[2]++;
|
|||
|
||||
bool traverseres = P_SightTraverseIntercepts ( );
|
||||
if (itres == -1) return false; // if the iterator had an early out there was no line of sight. The traverser was only called to collect more portals.
|
||||
if (seeingthing->Sector->PortalGroup != portalgroup) return false; // We are in a different group than the seeingthing, so this trace cannot determine visibility alone.
|
||||
return traverseres;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "p_lnspec.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -52,7 +53,7 @@ static void P_SlopeLineToPoint (int lineid, const DVector3 &pos, bool slopeCeil)
|
|||
FLineIdIterator itr(lineid);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
const line_t *line = &lines[linenum];
|
||||
const line_t *line = &level.lines[linenum];
|
||||
sector_t *sec;
|
||||
secplane_t *plane;
|
||||
|
||||
|
@ -257,9 +258,9 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
{
|
||||
if (mt->info->Special == SMT_VertexFloorZ || mt->info->Special == SMT_VertexCeilingZ)
|
||||
{
|
||||
for (int i = 0; i < numvertexes; i++)
|
||||
for (unsigned i = 0; i < level.vertexes.Size(); i++)
|
||||
{
|
||||
if (vertexes[i].fX() == mt->pos.X && vertexes[i].fY() == mt->pos.Y)
|
||||
if (level.vertexes[i].fX() == mt->pos.X && level.vertexes[i].fY() == mt->pos.Y)
|
||||
{
|
||||
if (mt->info->Special == SMT_VertexFloorZ)
|
||||
{
|
||||
|
@ -277,7 +278,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < numvertexdatas; i++)
|
||||
for(unsigned i = 0; i < vertexdatas.Size(); i++)
|
||||
{
|
||||
int ii = oldvertextable == NULL ? i : oldvertextable[i];
|
||||
|
||||
|
@ -295,9 +296,8 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
}
|
||||
|
||||
// If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed.
|
||||
delete[] vertexdatas;
|
||||
vertexdatas = NULL;
|
||||
numvertexdatas = 0;
|
||||
vertexdatas.Clear();
|
||||
vertexdatas.ShrinkToFit();
|
||||
|
||||
if (vt_found)
|
||||
{
|
||||
|
@ -309,14 +309,14 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
DVector3 vec1, vec2;
|
||||
int vi1, vi2, vi3;
|
||||
|
||||
vi1 = int(sec.Lines[0]->v1 - vertexes);
|
||||
vi2 = int(sec.Lines[0]->v2 - vertexes);
|
||||
vi1 = sec.Lines[0]->v1->Index();
|
||||
vi2 = sec.Lines[0]->v2->Index();
|
||||
vi3 = (sec.Lines[1]->v1 == sec.Lines[0]->v1 || sec.Lines[1]->v1 == sec.Lines[0]->v2)?
|
||||
int(sec.Lines[1]->v2 - vertexes) : int(sec.Lines[1]->v1 - vertexes);
|
||||
sec.Lines[1]->v2->Index() : sec.Lines[1]->v1->Index();
|
||||
|
||||
vt1 = DVector3(vertexes[vi1].fPos(), 0);
|
||||
vt2 = DVector3(vertexes[vi2].fPos(), 0);
|
||||
vt3 = DVector3(vertexes[vi3].fPos(), 0);
|
||||
vt1 = DVector3(level.vertexes[vi1].fPos(), 0);
|
||||
vt2 = DVector3(level.vertexes[vi2].fPos(), 0);
|
||||
vt3 = DVector3(level.vertexes[vi3].fPos(), 0);
|
||||
|
||||
for(int j=0; j<2; j++)
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
vt2.Z = h2? *h2 : j==0? sec.GetPlaneTexZ(sector_t::floor) : sec.GetPlaneTexZ(sector_t::ceiling);
|
||||
vt3.Z = h3? *h3 : j==0? sec.GetPlaneTexZ(sector_t::floor) : sec.GetPlaneTexZ(sector_t::ceiling);
|
||||
|
||||
if (P_PointOnLineSidePrecise(vertexes[vi3].fX(), vertexes[vi3].fY(), sec.Lines[0]) == 0)
|
||||
if (P_PointOnLineSidePrecise(level.vertexes[vi3].fX(), level.vertexes[vi3].fY(), sec.Lines[0]) == 0)
|
||||
{
|
||||
vec1 = vt2 - vt3;
|
||||
vec2 = vt1 - vt3;
|
||||
|
@ -359,7 +359,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
|
||||
secplane_t *plane = j==0? &sec.floorplane : &sec.ceilingplane;
|
||||
|
||||
double dist = -cross[0] * vertexes[vi3].fX() - cross[1] * vertexes[vi3].fY() - cross[2] * vt3.Z;
|
||||
double dist = -cross[0] * level.vertexes[vi3].fX() - cross[1] * level.vertexes[vi3].fY() - cross[2] * vt3.Z;
|
||||
plane->set(cross[0], cross[1], cross[2], dist);
|
||||
}
|
||||
}
|
||||
|
@ -516,14 +516,14 @@ static void P_AlignPlane(sector_t *sec, line_t *line, int which)
|
|||
|
||||
void P_SetSlopes ()
|
||||
{
|
||||
int i, s;
|
||||
int s;
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
if (lines[i].special == Plane_Align)
|
||||
if (line.special == Plane_Align)
|
||||
{
|
||||
lines[i].special = 0;
|
||||
if (lines[i].backsector != NULL)
|
||||
line.special = 0;
|
||||
if (line.backsector != nullptr)
|
||||
{
|
||||
// args[0] is for floor, args[1] is for ceiling
|
||||
//
|
||||
|
@ -531,15 +531,15 @@ void P_SetSlopes ()
|
|||
// then args[0], bits 2-3 are for ceiling.
|
||||
for (s = 0; s < 2; s++)
|
||||
{
|
||||
int bits = lines[i].args[s] & 3;
|
||||
int bits = line.args[s] & 3;
|
||||
|
||||
if (s == 1 && bits == 0)
|
||||
bits = (lines[i].args[0] >> 2) & 3;
|
||||
bits = (line.args[0] >> 2) & 3;
|
||||
|
||||
if (bits == 1) // align front side to back
|
||||
P_AlignPlane (lines[i].frontsector, lines + i, s);
|
||||
P_AlignPlane (line.frontsector, &line, s);
|
||||
else if (bits == 2) // align back side to front
|
||||
P_AlignPlane (lines[i].backsector, lines + i, s);
|
||||
P_AlignPlane (line.backsector, &line, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -554,9 +554,9 @@ void P_SetSlopes ()
|
|||
|
||||
void P_CopySlopes()
|
||||
{
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
if (lines[i].special == Plane_Copy)
|
||||
if (line.special == Plane_Copy)
|
||||
{
|
||||
// The args are used for the tags of sectors to copy:
|
||||
// args[0]: front floor
|
||||
|
@ -564,31 +564,31 @@ void P_CopySlopes()
|
|||
// args[2]: back floor
|
||||
// args[3]: back ceiling
|
||||
// args[4]: copy slopes from one side of the line to the other.
|
||||
lines[i].special = 0;
|
||||
for (int s = 0; s < (lines[i].backsector ? 4 : 2); s++)
|
||||
line.special = 0;
|
||||
for (int s = 0; s < (line.backsector ? 4 : 2); s++)
|
||||
{
|
||||
if (lines[i].args[s])
|
||||
P_CopyPlane(lines[i].args[s],
|
||||
(s & 2 ? lines[i].backsector : lines[i].frontsector), s & 1);
|
||||
if (line.args[s])
|
||||
P_CopyPlane(line.args[s],
|
||||
(s & 2 ? line.backsector : line.frontsector), s & 1);
|
||||
}
|
||||
|
||||
if (lines[i].backsector != NULL)
|
||||
if (line.backsector != NULL)
|
||||
{
|
||||
if ((lines[i].args[4] & 3) == 1)
|
||||
if ((line.args[4] & 3) == 1)
|
||||
{
|
||||
lines[i].backsector->floorplane = lines[i].frontsector->floorplane;
|
||||
line.backsector->floorplane = line.frontsector->floorplane;
|
||||
}
|
||||
else if ((lines[i].args[4] & 3) == 2)
|
||||
else if ((line.args[4] & 3) == 2)
|
||||
{
|
||||
lines[i].frontsector->floorplane = lines[i].backsector->floorplane;
|
||||
line.frontsector->floorplane = line.backsector->floorplane;
|
||||
}
|
||||
if ((lines[i].args[4] & 12) == 4)
|
||||
if ((line.args[4] & 12) == 4)
|
||||
{
|
||||
lines[i].backsector->ceilingplane = lines[i].frontsector->ceilingplane;
|
||||
line.backsector->ceilingplane = line.frontsector->ceilingplane;
|
||||
}
|
||||
else if ((lines[i].args[4] & 12) == 8)
|
||||
else if ((line.args[4] & 12) == 8)
|
||||
{
|
||||
lines[i].frontsector->ceilingplane = lines[i].backsector->ceilingplane;
|
||||
line.frontsector->ceilingplane = line.backsector->ceilingplane;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
127
src/p_spec.cpp
127
src/p_spec.cpp
|
@ -70,6 +70,7 @@
|
|||
#include "d_player.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_blockmap.h"
|
||||
#include "g_levellocals.h"
|
||||
#ifndef NO_EDATA
|
||||
#include "edata.h"
|
||||
#endif
|
||||
|
@ -189,7 +190,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
|
|||
// end of changed code
|
||||
if (developer >= DMSG_SPAMMY && buttonSuccess)
|
||||
{
|
||||
Printf ("Line special %d activated on line %i\n", special, int(line - lines));
|
||||
Printf ("Line special %d activated on line %i\n", special, line->Index());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -361,7 +362,7 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType)
|
|||
// end of changed code
|
||||
if (developer >= DMSG_SPAMMY && buttonSuccess)
|
||||
{
|
||||
Printf("Line special %d predicted on line %i\n", special, int(line - lines));
|
||||
Printf("Line special %d predicted on line %i\n", special, line->Index());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -790,14 +791,14 @@ DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, BYTE flags
|
|||
FLineIdIterator itr(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
if (flags & WLF_SIDE1 && lines[linenum].sidedef[0] != NULL)
|
||||
if (flags & WLF_SIDE1 && level.lines[linenum].sidedef[0] != NULL)
|
||||
{
|
||||
lines[linenum].sidedef[0]->Flags |= wallflags;
|
||||
level.lines[linenum].sidedef[0]->Flags |= wallflags;
|
||||
}
|
||||
|
||||
if (flags & WLF_SIDE2 && lines[linenum].sidedef[1] != NULL)
|
||||
if (flags & WLF_SIDE2 && level.lines[linenum].sidedef[1] != NULL)
|
||||
{
|
||||
lines[linenum].sidedef[1]->Flags |= wallflags;
|
||||
level.lines[linenum].sidedef[1]->Flags |= wallflags;
|
||||
}
|
||||
}
|
||||
ChangeStatNum(STAT_LIGHTTRANSFER);
|
||||
|
@ -821,7 +822,7 @@ void DWallLightTransfer::DoTransfer (short lightlevel, int target, BYTE flags)
|
|||
FLineIdIterator itr(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *line = &lines[linenum];
|
||||
line_t *line = &level.lines[linenum];
|
||||
|
||||
if (flags & WLF_SIDE1 && line->sidedef[0] != NULL)
|
||||
{
|
||||
|
@ -958,42 +959,42 @@ static void CopyPortal(int sectortag, int plane, unsigned pnum, double alpha, bo
|
|||
SetPortal(&level.sectors[s], plane, pnum, alpha);
|
||||
}
|
||||
|
||||
for (int j=0;j<numlines;j++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
// Check if this portal needs to be copied to other sectors
|
||||
// This must be done here to ensure that it gets done only after the portal is set up
|
||||
if (lines[j].special == Sector_SetPortal &&
|
||||
lines[j].args[1] == 1 &&
|
||||
(lines[j].args[2] == plane || lines[j].args[2] == 3) &&
|
||||
lines[j].args[3] == sectortag)
|
||||
if (line.special == Sector_SetPortal &&
|
||||
line.args[1] == 1 &&
|
||||
(line.args[2] == plane || line.args[2] == 3) &&
|
||||
line.args[3] == sectortag)
|
||||
{
|
||||
if (lines[j].args[0] == 0)
|
||||
if (line.args[0] == 0)
|
||||
{
|
||||
SetPortal(lines[j].frontsector, plane, pnum, alpha);
|
||||
SetPortal(line.frontsector, plane, pnum, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
FSectorTagIterator itr(lines[j].args[0]);
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
SetPortal(&level.sectors[s], plane, pnum, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tolines && lines[j].special == Sector_SetPortal &&
|
||||
lines[j].args[1] == 5 &&
|
||||
lines[j].args[3] == sectortag)
|
||||
if (tolines && line.special == Sector_SetPortal &&
|
||||
line.args[1] == 5 &&
|
||||
line.args[3] == sectortag)
|
||||
{
|
||||
if (lines[j].args[0] == 0)
|
||||
if (line.args[0] == 0)
|
||||
{
|
||||
lines[j].portaltransferred = pnum;
|
||||
line.portaltransferred = pnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
FLineIdIterator itr(lines[j].args[0]);
|
||||
FLineIdIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
lines[s].portaltransferred = pnum;
|
||||
level.lines[s].portaltransferred = pnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1004,20 +1005,20 @@ static void CopyPortal(int sectortag, int plane, unsigned pnum, double alpha, bo
|
|||
void P_SpawnPortal(line_t *line, int sectortag, int plane, int bytealpha, int linked)
|
||||
{
|
||||
if (plane < 0 || plane > 2 || (linked && plane == 2)) return;
|
||||
for (int i=0;i<numlines;i++)
|
||||
for (auto &oline : level.lines)
|
||||
{
|
||||
// We must look for the reference line with a linear search unless we want to waste the line ID for it
|
||||
// which is not a good idea.
|
||||
if (lines[i].special == Sector_SetPortal &&
|
||||
lines[i].args[0] == sectortag &&
|
||||
lines[i].args[1] == linked &&
|
||||
lines[i].args[2] == plane &&
|
||||
lines[i].args[3] == 1)
|
||||
if (oline.special == Sector_SetPortal &&
|
||||
oline.args[0] == sectortag &&
|
||||
oline.args[1] == linked &&
|
||||
oline.args[2] == plane &&
|
||||
oline.args[3] == 1)
|
||||
{
|
||||
// beware of overflows.
|
||||
DVector2 pos1 = line->v1->fPos() + line->Delta() / 2;
|
||||
DVector2 pos2 = lines[i].v1->fPos() + lines[i].Delta() / 2;
|
||||
unsigned pnum = P_GetPortal(linked ? PORTS_LINKEDPORTAL : PORTS_PORTAL, plane, line->frontsector, lines[i].frontsector, pos2 - pos1);
|
||||
DVector2 pos2 = oline.v1->fPos() + oline.Delta() / 2;
|
||||
unsigned pnum = P_GetPortal(linked ? PORTS_LINKEDPORTAL : PORTS_PORTAL, plane, line->frontsector, oline.frontsector, pos2 - pos1);
|
||||
CopyPortal(sectortag, plane, pnum, bytealpha / 255., false);
|
||||
return;
|
||||
}
|
||||
|
@ -1266,9 +1267,9 @@ void P_SpawnSpecials (void)
|
|||
P_SpawnSkybox(pt2);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numlines; i++)
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
switch (lines[i].special)
|
||||
switch (line.special)
|
||||
{
|
||||
int s;
|
||||
sector_t *sec;
|
||||
|
@ -1277,16 +1278,16 @@ void P_SpawnSpecials (void)
|
|||
// support for drawn heights coming from different sector
|
||||
case Transfer_Heights:
|
||||
{
|
||||
sec = lines[i].frontsector;
|
||||
if (lines[i].args[1] & 2)
|
||||
sec = line.frontsector;
|
||||
if (line.args[1] & 2)
|
||||
{
|
||||
sec->MoreFlags |= SECF_FAKEFLOORONLY;
|
||||
}
|
||||
if (lines[i].args[1] & 4)
|
||||
if (line.args[1] & 4)
|
||||
{
|
||||
sec->MoreFlags |= SECF_CLIPFAKEPLANES;
|
||||
}
|
||||
if (lines[i].args[1] & 8)
|
||||
if (line.args[1] & 8)
|
||||
{
|
||||
sec->MoreFlags |= SECF_UNDERWATER;
|
||||
}
|
||||
|
@ -1294,15 +1295,15 @@ void P_SpawnSpecials (void)
|
|||
{
|
||||
sec->MoreFlags |= SECF_FORCEDUNDERWATER;
|
||||
}
|
||||
if (lines[i].args[1] & 16)
|
||||
if (line.args[1] & 16)
|
||||
{
|
||||
sec->MoreFlags |= SECF_IGNOREHEIGHTSEC;
|
||||
}
|
||||
if (lines[i].args[1] & 32)
|
||||
if (line.args[1] & 32)
|
||||
{
|
||||
sec->MoreFlags |= SECF_NOFAKELIGHT;
|
||||
}
|
||||
FSectorTagIterator itr(lines[i].args[0]);
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
level.sectors[s].heightsec = sec;
|
||||
|
@ -1315,29 +1316,29 @@ void P_SpawnSpecials (void)
|
|||
// killough 3/16/98: Add support for setting
|
||||
// floor lighting independently (e.g. lava)
|
||||
case Transfer_FloorLight:
|
||||
new DLightTransfer (lines[i].frontsector, lines[i].args[0], true);
|
||||
new DLightTransfer (line.frontsector, line.args[0], true);
|
||||
break;
|
||||
|
||||
// killough 4/11/98: Add support for setting
|
||||
// ceiling lighting independently
|
||||
case Transfer_CeilingLight:
|
||||
new DLightTransfer (lines[i].frontsector, lines[i].args[0], false);
|
||||
new DLightTransfer (line.frontsector, line.args[0], false);
|
||||
break;
|
||||
|
||||
// [Graf Zahl] Add support for setting lighting
|
||||
// per wall independently
|
||||
case Transfer_WallLight:
|
||||
new DWallLightTransfer (lines[i].frontsector, lines[i].args[0], lines[i].args[1]);
|
||||
new DWallLightTransfer (line.frontsector, line.args[0], line.args[1]);
|
||||
break;
|
||||
|
||||
case Sector_Attach3dMidtex:
|
||||
P_Attach3dMidtexLinesToSector(lines[i].frontsector, lines[i].args[0], lines[i].args[1], !!lines[i].args[2]);
|
||||
P_Attach3dMidtexLinesToSector(line.frontsector, line.args[0], line.args[1], !!line.args[2]);
|
||||
break;
|
||||
|
||||
case Sector_SetLink:
|
||||
if (lines[i].args[0] == 0)
|
||||
if (line.args[0] == 0)
|
||||
{
|
||||
P_AddSectorLinks(lines[i].frontsector, lines[i].args[1], lines[i].args[2], lines[i].args[3]);
|
||||
P_AddSectorLinks(line.frontsector, line.args[1], line.args[2], line.args[3]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1355,30 +1356,29 @@ void P_SpawnSpecials (void)
|
|||
// arg 2 = 0:floor, 1:ceiling, 2:both
|
||||
// arg 3 = 0: anchor, 1: reference line
|
||||
// arg 4 = for the anchor only: alpha
|
||||
if ((lines[i].args[1] == 0 || lines[i].args[1] == 6) && lines[i].args[3] == 0)
|
||||
if ((line.args[1] == 0 || line.args[1] == 6) && line.args[3] == 0)
|
||||
{
|
||||
P_SpawnPortal(&lines[i], lines[i].args[0], lines[i].args[2], lines[i].args[4], lines[i].args[1]);
|
||||
P_SpawnPortal(&line, line.args[0], line.args[2], line.args[4], line.args[1]);
|
||||
}
|
||||
else if (lines[i].args[1] == 3 || lines[i].args[1] == 4)
|
||||
else if (line.args[1] == 3 || line.args[1] == 4)
|
||||
{
|
||||
line_t *line = &lines[i];
|
||||
unsigned pnum = P_GetPortal(line->args[1] == 3 ? PORTS_PLANE : PORTS_HORIZON, line->args[2], line->frontsector, NULL, { 0,0 });
|
||||
CopyPortal(line->args[0], line->args[2], pnum, 0, true);
|
||||
unsigned pnum = P_GetPortal(line.args[1] == 3 ? PORTS_PLANE : PORTS_HORIZON, line.args[2], line.frontsector, NULL, { 0,0 });
|
||||
CopyPortal(line.args[0], line.args[2], pnum, 0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case Line_SetPortal:
|
||||
P_SpawnLinePortal(&lines[i]);
|
||||
P_SpawnLinePortal(&line);
|
||||
break;
|
||||
|
||||
// [RH] ZDoom Static_Init settings
|
||||
case Static_Init:
|
||||
switch (lines[i].args[1])
|
||||
switch (line.args[1])
|
||||
{
|
||||
case Init_Gravity:
|
||||
{
|
||||
double grav = lines[i].Delta().Length() / 100.;
|
||||
FSectorTagIterator itr(lines[i].args[0]);
|
||||
double grav = line.Delta().Length() / 100.;
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
level.sectors[s].gravity = grav;
|
||||
}
|
||||
|
@ -1389,8 +1389,8 @@ void P_SpawnSpecials (void)
|
|||
|
||||
case Init_Damage:
|
||||
{
|
||||
int damage = int(lines[i].Delta().Length());
|
||||
FSectorTagIterator itr(lines[i].args[0]);
|
||||
int damage = int(line.Delta().Length());
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t *sec = &level.sectors[s];
|
||||
|
@ -1416,8 +1416,8 @@ void P_SpawnSpecials (void)
|
|||
break;
|
||||
|
||||
case Init_SectorLink:
|
||||
if (lines[i].args[3] == 0)
|
||||
P_AddSectorLinksByID(lines[i].frontsector, lines[i].args[0], lines[i].args[2]);
|
||||
if (line.args[3] == 0)
|
||||
P_AddSectorLinksByID(line.frontsector, line.args[0], line.args[2]);
|
||||
break;
|
||||
|
||||
// killough 10/98:
|
||||
|
@ -1431,9 +1431,9 @@ void P_SpawnSpecials (void)
|
|||
|
||||
case Init_TransferSky:
|
||||
{
|
||||
FSectorTagIterator itr(lines[i].args[0]);
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
level.sectors[s].sky = (i + 1) | PL_SKYFLAT;
|
||||
level.sectors[s].sky = (line.Index() + 1) | PL_SKYFLAT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1499,10 +1499,9 @@ void P_SpawnSpecials (void)
|
|||
|
||||
static void P_SpawnFriction(void)
|
||||
{
|
||||
int i;
|
||||
line_t *l = lines;
|
||||
line_t *l = &level.lines[0];
|
||||
|
||||
for (i = 0 ; i < numlines ; i++,l++)
|
||||
for (unsigned i = 0 ; i < level.lines.Size() ; i++,l++)
|
||||
{
|
||||
if (l->special == Sector_SetFriction)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "p_tags.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
FTagManager tagManager;
|
||||
|
||||
|
@ -45,17 +46,6 @@ FTagManager tagManager;
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static inline int lineindex(const line_t *line)
|
||||
{
|
||||
return (int)(intptr_t)(line - lines);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FTagManager::AddSectorTag(int sector, int tag)
|
||||
{
|
||||
if (tag == 0) return;
|
||||
|
@ -244,7 +234,7 @@ bool FTagManager::SectorHasTag(const sector_t *sector, int tag) const
|
|||
|
||||
int FTagManager::GetFirstLineID(const line_t *line) const
|
||||
{
|
||||
int i = lineindex(line);
|
||||
int i = line->Index();
|
||||
return LineHasIDs(i) ? allIDs[startForLine[i]].tag : 0;
|
||||
}
|
||||
|
||||
|
@ -276,7 +266,7 @@ bool FTagManager::LineHasID(int i, int tag) const
|
|||
|
||||
bool FTagManager::LineHasID(const line_t *line, int tag) const
|
||||
{
|
||||
return LineHasID(lineindex(line), tag);
|
||||
return LineHasID(line->Index(), tag);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "r_utility.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#define FUDGEFACTOR 10
|
||||
|
||||
|
@ -447,10 +448,10 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
|
|||
FLineIdIterator itr(id);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
if (line-lines == i)
|
||||
if (line->Index() == i)
|
||||
continue;
|
||||
|
||||
if ((l=lines+i) != line && l->backsector)
|
||||
if ((l=&level.lines[i]) != line && l->backsector)
|
||||
{
|
||||
// Get the thing's position along the source linedef
|
||||
double pos;
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "p_spec.h"
|
||||
#include "math/cmath.h"
|
||||
#include "actorptrselect.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// Set of spawnable things for the Thing_Spawn and Thing_Projectile specials.
|
||||
FClassMap SpawnableThings;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "g_level.h"
|
||||
#include "r_utility.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
extern gamestate_t wipegamestate;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue