- moved the blockmap into a substructure of FLevelLocals.
This part can certainly improved a lot but the most important thing, grouping all those global variables into one place, is done.
This commit is contained in:
parent
f864a09faa
commit
33d36157c8
10 changed files with 189 additions and 174 deletions
|
|
@ -113,14 +113,16 @@ struct FPortalBits
|
|||
|
||||
static void BuildBlockmap()
|
||||
{
|
||||
auto bmapwidth = level.blockmap.bmapwidth;
|
||||
auto bmapheight = level.blockmap.bmapheight;
|
||||
|
||||
PortalBlockmap.Clear();
|
||||
PortalBlockmap.Create(bmapwidth, bmapheight);
|
||||
for (int y = 0; y < bmapheight; y++)
|
||||
{
|
||||
for (int x = 0; x < bmapwidth; x++)
|
||||
{
|
||||
int offset = y*bmapwidth + x;
|
||||
int *list = blockmaplump + *(blockmap + offset) + 1;
|
||||
int *list = level.blockmap.GetLines(x, y);
|
||||
FPortalBlock &block = PortalBlockmap(x, y);
|
||||
|
||||
while (*list != -1)
|
||||
|
|
@ -165,7 +167,7 @@ static void BuildBlockmap()
|
|||
|
||||
void FLinePortalTraverse::AddLineIntercepts(int bx, int by)
|
||||
{
|
||||
if (by < 0 || by >= bmapheight || bx < 0 || bx >= bmapwidth) return;
|
||||
if (by < 0 || by >= PortalBlockmap.dx || bx < 0 || bx >= PortalBlockmap.dy) return;
|
||||
|
||||
FPortalBlock &block = PortalBlockmap(bx, by);
|
||||
|
||||
|
|
@ -743,9 +745,9 @@ DVector2 P_GetOffsetPosition(double x, double y, double dx, double dy)
|
|||
// Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map.
|
||||
if (dx < 128 && dy < 128)
|
||||
{
|
||||
int blockx = GetBlockX(actx);
|
||||
int blocky = GetBlockY(acty);
|
||||
if (blockx < 0 || blocky < 0 || blockx >= bmapwidth || blocky >= bmapheight || !PortalBlockmap(blockx, blocky).neighborContainsLines) return dest;
|
||||
int blockx = level.blockmap.GetBlockX(actx);
|
||||
int blocky = level.blockmap.GetBlockY(acty);
|
||||
if (blockx < 0 || blocky < 0 || blockx >= PortalBlockmap.dx || blocky >= PortalBlockmap.dy || !PortalBlockmap(blockx, blocky).neighborContainsLines) return dest;
|
||||
}
|
||||
|
||||
bool repeat;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue