mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-10 14:51:40 +00:00
- Misc UDMF fixes
This commit is contained in:
parent
fde2a69ce6
commit
16ba8f8619
4 changed files with 72 additions and 5 deletions
|
@ -596,6 +596,11 @@ void FProcessor::BuildNodes()
|
||||||
|
|
||||||
void FProcessor::BuildLightmaps(const char *configFile)
|
void FProcessor::BuildLightmaps(const char *configFile)
|
||||||
{
|
{
|
||||||
|
LMBuilder.ambience = 0.0f;
|
||||||
|
LMBuilder.samples = 64;
|
||||||
|
LMBuilder.textureWidth = LIGHTMAP_MAX_SIZE;
|
||||||
|
LMBuilder.textureHeight = LIGHTMAP_MAX_SIZE;
|
||||||
|
|
||||||
Level.ParseConfigFile(configFile);
|
Level.ParseConfigFile(configFile);
|
||||||
Level.SetupDlight();
|
Level.SetupDlight();
|
||||||
Surface_AllocateFromMap(Level);
|
Surface_AllocateFromMap(Level);
|
||||||
|
|
|
@ -182,6 +182,7 @@ void FProcessor::ParseLinedef(IntLineDef *ld)
|
||||||
{
|
{
|
||||||
SC_MustGetStringName("{");
|
SC_MustGetStringName("{");
|
||||||
ld->v1 = ld->v2 = ld->sidenum[0] = ld->sidenum[1] = NO_INDEX;
|
ld->v1 = ld->v2 = ld->sidenum[0] = ld->sidenum[1] = NO_INDEX;
|
||||||
|
ld->flags = 0;
|
||||||
ld->special = 0;
|
ld->special = 0;
|
||||||
while (!SC_CheckString("}"))
|
while (!SC_CheckString("}"))
|
||||||
{
|
{
|
||||||
|
@ -206,6 +207,19 @@ void FProcessor::ParseLinedef(IntLineDef *ld)
|
||||||
{
|
{
|
||||||
ld->args[0] = CheckInt(key);
|
ld->args[0] = CheckInt(key);
|
||||||
}
|
}
|
||||||
|
else if (!stricmp(key, "blocking") && !stricmp(value, "true"))
|
||||||
|
{
|
||||||
|
ld->flags |= ML_BLOCKING;
|
||||||
|
}
|
||||||
|
else if (!stricmp(key, "blockmonsters") && !stricmp(value, "true"))
|
||||||
|
{
|
||||||
|
ld->flags |= ML_BLOCKMONSTERS;
|
||||||
|
}
|
||||||
|
else if (!stricmp(key, "twosided") && !stricmp(value, "true"))
|
||||||
|
{
|
||||||
|
ld->flags |= ML_TWOSIDED;
|
||||||
|
}
|
||||||
|
|
||||||
if (!stricmp(key, "sidefront"))
|
if (!stricmp(key, "sidefront"))
|
||||||
{
|
{
|
||||||
ld->sidenum[0] = CheckInt(key);
|
ld->sidenum[0] = CheckInt(key);
|
||||||
|
@ -256,16 +270,64 @@ void FProcessor::ParseSidedef(IntSideDef *sd)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
static void CopyUDMFString(char *dest, int destlen, const char *udmfvalue)
|
||||||
|
{
|
||||||
|
destlen--;
|
||||||
|
|
||||||
|
char endchar = 0;
|
||||||
|
if (udmfvalue[0] == '"' || udmfvalue[0] == '\'')
|
||||||
|
{
|
||||||
|
endchar = udmfvalue[0];
|
||||||
|
udmfvalue++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < destlen && udmfvalue[i] != 0 && udmfvalue[i] != endchar; i++)
|
||||||
|
{
|
||||||
|
*(dest++) = udmfvalue[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
*dest = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void FProcessor::ParseSector(IntSector *sec)
|
void FProcessor::ParseSector(IntSector *sec)
|
||||||
{
|
{
|
||||||
|
memset(&sec->data, 0, sizeof(sec->data));
|
||||||
|
sec->data.lightlevel = 160;
|
||||||
|
|
||||||
SC_MustGetStringName("{");
|
SC_MustGetStringName("{");
|
||||||
while (!SC_CheckString("}"))
|
while (!SC_CheckString("}"))
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
const char *key = ParseKey(value);
|
const char *key = ParseKey(value);
|
||||||
|
|
||||||
// No specific sector properties are ever used by the node builder
|
if (stricmp(key, "textureceiling") == 0)
|
||||||
// so everything can go directly to the props array.
|
{
|
||||||
|
CopyUDMFString(sec->data.ceilingpic, 8, value);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "texturefloor") == 0)
|
||||||
|
{
|
||||||
|
CopyUDMFString(sec->data.floorpic, 8, value);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "heightceiling") == 0)
|
||||||
|
{
|
||||||
|
sec->data.ceilingheight = CheckFloat(key);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "heightfloor") == 0)
|
||||||
|
{
|
||||||
|
sec->data.floorheight = CheckFloat(key);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "lightlevel") == 0)
|
||||||
|
{
|
||||||
|
sec->data.lightlevel = CheckInt(key);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "special") == 0)
|
||||||
|
{
|
||||||
|
sec->data.special = CheckInt(key);
|
||||||
|
}
|
||||||
|
else if (stricmp(key, "id") == 0)
|
||||||
|
{
|
||||||
|
sec->data.tag = CheckInt(key);
|
||||||
|
}
|
||||||
|
|
||||||
// now store the key in its unprocessed form
|
// now store the key in its unprocessed form
|
||||||
UDMFKey k = {key, value};
|
UDMFKey k = {key, value};
|
||||||
|
|
|
@ -902,8 +902,8 @@ void kexLightmapBuilder::CreateLightGrid()
|
||||||
// determine the size of the grid block
|
// determine the size of the grid block
|
||||||
for(int i = 0; i < 3; ++i)
|
for(int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
mins[i] = gridSize[i] * kexMath::Ceil(worldGrid.min[i] / gridSize[i]);
|
mins[i] = gridSize[i] * kexMath::Floor(worldGrid.min[i] / gridSize[i]);
|
||||||
maxs[i] = gridSize[i] * kexMath::Floor(worldGrid.max[i] / gridSize[i]);
|
maxs[i] = gridSize[i] * kexMath::Ceil(worldGrid.max[i] / gridSize[i]);
|
||||||
gridBlock[i] = (maxs[i] - mins[i]) / gridSize[i] + 1;
|
gridBlock[i] = (maxs[i] - mins[i]) / gridSize[i] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ IntSector *FLevel::GetBackSector(const MapSegGLEx *seg)
|
||||||
|
|
||||||
IntLineDef *line = &Lines[seg->linedef];
|
IntLineDef *line = &Lines[seg->linedef];
|
||||||
|
|
||||||
if (line->flags & ML_TWOSIDED)
|
if ((line->flags & ML_TWOSIDED) && line->sidenum[seg->side ^ 1] != 0xffffffff)
|
||||||
{
|
{
|
||||||
IntSideDef *backSide = &Sides[line->sidenum[seg->side ^ 1]];
|
IntSideDef *backSide = &Sides[line->sidenum[seg->side ^ 1]];
|
||||||
return &Sectors[backSide->sector];
|
return &Sectors[backSide->sector];
|
||||||
|
|
Loading…
Reference in a new issue