mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- let UDMFParser use the level from the map loader, not the global variable.
This commit is contained in:
parent
df2bef2f60
commit
eecf3a203a
1 changed files with 35 additions and 34 deletions
|
@ -417,6 +417,7 @@ class UDMFParser : public UDMFParserBase
|
||||||
bool isExtended;
|
bool isExtended;
|
||||||
bool floordrop;
|
bool floordrop;
|
||||||
MapLoader *loader;
|
MapLoader *loader;
|
||||||
|
FLevelLocals *Level;
|
||||||
|
|
||||||
TArray<line_t> ParsedLines;
|
TArray<line_t> ParsedLines;
|
||||||
TArray<side_t> ParsedSides;
|
TArray<side_t> ParsedSides;
|
||||||
|
@ -430,7 +431,7 @@ class UDMFParser : public UDMFParserBase
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UDMFParser(MapLoader *ld, FMissingTextureTracker &missing)
|
UDMFParser(MapLoader *ld, FMissingTextureTracker &missing)
|
||||||
: loader(ld), missingTex(missing)
|
: loader(ld), Level(ld->Level), missingTex(missing)
|
||||||
{
|
{
|
||||||
loader->linemap.Clear();
|
loader->linemap.Clear();
|
||||||
}
|
}
|
||||||
|
@ -823,9 +824,9 @@ public:
|
||||||
ld->portalindex = UINT_MAX;
|
ld->portalindex = UINT_MAX;
|
||||||
ld->portaltransferred = UINT_MAX;
|
ld->portaltransferred = UINT_MAX;
|
||||||
ld->sidedef[0] = ld->sidedef[1] = NULL;
|
ld->sidedef[0] = ld->sidedef[1] = NULL;
|
||||||
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
|
if (Level->flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
|
||||||
if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
|
if (Level->flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
|
||||||
if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
|
if (Level->flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
|
||||||
|
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
while (!sc.CheckToken('}'))
|
while (!sc.CheckToken('}'))
|
||||||
|
@ -1455,7 +1456,7 @@ public:
|
||||||
sec->touching_thinglist = nullptr; // phares 3/14/98
|
sec->touching_thinglist = nullptr; // phares 3/14/98
|
||||||
sec->sectorportal_thinglist = nullptr;
|
sec->sectorportal_thinglist = nullptr;
|
||||||
sec->touching_renderthings = nullptr;
|
sec->touching_renderthings = nullptr;
|
||||||
sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
|
sec->seqType = (Level->flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
|
||||||
sec->nextsec = -1; //jff 2/26/98 add fields to support locking out
|
sec->nextsec = -1; //jff 2/26/98 add fields to support locking out
|
||||||
sec->prevsec = -1; // stair retriggering until build completes
|
sec->prevsec = -1; // stair retriggering until build completes
|
||||||
sec->heightsec = NULL; // sector used to get floor and ceiling height
|
sec->heightsec = NULL; // sector used to get floor and ceiling height
|
||||||
|
@ -1958,13 +1959,13 @@ public:
|
||||||
// [RH] Sectors default to white light with the default fade.
|
// [RH] Sectors default to white light with the default fade.
|
||||||
// If they are outside (have a sky ceiling), they use the outside fog.
|
// If they are outside (have a sky ceiling), they use the outside fog.
|
||||||
sec->Colormap.LightColor = PalEntry(255, 255, 255);
|
sec->Colormap.LightColor = PalEntry(255, 255, 255);
|
||||||
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
if (Level->outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
||||||
{
|
{
|
||||||
sec->Colormap.FadeColor.SetRGB(level.outsidefog);
|
sec->Colormap.FadeColor.SetRGB(Level->outsidefog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sec->Colormap.FadeColor.SetRGB(level.fadeto);
|
sec->Colormap.FadeColor.SetRGB(Level->fadeto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1972,10 +1973,10 @@ public:
|
||||||
sec->Colormap.LightColor.SetRGB(lightcolor);
|
sec->Colormap.LightColor.SetRGB(lightcolor);
|
||||||
if (fadecolor == ~0u)
|
if (fadecolor == ~0u)
|
||||||
{
|
{
|
||||||
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
if (Level->outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
|
||||||
fadecolor = level.outsidefog;
|
fadecolor = Level->outsidefog;
|
||||||
else
|
else
|
||||||
fadecolor = level.fadeto;
|
fadecolor = Level->fadeto;
|
||||||
}
|
}
|
||||||
sec->Colormap.FadeColor.SetRGB(fadecolor);
|
sec->Colormap.FadeColor.SetRGB(fadecolor);
|
||||||
sec->Colormap.Desaturation = clamp(desaturation, 0, 255);
|
sec->Colormap.Desaturation = clamp(desaturation, 0, 255);
|
||||||
|
@ -2041,12 +2042,12 @@ public:
|
||||||
intptr_t v1i = intptr_t(ParsedLines[i].v1);
|
intptr_t v1i = intptr_t(ParsedLines[i].v1);
|
||||||
intptr_t v2i = intptr_t(ParsedLines[i].v2);
|
intptr_t v2i = intptr_t(ParsedLines[i].v2);
|
||||||
|
|
||||||
if ((unsigned)v1i >= level.vertexes.Size() || (unsigned)v2i >= level.vertexes.Size())
|
if ((unsigned)v1i >= Level->vertexes.Size() || (unsigned)v2i >= Level->vertexes.Size())
|
||||||
{
|
{
|
||||||
I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %u vertices.", i+skipped, v1i, v2i, level.vertexes.Size());
|
I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %u vertices.", i+skipped, v1i, v2i, Level->vertexes.Size());
|
||||||
}
|
}
|
||||||
else if (v1i == v2i ||
|
else if (v1i == v2i ||
|
||||||
(level.vertexes[v1i].fX() == level.vertexes[v2i].fX() && level.vertexes[v1i].fY() == level.vertexes[v2i].fY()))
|
(Level->vertexes[v1i].fX() == Level->vertexes[v2i].fX() && Level->vertexes[v1i].fY() == Level->vertexes[v2i].fY()))
|
||||||
{
|
{
|
||||||
Printf ("Removing 0-length line %d\n", i+skipped);
|
Printf ("Removing 0-length line %d\n", i+skipped);
|
||||||
ParsedLines.Delete(i);
|
ParsedLines.Delete(i);
|
||||||
|
@ -2055,8 +2056,8 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ParsedLines[i].v1 = &level.vertexes[v1i];
|
ParsedLines[i].v1 = &Level->vertexes[v1i];
|
||||||
ParsedLines[i].v2 = &level.vertexes[v2i];
|
ParsedLines[i].v2 = &Level->vertexes[v2i];
|
||||||
|
|
||||||
if (ParsedLines[i].sidedef[0] != NULL)
|
if (ParsedLines[i].sidedef[0] != NULL)
|
||||||
sidecount++;
|
sidecount++;
|
||||||
|
@ -2067,11 +2068,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned numlines = ParsedLines.Size();
|
unsigned numlines = ParsedLines.Size();
|
||||||
level.sides.Alloc(sidecount);
|
Level->sides.Alloc(sidecount);
|
||||||
level.lines.Alloc(numlines);
|
Level->lines.Alloc(numlines);
|
||||||
int line, side;
|
int line, side;
|
||||||
auto lines = &level.lines[0];
|
auto lines = &Level->lines[0];
|
||||||
auto sides = &level.sides[0];
|
auto sides = &Level->sides[0];
|
||||||
|
|
||||||
for(line = 0, side = 0; line < (int)numlines; line++)
|
for(line = 0, side = 0; line < (int)numlines; line++)
|
||||||
{
|
{
|
||||||
|
@ -2088,7 +2089,7 @@ public:
|
||||||
{
|
{
|
||||||
sides[side] = ParsedSides[mapside];
|
sides[side] = ParsedSides[mapside];
|
||||||
sides[side].linedef = &lines[line];
|
sides[side].linedef = &lines[line];
|
||||||
sides[side].sector = &level.sectors[intptr_t(sides[side].sector)];
|
sides[side].sector = &Level->sectors[intptr_t(sides[side].sector)];
|
||||||
lines[line].sidedef[sd] = &sides[side];
|
lines[line].sidedef[sd] = &sides[side];
|
||||||
|
|
||||||
loader->ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
loader->ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
||||||
|
@ -2107,7 +2108,7 @@ public:
|
||||||
loader->FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
loader->FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int sideDelta = level.sides.Size() - side;
|
const int sideDelta = Level->sides.Size() - side;
|
||||||
assert(sideDelta >= 0);
|
assert(sideDelta >= 0);
|
||||||
|
|
||||||
if (sideDelta < 0)
|
if (sideDelta < 0)
|
||||||
|
@ -2116,7 +2117,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (sideDelta > 0)
|
else if (sideDelta > 0)
|
||||||
{
|
{
|
||||||
level.sides.Resize(side);
|
Level->sides.Resize(side);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2146,7 +2147,7 @@ public:
|
||||||
isTranslated = false;
|
isTranslated = false;
|
||||||
break;
|
break;
|
||||||
case NAME_ZDoomTranslated:
|
case NAME_ZDoomTranslated:
|
||||||
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
Level->flags2 |= LEVEL2_DUMMYSWITCHES;
|
||||||
namespace_bits = Zdt;
|
namespace_bits = Zdt;
|
||||||
break;
|
break;
|
||||||
case NAME_Vavoom:
|
case NAME_Vavoom:
|
||||||
|
@ -2160,19 +2161,19 @@ public:
|
||||||
case NAME_Doom:
|
case NAME_Doom:
|
||||||
namespace_bits = Dm;
|
namespace_bits = Dm;
|
||||||
P_LoadTranslator("xlat/doom_base.txt");
|
P_LoadTranslator("xlat/doom_base.txt");
|
||||||
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
Level->flags2 |= LEVEL2_DUMMYSWITCHES;
|
||||||
floordrop = true;
|
floordrop = true;
|
||||||
break;
|
break;
|
||||||
case NAME_Heretic:
|
case NAME_Heretic:
|
||||||
namespace_bits = Ht;
|
namespace_bits = Ht;
|
||||||
P_LoadTranslator("xlat/heretic_base.txt");
|
P_LoadTranslator("xlat/heretic_base.txt");
|
||||||
level.flags2 |= LEVEL2_DUMMYSWITCHES;
|
Level->flags2 |= LEVEL2_DUMMYSWITCHES;
|
||||||
floordrop = true;
|
floordrop = true;
|
||||||
break;
|
break;
|
||||||
case NAME_Strife:
|
case NAME_Strife:
|
||||||
namespace_bits = St;
|
namespace_bits = St;
|
||||||
P_LoadTranslator("xlat/strife_base.txt");
|
P_LoadTranslator("xlat/strife_base.txt");
|
||||||
level.flags2 |= LEVEL2_DUMMYSWITCHES|LEVEL2_RAILINGHACK;
|
Level->flags2 |= LEVEL2_DUMMYSWITCHES|LEVEL2_RAILINGHACK;
|
||||||
floordrop = true;
|
floordrop = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2267,16 +2268,16 @@ public:
|
||||||
if (BadCoordinates) I_Error("Map has out of range coordinates");
|
if (BadCoordinates) I_Error("Map has out of range coordinates");
|
||||||
|
|
||||||
// Create the real vertices
|
// Create the real vertices
|
||||||
level.vertexes.Alloc(ParsedVertices.Size());
|
Level->vertexes.Alloc(ParsedVertices.Size());
|
||||||
memcpy(&level.vertexes[0], &ParsedVertices[0], level.vertexes.Size() * sizeof(vertex_t));
|
memcpy(&Level->vertexes[0], &ParsedVertices[0], Level->vertexes.Size() * sizeof(vertex_t));
|
||||||
|
|
||||||
// Create the real sectors
|
// Create the real sectors
|
||||||
level.sectors.Alloc(ParsedSectors.Size());
|
Level->sectors.Alloc(ParsedSectors.Size());
|
||||||
memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t));
|
memcpy(&Level->sectors[0], &ParsedSectors[0], Level->sectors.Size() * sizeof(sector_t));
|
||||||
level.sectors[0].e = new extsector_t[level.sectors.Size()];
|
Level->sectors[0].e = new extsector_t[Level->sectors.Size()];
|
||||||
for(unsigned i = 0; i < level.sectors.Size(); i++)
|
for(unsigned i = 0; i < Level->sectors.Size(); i++)
|
||||||
{
|
{
|
||||||
level.sectors[i].e = &level.sectors[0].e[i];
|
Level->sectors[i].e = &Level->sectors[0].e[i];
|
||||||
}
|
}
|
||||||
// Now create the scrollers.
|
// Now create the scrollers.
|
||||||
for (auto &scroll : UDMFScrollers)
|
for (auto &scroll : UDMFScrollers)
|
||||||
|
|
Loading…
Reference in a new issue