mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Added support for BLOCKLANDMONSTERS in Line_SetBlocking.
This PR was written by MrRaveYard
This commit is contained in:
parent
502c9fef5c
commit
69b9f107f0
2 changed files with 38 additions and 30 deletions
|
@ -2736,40 +2736,47 @@ FUNC(LS_Line_SetTextureScale)
|
|||
FUNC(LS_Line_SetBlocking)
|
||||
// Line_SetBlocking (id, setflags, clearflags)
|
||||
{
|
||||
static const int flagtrans[] =
|
||||
{
|
||||
ML_BLOCKING,
|
||||
ML_BLOCKMONSTERS,
|
||||
ML_BLOCK_PLAYERS,
|
||||
ML_BLOCK_FLOATERS,
|
||||
ML_BLOCKPROJECTILE,
|
||||
ML_BLOCKEVERYTHING,
|
||||
ML_RAILING,
|
||||
ML_BLOCKUSE,
|
||||
ML_BLOCKSIGHT,
|
||||
ML_BLOCKHITSCAN,
|
||||
ML_SOUNDBLOCK,
|
||||
-1
|
||||
};
|
||||
struct FlagTransEntry
|
||||
{
|
||||
int fieldIndex, bitmask;
|
||||
};
|
||||
|
||||
if (arg0 == 0) return false;
|
||||
static const FlagTransEntry flagtrans[] =
|
||||
{
|
||||
{0, ML_BLOCKING},
|
||||
{0, ML_BLOCKMONSTERS},
|
||||
{0, ML_BLOCK_PLAYERS},
|
||||
{0, ML_BLOCK_FLOATERS},
|
||||
{0, ML_BLOCKPROJECTILE},
|
||||
{0, ML_BLOCKEVERYTHING},
|
||||
{0, ML_RAILING},
|
||||
{0, ML_BLOCKUSE},
|
||||
{0, ML_BLOCKSIGHT},
|
||||
{0, ML_BLOCKHITSCAN},
|
||||
{0, ML_SOUNDBLOCK},
|
||||
{1, ML2_BLOCKLANDMONSTERS},
|
||||
{-1, -1},
|
||||
};
|
||||
|
||||
int setflags = 0;
|
||||
int clearflags = 0;
|
||||
if (arg0 == 0) return false;
|
||||
|
||||
for(int i = 0; flagtrans[i] != -1; i++, arg1 >>= 1, arg2 >>= 1)
|
||||
{
|
||||
if (arg1 & 1) setflags |= flagtrans[i];
|
||||
if (arg2 & 1) clearflags |= flagtrans[i];
|
||||
}
|
||||
int setflags[2] = {};
|
||||
int clearflags[2] = {};
|
||||
|
||||
auto itr = Level->GetLineIdIterator(arg0);
|
||||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
Level->lines[line].flags = (Level->lines[line].flags & ~clearflags) | setflags;
|
||||
}
|
||||
return true;
|
||||
for (int i = 0; flagtrans[i].bitmask != -1; i++, arg1 >>= 1, arg2 >>= 1)
|
||||
{
|
||||
if (arg1 & 1) setflags[flagtrans[i].fieldIndex] |= flagtrans[i].bitmask;
|
||||
if (arg2 & 1) clearflags[flagtrans[i].fieldIndex] |= flagtrans[i].bitmask;
|
||||
}
|
||||
|
||||
auto itr = Level->GetLineIdIterator(arg0);
|
||||
int line;
|
||||
while ((line = itr.Next()) >= 0)
|
||||
{
|
||||
Level->lines[line].flags = (Level->lines[line].flags & ~clearflags[0]) | setflags[0];
|
||||
Level->lines[line].flags2 = (Level->lines[line].flags2 & ~clearflags[1]) | setflags[1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FUNC(LS_Line_SetAutomapFlags)
|
||||
|
|
|
@ -451,6 +451,7 @@ enum EBlockFlags
|
|||
BLOCKF_SIGHT = 256,
|
||||
BLOCKF_HITSCAN = 512,
|
||||
BLOCKF_SOUND = 1024,
|
||||
BLOCKF_LANDMONSTERS = 2048,
|
||||
};
|
||||
|
||||
// Pointer constants, bitfield-enabled
|
||||
|
|
Loading…
Reference in a new issue