Skip to content

Commit

Permalink
Updated UDMF sector params and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Sep 15, 2023
1 parent c07017b commit 736b43f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 14 deletions.
34 changes: 24 additions & 10 deletions docs/specifications/UDMF EDGE Extensions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,29 @@ Note: All <bool> fields default to false unless mentioned otherwise.

sector
{
fadecolor = <integer>; // Fog color for this sector, in 0xRRGGBB format. Default (no fog) is 0x000000.
fogdensity = <integer>; // Fog density for this sector. EDGE makes an effort to map the GZDoom values recognized
// by map editors (0-510) in the following manner:
// - Values of 0-1 are equivalent to a 20% FOG_DENSITY in SECTORS.DDF
// - The remaining values (2-510) are roughly mapped to the 0-50% FOG_DENSITY scale in SECTORS.DDF;
// for example, a value of 5 would be roughly 1% while 510 would be 50%
// - EDGE additionally supports fogdensity values of 510-1020, which would be equivalent to the 50-100% SECTORS.DDF
// FOG_DENSITY scale, but map editors may clamp this value to 510. Switching editors, manually editing
// the map's TEXTMAP, or using a DDF sector fog special instead may be necessary in these cases.
xpanningfloor = <float>; // X texture offset of floor texture, Default = 0.0.
ypanningfloor = <float>; // Y texture offset of floor texture, Default = 0.0.
xpanningceiling = <float>; // X texture offset of ceiling texture, Default = 0.0.
ypanningceiling = <float>; // Y texture offset of ceiling texture, Default = 0.0.

xscalefloor = <float>; // X texture scale of floor texture, Default = 1.0.
yscalefloor = <float>; // Y texture scale of floor texture, Default = 1.0.
xscaleceiling = <float>; // X texture scale of ceiling texture, Default = 1.0.
yscaleceiling = <float>; // Y texture scale of ceiling texture, Default = 1.0.

gravity = <float>; // Sector's gravity. Default is 1.0.
// For EDGE, this is treated as a multiplier against the internal default gravity of 8.0,
// i.e. gravity = 0.5 would be equivalent to a gravity of 4.0

fadecolor = <integer>; // Fog color for this sector, in 0xRRGGBB format. Default (no fog) is 0x000000.
fogdensity = <integer>; // Fog density for this sector. EDGE makes an effort to map the GZDoom values recognized
// by map editors (0-510) in the following manner:
// - Values of 0-1 are equivalent to a 20% FOG_DENSITY in SECTORS.DDF
// - The remaining values (2-510) are roughly mapped to the 0-50% FOG_DENSITY scale in SECTORS.DDF;
// for example, a value of 5 would be roughly 1% while 510 would be 50%
// - EDGE additionally supports fogdensity values of 510-1020, which would be equivalent to the 50-100% SECTORS.DDF
// FOG_DENSITY scale, but map editors may clamp this value to 510. Switching editors, manually editing
// the map's TEXTMAP, or using a DDF sector fog special instead may be necessary in these cases.
}

thing
Expand All @@ -114,7 +128,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
=======================================
Changelog
=======================================
2023.09.14 - Updated sidedef section with granular scaling and offset parameters
2023.09.14 - Updated sidedef and sector sections
2023.08.25 - Updated fogdensity scaling documentation
2023.08.18 - Addition of fadecolor/fogdensity sector fields
2023.02.27 - Initial draft; addition of zfloor/zceiling vertex fields
Expand Down
41 changes: 37 additions & 4 deletions source_files/edge/p_setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,10 @@ static void LoadUDMFSectors()

if (section == "sector")
{
float cz = 0.0f, fz = 0.0f;
int cz = 0, fz = 0;
float fx = 0.0f, fy = 0.0f, cx = 0.0f, cy = 0.0f;
float fx_sc = 1.0f, fy_sc = 1.0f, cx_sc = 1.0f, cy_sc = 1.0f;
float gravfactor = 1.0f;
int light = 160, type = 0, tag = 0;
rgbcol_t fog_color = 0;
int fog_density = 0;
Expand Down Expand Up @@ -1509,9 +1512,9 @@ static void LoadUDMFSectors()
I_Error("Malformed TEXTMAP lump: missing ';'\n");

if (key == "heightfloor")
fz = epi::LEX_Double(value);
fz = epi::LEX_Int(value);
else if (key == "heightceiling")
cz = epi::LEX_Double(value);
cz = epi::LEX_Int(value);
else if (key == "texturefloor")
Z_StrNCpy(floor_tex, value.c_str(), 8);
else if (key == "textureceiling")
Expand All @@ -1526,6 +1529,24 @@ static void LoadUDMFSectors()
fog_color = epi::LEX_Int(value);
else if (key == "fogdensity")
fog_density = CLAMP(0, epi::LEX_Int(value), 1020);
else if (key == "xpanningfloor")
fx = epi::LEX_Double(value);
else if (key == "ypanningfloor")
fy = epi::LEX_Double(value);
else if (key == "xpanningceiling")
cx = epi::LEX_Double(value);
else if (key == "ypanningceiling")
cy = epi::LEX_Double(value);
else if (key == "xscalefloor")
fx_sc = epi::LEX_Double(value);
else if (key == "yscalefloor")
fy_sc = epi::LEX_Double(value);
else if (key == "xscaleceiling")
cx_sc = epi::LEX_Double(value);
else if (key == "yscaleceiling")
cy_sc = epi::LEX_Double(value);
else if (key == "gravity")
gravfactor = epi::LEX_Double(value);
}
sector_t *ss = sectors + cur_sector;
ss->f_h = fz;
Expand All @@ -1546,6 +1567,18 @@ static void LoadUDMFSectors()

ss->ceil = ss->floor;

// granular offsets
ss->floor.offset.x += fx;
ss->floor.offset.y += fy;
ss->ceil.offset.x += fx;
ss->ceil.offset.y += fy;

// granular scaling
ss->floor.x_mat.x = fx_sc;
ss->floor.y_mat.y = fy_sc;
ss->ceil.x_mat.x = cx_sc;
ss->ceil.y_mat.y = cy_sc;

ss->floor.image = W_ImageLookup(floor_tex, INS_Flat);

if (ss->floor.image)
Expand Down Expand Up @@ -1584,7 +1617,7 @@ static void LoadUDMFSectors()

ss->props.colourmap = NULL;

ss->props.gravity = GRAVITY;
ss->props.gravity = GRAVITY * gravfactor;
ss->props.friction = FRICTION;
ss->props.viscosity = VISCOSITY;
ss->props.drag = DRAG;
Expand Down

0 comments on commit 736b43f

Please sign in to comment.