- Added sector type translation to xlat_parser and removed the old sectorx
lump. SVN r841 (trunk)
This commit is contained in:
parent
9c1fa19dd2
commit
a665663c15
14 changed files with 915 additions and 699 deletions
140
src/p_xlat.cpp
140
src/p_xlat.cpp
|
|
@ -326,123 +326,9 @@ void P_TranslateTeleportThings ()
|
|||
}
|
||||
}
|
||||
|
||||
static short sectortables[2][256];
|
||||
static int boommask=0, boomshift=0;
|
||||
static bool secparsed;
|
||||
|
||||
void P_ReadSectorSpecials()
|
||||
{
|
||||
secparsed=true;
|
||||
for(int i=0;i<256;i++)
|
||||
{
|
||||
sectortables[0][i]=-1;
|
||||
sectortables[1][i]=i;
|
||||
}
|
||||
|
||||
int lastlump=0, lump;
|
||||
|
||||
lastlump = 0;
|
||||
while ((lump = Wads.FindLump ("SECTORX", &lastlump)) != -1)
|
||||
{
|
||||
FScanner sc(lump, "SECTORX");
|
||||
sc.SetCMode(true);
|
||||
while (sc.GetString())
|
||||
{
|
||||
if (sc.Compare("IFDOOM"))
|
||||
{
|
||||
sc.MustGetStringName("{");
|
||||
if (gameinfo.gametype != GAME_Doom)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!sc.GetString())
|
||||
{
|
||||
sc.ScriptError("Unexpected end of file");
|
||||
}
|
||||
}
|
||||
while (!sc.Compare("}"));
|
||||
}
|
||||
}
|
||||
else if (sc.Compare("IFHERETIC"))
|
||||
{
|
||||
sc.MustGetStringName("{");
|
||||
if (gameinfo.gametype != GAME_Heretic)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!sc.GetString())
|
||||
{
|
||||
sc.ScriptError("Unexpected end of file");
|
||||
}
|
||||
}
|
||||
while (!sc.Compare("}"));
|
||||
}
|
||||
}
|
||||
else if (sc.Compare("IFSTRIFE"))
|
||||
{
|
||||
sc.MustGetStringName("{");
|
||||
if (gameinfo.gametype != GAME_Strife)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!sc.GetString())
|
||||
{
|
||||
sc.ScriptError("Unexpected end of file");
|
||||
}
|
||||
}
|
||||
while (!sc.Compare("}"));
|
||||
}
|
||||
}
|
||||
else if (sc.Compare("}"))
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else if (sc.Compare("BOOMMASK"))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
boommask = sc.Number;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
boomshift = sc.Number;
|
||||
}
|
||||
else if (sc.Compare("["))
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
|
||||
sc.MustGetNumber();
|
||||
start = sc.Number;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
end = sc.Number;
|
||||
sc.MustGetStringName("]");
|
||||
sc.MustGetStringName(":");
|
||||
sc.MustGetNumber();
|
||||
for(int j = start; j <= end; j++)
|
||||
{
|
||||
sectortables[!!boommask][j]=sc.Number + j - start;
|
||||
}
|
||||
}
|
||||
else if (IsNum(sc.String))
|
||||
{
|
||||
int start;
|
||||
|
||||
start = atoi(sc.String);
|
||||
sc.MustGetStringName(":");
|
||||
sc.MustGetNumber();
|
||||
sectortables[!!boommask][start] = sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int P_TranslateSectorSpecial (int special)
|
||||
{
|
||||
int high;
|
||||
int mask = 0;
|
||||
|
||||
// Allow any supported sector special by or-ing 0x8000 to it in Doom format maps
|
||||
// That's for those who like to mess around with existing maps. ;)
|
||||
|
|
@ -450,16 +336,24 @@ int P_TranslateSectorSpecial (int special)
|
|||
{
|
||||
return special & 0x7fff;
|
||||
}
|
||||
|
||||
if (!secparsed) P_ReadSectorSpecials();
|
||||
|
||||
if (special>=0 && special<=255)
|
||||
|
||||
for(unsigned i = 0; i < SectorMasks.Size(); i++)
|
||||
{
|
||||
if (sectortables[0][special]>=0) return sectortables[0][special];
|
||||
int newmask = special & SectorMasks[i].mask;
|
||||
if (newmask)
|
||||
{
|
||||
special &= ~newmask;
|
||||
if (SectorMasks[i].op == 1) newmask <<= SectorMasks[i].shift;
|
||||
else if (SectorMasks[i].op == -1) newmask >>= SectorMasks[i].shift;
|
||||
mask |= newmask;
|
||||
}
|
||||
}
|
||||
high = (special & boommask) << boomshift;
|
||||
special &= (~boommask) & 255;
|
||||
|
||||
return sectortables[1][special] | high;
|
||||
if (special>=0 && special<SectorTranslations.Size())
|
||||
{
|
||||
if (SectorTranslations[special].bitmask_allowed && mask) special = 0;
|
||||
else special = SectorTranslations[special].newtype;
|
||||
}
|
||||
return special | mask;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue