- link the 3d floors to their sectors and mark the control sectors

This commit is contained in:
Magnus Norddahl 2018-10-31 02:33:04 +01:00
parent 2bdf48bbcc
commit 8bea68f6af
3 changed files with 47 additions and 1 deletions

View file

@ -108,6 +108,9 @@ struct IntSector
kexPlane ceilingplane; kexPlane ceilingplane;
kexPlane floorplane; kexPlane floorplane;
bool controlsector;
TArray<IntSector*> x3dfloors;
TArray<UDMFKey> props; TArray<UDMFKey> props;
}; };

View file

@ -229,10 +229,22 @@ void FProcessor::ParseLinedef(IntLineDef *ld)
{ {
ld->args[0] = CheckInt(key); ld->args[0] = CheckInt(key);
} }
else if (Extended && !stricmp(key, "id")) else if (Extended && !stricmp(key, "arg1"))
{ {
ld->args[1] = CheckInt(key); ld->args[1] = CheckInt(key);
} }
else if (Extended && !stricmp(key, "arg2"))
{
ld->args[2] = CheckInt(key);
}
else if (Extended && !stricmp(key, "arg3"))
{
ld->args[3] = CheckInt(key);
}
else if (Extended && !stricmp(key, "arg4"))
{
ld->args[4] = CheckInt(key);
}
else if (!stricmp(key, "blocking") && !stricmp(value, "true")) else if (!stricmp(key, "blocking") && !stricmp(value, "true"))
{ {
ld->flags |= ML_BLOCKING; ld->flags |= ML_BLOCKING;

View file

@ -52,6 +52,9 @@ static void Surface_AllocateFromSeg(FLevel &doomMap, MapSegGLEx *seg)
front = doomMap.GetFrontSector(seg); front = doomMap.GetFrontSector(seg);
back = doomMap.GetBackSector(seg); back = doomMap.GetBackSector(seg);
if (front->controlsector)
return;
FloatVertex v1 = doomMap.GetSegVertex(seg->v1); FloatVertex v1 = doomMap.GetSegVertex(seg->v1);
FloatVertex v2 = doomMap.GetSegVertex(seg->v2); FloatVertex v2 = doomMap.GetSegVertex(seg->v2);
float v1Top = front->ceilingplane.zAt(v1.x, v1.y); float v1Top = front->ceilingplane.zAt(v1.x, v1.y);
@ -221,6 +224,9 @@ static void Surface_AllocateFromLeaf(FLevel &doomMap)
return; return;
} }
if (sector->controlsector)
continue;
surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static); surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static);
surf->numVerts = doomMap.ssLeafCount[i]; surf->numVerts = doomMap.ssLeafCount[i];
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static); surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static);
@ -304,6 +310,31 @@ void Surface_AllocateFromMap(FLevel &doomMap)
doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static); doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
doomMap.segSurfaces[2] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static); doomMap.segSurfaces[2] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
for (unsigned int i = 0; i < doomMap.Sectors.Size(); i++)
doomMap.Sectors[i].controlsector = false;
for (unsigned int i = 0; i < doomMap.Lines.Size(); i++)
{
const auto &line = doomMap.Lines[i];
if (line.special == 160) // Sector_Set3dFloor
{
int sectorTag = line.args[0];
int type = line.args[1];
//int opacity = line.args[3];
IntSector *controlsector = &doomMap.Sectors[doomMap.Sides[doomMap.Lines[i].sidenum[0]].sector];
controlsector->controlsector = true;
for (unsigned int j = 0; j < doomMap.Sectors.Size(); j++)
{
if (doomMap.Sectors[j].data.tag == sectorTag)
{
doomMap.Sectors[j].x3dfloors.Push(controlsector);
}
}
}
}
printf("------------- Building seg surfaces -------------\n"); printf("------------- Building seg surfaces -------------\n");
for(int i = 0; i < doomMap.NumGLSegs; i++) for(int i = 0; i < doomMap.NumGLSegs; i++)