mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 20:41:25 +00:00
Added P_LoadReject function to properly check if REJECT lump is valid or not when loading it, so P_CheckSight can avoid accessing it if not.
This should mean that maps built with ZBSDP (no reject) should have less or no problems in netgames compared to the standard ZenNode maps now, hopefully. =)
This commit is contained in:
parent
df92dc8d9e
commit
a7a7a7ee6d
2 changed files with 32 additions and 4 deletions
|
@ -1977,6 +1977,31 @@ static void P_GroupLines(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_LoadReject
|
||||||
|
//
|
||||||
|
// Detect if the REJECT lump is valid,
|
||||||
|
// if not, rejectmatrix will be NULL
|
||||||
|
static void P_LoadReject(lumpnum_t lumpnum)
|
||||||
|
{
|
||||||
|
size_t count;
|
||||||
|
const char *lumpname = W_CheckNameForNum(lumpnum);
|
||||||
|
|
||||||
|
// Check if the lump exists, and if it's named "REJECT"
|
||||||
|
if (!lumpname || memcmp(lumpname, "REJECT", 8) != 0)
|
||||||
|
{
|
||||||
|
rejectmatrix = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = W_LumpLength(lumpnum);
|
||||||
|
|
||||||
|
if (!count) // zero length, someone probably used ZDBSP
|
||||||
|
rejectmatrix = NULL;
|
||||||
|
else
|
||||||
|
rejectmatrix = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static char *levellumps[] =
|
static char *levellumps[] =
|
||||||
{
|
{
|
||||||
|
@ -2585,7 +2610,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
|
P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
|
||||||
P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
|
P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
|
||||||
P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
|
P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
|
||||||
rejectmatrix = W_CacheLumpNum(lastloadedmaplumpnum + ML_REJECT, PU_LEVEL);
|
P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
|
||||||
P_GroupLines();
|
P_GroupLines();
|
||||||
|
|
||||||
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
numdmstarts = numredctfstarts = numbluectfstarts = 0;
|
||||||
|
|
|
@ -325,9 +325,12 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||||
s2 = t2->subsector->sector;
|
s2 = t2->subsector->sector;
|
||||||
pnum = (s1-sectors)*numsectors + (s2-sectors);
|
pnum = (s1-sectors)*numsectors + (s2-sectors);
|
||||||
|
|
||||||
|
if (rejectmatrix != NULL)
|
||||||
|
{
|
||||||
// Check in REJECT table.
|
// Check in REJECT table.
|
||||||
if (rejectmatrix[pnum>>3] & (1 << (pnum&7))) // can't possibly be connected
|
if (rejectmatrix[pnum>>3] & (1 << (pnum&7))) // can't possibly be connected
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// killough 11/98: shortcut for melee situations
|
// killough 11/98: shortcut for melee situations
|
||||||
// same subsector? obviously visible
|
// same subsector? obviously visible
|
||||||
|
|
Loading…
Reference in a new issue