- Fixed misc bugs caused by the merger

This commit is contained in:
Magnus Norddahl 2018-10-27 00:03:23 +02:00
parent f9960ee12c
commit e84795cf99
4 changed files with 21 additions and 18 deletions

View file

@ -300,8 +300,7 @@ enum mapFlags_t
}; };
#define NO_SIDE_INDEX -1 #define NO_SIDE_INDEX -1
#define NO_LINE_INDEX 0xFFFF #define NO_LINE_INDEX 0xffffffff
#define NF_SUBSECTOR 0x8000
struct FLevel struct FLevel
{ {

View file

@ -874,7 +874,7 @@ void kexLightmapBuilder::CreateLightmaps(FLevel &doomMap)
Delay(1000); Delay(1000);
} }
printf("Texels traced: %i\n\n", tracedTexels); printf("Texels traced: %i \n\n", tracedTexels);
lightmapWorker.Destroy(); lightmapWorker.Destroy();
} }

View file

@ -51,7 +51,7 @@ void FLevel::SetupDlight()
} }
} }
*/ */
mapDef = &mapDefs[0]; //mapDef = &mapDefs[0];
BuildNodeBounds(); BuildNodeBounds();
BuildLeafs(); BuildLeafs();
@ -105,12 +105,12 @@ void FLevel::BuildLeafs()
IntSector *sector; IntSector *sector;
int count; int count;
leafs = (leaf_t*)Mem_Calloc(sizeof(leaf_t*) * Sectors.Size() * 2, hb_static); leafs = (leaf_t*)Mem_Calloc(sizeof(leaf_t*) * NumGLSegs * 2, hb_static);
numLeafs = NumGLSubsectors; numLeafs = NumGLSubsectors;
ss = GLSubsectors; ss = GLSubsectors;
segLeafLookup = (int*)Mem_Calloc(sizeof(int) * Sectors.Size(), hb_static); segLeafLookup = (int*)Mem_Calloc(sizeof(int) * NumGLSegs, hb_static);
ssLeafLookup = (int*)Mem_Calloc(sizeof(int) * NumGLSubsectors, hb_static); ssLeafLookup = (int*)Mem_Calloc(sizeof(int) * NumGLSubsectors, hb_static);
ssLeafCount = (int*)Mem_Calloc(sizeof(int) * NumGLSubsectors, hb_static); ssLeafCount = (int*)Mem_Calloc(sizeof(int) * NumGLSubsectors, hb_static);
ssLeafBounds = (kexBBox*)Mem_Calloc(sizeof(kexBBox) * NumGLSubsectors, hb_static); ssLeafBounds = (kexBBox*)Mem_Calloc(sizeof(kexBBox) * NumGLSubsectors, hb_static);
@ -167,9 +167,9 @@ void FLevel::CheckSkySectors()
bSkySectors = (bool*)Mem_Calloc(sizeof(bool) * Sectors.Size(), hb_static); bSkySectors = (bool*)Mem_Calloc(sizeof(bool) * Sectors.Size(), hb_static);
bSSectsVisibleToSky = (bool*)Mem_Calloc(sizeof(bool) * NumGLSubsectors, hb_static); bSSectsVisibleToSky = (bool*)Mem_Calloc(sizeof(bool) * NumGLSubsectors, hb_static);
for (int i = 0; i < NumGLSubsectors; ++i) for (int i = 0; i < (int)Sectors.Size(); ++i)
{ {
if (mapDef->sunIgnoreTag != 0 && Sectors[i].data.tag == mapDef->sunIgnoreTag) if (mapDef && mapDef->sunIgnoreTag != 0 && Sectors[i].data.tag == mapDef->sunIgnoreTag)
{ {
continue; continue;
} }
@ -177,7 +177,7 @@ void FLevel::CheckSkySectors()
strncpy(name, Sectors[i].data.ceilingpic, 8); strncpy(name, Sectors[i].data.ceilingpic, 8);
name[8] = 0; name[8] = 0;
if (!strncmp(name, "F_SKY001", 8)) if (!strncmp(name, "F_SKY001", 8) || !strncmp(name, "F_SKY1", 8) || !strncmp(name, "F_SKY", 8))
{ {
bSkySectors[i] = true; bSkySectors[i] = true;
} }
@ -303,12 +303,14 @@ MapSubsectorEx *FLevel::PointInSubSector(const int x, const int y)
nodenum = NumGLNodes - 1; nodenum = NumGLNodes - 1;
while (!(nodenum & NF_SUBSECTOR)) while (!(nodenum & NFX_SUBSECTOR))
{ {
node = &GLNodes[nodenum]; node = &GLNodes[nodenum];
kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0); kexVec3 pt1(F(node->x), F(node->y), 0);
kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0); kexVec3 pt2(F(node->dx), F(node->dy), 0);
//kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0);
//kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0);
kexVec3 pos(F(x << 16), F(y << 16), 0); kexVec3 pos(F(x << 16), F(y << 16), 0);
dp1 = pt1 - pos; dp1 = pt1 - pos;
@ -320,7 +322,7 @@ MapSubsectorEx *FLevel::PointInSubSector(const int x, const int y)
nodenum = node->children[side ^ 1]; nodenum = node->children[side ^ 1];
} }
return &GLSubsectors[nodenum & ~NF_SUBSECTOR]; return &GLSubsectors[nodenum & ~NFX_SUBSECTOR];
} }
bool FLevel::PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub) bool FLevel::PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub)

View file

@ -248,21 +248,23 @@ void kexTrace::TraceBSPNode(int num)
float d; float d;
byte side; byte side;
if(num & NF_SUBSECTOR) if(num & NFX_SUBSECTOR)
{ {
TraceSubSector(num & (~NF_SUBSECTOR)); TraceSubSector(num & (~NFX_SUBSECTOR));
return; return;
} }
if(!map->nodeBounds[num & (~NF_SUBSECTOR)].LineIntersect(start, end)) if(!map->nodeBounds[num & (~NFX_SUBSECTOR)].LineIntersect(start, end))
{ {
return; return;
} }
node = &map->GLNodes[num]; node = &map->GLNodes[num];
kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0); kexVec3 pt1(F(node->x), F(node->y), 0);
kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0); kexVec3 pt2(F(node->dx), F(node->dy), 0);
//kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0);
//kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0);
dp1 = pt1 - start; dp1 = pt1 - start;
dp2 = (pt2 + pt1) - start; dp2 = (pt2 + pt1) - start;