Skip to content

Commit

Permalink
Merge pull request #567 from LoboEire/master
Browse files Browse the repository at this point in the history
LINES.DDF: STRETCH_TEX_WIDTH and STRETCH_TEX_HEIGHT LINE_EFFECTs
  • Loading branch information
dashodanger authored Sep 17, 2023
2 parents 93b5f8f + f62213c commit dff7900
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 12 deletions.
56 changes: 55 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,61 @@ New Features
- INDOOR_FOG_DENSITY = \<0-100%\>; Sets the fog density for all indoor sectors to the provided percentage
- OUTDOOR_FOG_COLOR = \<color\>; Sets the fog color for all outdoor sectors to the RGB value of the provided colormap entry
- OUTDOOR_FOG_DENSITY = \<0-100%\>; Sets the fog density for all outdoor sectors to the provided percentage
- COALHUDS: Added hud.rts_disable function; same syntax as hud.rts_enable
- COALHUDS: Added hud.rts_disable() function; same syntax as hud.rts_enable()
- LINES.DDF
- New LINE_EFFECT: STRETCH_TEX_WIDTH. Will stretch the width of a texture to match the lines length.
- New LINE_EFFECT: STRETCH_TEX_HEIGHT. Will stretch the height of a texture to match the lines length.
Basically allows autoscaling a texture to perfectly fit an arbitrary-length line.
- New Line types added:
[835] Breakable wall, (midtex to back lower): when this line is shot, the midtex will be swapped with back lower tex
[836] Breakable wall, (midtex to back upper): ...same as previous but swapped with back upper
[837] Breakable wall, (midtex to front lower): ...same as previous but swapped with front lower
[838] Breakable wall, (midtex to front upper): ...same as previous but swapped with front upper
[850] Light Wall: transfers the brightness of this wall to any other tagged lines
[855] Autoscale textures width to line length
[856] Autoscale textures height to line length
[857] Autoscale textures width and height to line length
- New Sector types added:
[4480] EDGE fog: White 5%
[4481] EDGE fog: White 10%
[4482] EDGE fog: White 15%
[4483] EDGE fog: White 20%
[4484] EDGE fog: White 25%
[4485] EDGE fog: White 30%
[4486] EDGE fog: White 35%
[4487] EDGE fog: White 40%
[4488] EDGE fog: White 45%
[4489] EDGE fog: White 50%
[4490] EDGE fog: Green 5%
[4491] EDGE fog: Green 10%
[4492] EDGE fog: Green 15%
[4493] EDGE fog: Green 20%
[4494] EDGE fog: Green 25%
[4495] EDGE fog: Green 30%
[4496] EDGE fog: Green 35%
[4497] EDGE fog: Green 40%
[4498] EDGE fog: Green 45%
[4499] EDGE fog: Green 50%
[4500] EDGE fog: Red 5%
[4501] EDGE fog: Red 10%
[4502] EDGE fog: Red 15%
[4503] EDGE fog: Red 20%
[4504] EDGE fog: Red 25%
[4505] EDGE fog: Red 30%
[4506] EDGE fog: Red 35%
[4507] EDGE fog: Red 40%
[4508] EDGE fog: Red 45%
[4509] EDGE fog: Red 50%
[4530] EDGE Friction: Slippy
[4531] EDGE Friction: Very Slippy
[4532] EDGE Friction: Sticky
[4533] EDGE Friction: Very Sticky
- New Thing types added:
[NUKAGE_GLOW_WALL:7070] : causes any wall in contact with it to glow green
[LAVA_GLOW_WALL:7071] : same as previous but glows red
[WATER_GLOW_WALL:7072] : same as previous but glows blue
[WHITE_GLOW_WALL:7073] : same as previous but glows white



General Improvements/Changes
Expand Down
24 changes: 24 additions & 0 deletions edge_defs/scripts/lines.ddf
Original file line number Diff line number Diff line change
Expand Up @@ -4447,6 +4447,30 @@ ACTIVATORS=PLAYER;
LINE_EFFECT=LIGHT_WALL;
LINE_PARTS=LEFT,RIGHT;

[855] // autoscale texture to line length: stretch width
TYPE=PUSH;
AUTO=TRUE;
ACTIVATORS=PLAYER;
LINE_EFFECT=STRETCH_TEX_WIDTH;
LINE_PARTS=LEFT,RIGHT;
// LEFT, LEFT_LOWER, LEFT_MIDDLE, LEFT_UPPER
// RIGHT, RIGHT_LOWER, RIGHT_MIDDLE, RIGHT_UPPER

[856] // autoscale texture to line length: stretch height
TYPE=PUSH;
AUTO=TRUE;
ACTIVATORS=PLAYER;
LINE_EFFECT=STRETCH_TEX_HEIGHT;
LINE_PARTS=LEFT,RIGHT;


[857] // autoscale texture to line length: stretch width and height
TYPE=PUSH;
AUTO=TRUE;
ACTIVATORS=PLAYER;
LINE_EFFECT=STRETCH_TEX_WIDTH,STRETCH_TEX_HEIGHT;
LINE_PARTS=LEFT,RIGHT;



[1024] // Scroll tagged walls by sidedef offsets (MBF21)
Expand Down
2 changes: 2 additions & 0 deletions source_files/ddf/line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ static specflags_t line_effect_names[] =
{"TAGGED_OFFSET_SCROLL", LINEFX_TaggedOffsetScroll, 0}, // MBF21
{"BLOCK_LAND_MONSTERS", LINEFX_BlockGroundedMonsters, 0}, // MBF21
{"BLOCK_PLAYERS", LINEFX_BlockPlayers, 0}, // MBF21
{"STRETCH_TEX_WIDTH", LINEFX_StretchWidth, 0}, //Lobo 2023
{"STRETCH_TEX_HEIGHT", LINEFX_StretchHeight, 0}, //Lobo 2023
{NULL, 0, 0}
};

Expand Down
3 changes: 3 additions & 0 deletions source_files/ddf/line.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ typedef enum

// block players (MBF21)
LINEFX_BlockPlayers = (1 << 12),

LINEFX_StretchWidth = (1 << 13), //stretch the texture horizontally to line length
LINEFX_StretchHeight = (1 << 14), //stretch the texture vertically to line length
}
line_effect_type_e;

Expand Down
45 changes: 34 additions & 11 deletions source_files/edge/p_spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void AdjustScaleParts(side_t *side, bool left,
}

static void AdjustStretchParts(side_t *side, bool left,
scroll_part_e parts, float linelength)
scroll_part_e parts, float linelength, bool widthOnly)
{
if (! side)
return;
Expand All @@ -427,24 +427,33 @@ static void AdjustStretchParts(side_t *side, bool left,
if(side->top.image)
factor = IM_WIDTH(side->top.image) / linelength;

side->top.x_mat.x *= factor;
side->top.y_mat.y *= factor;
if (widthOnly)
side->top.x_mat.x *= factor;

if (!widthOnly)
side->top.y_mat.y *= factor;
}
if (parts & (left ? SCPT_LeftMiddle : SCPT_RightMiddle))
{
if(side->middle.image)
factor = IM_WIDTH(side->middle.image) / linelength;

side->middle.x_mat.x *= factor;
side->middle.y_mat.y *= factor;
if (widthOnly)
side->middle.x_mat.x *= factor;

if (!widthOnly)
side->middle.y_mat.y *= factor;
}
if (parts & (left ? SCPT_LeftLower : SCPT_RightLower))
{
if(side->bottom.image)
factor = IM_WIDTH(side->bottom.image) / linelength;

side->bottom.x_mat.x *= factor;
side->bottom.y_mat.y *= factor;
if (widthOnly)
side->bottom.x_mat.x *= factor;

if (!widthOnly)
side->bottom.y_mat.y *= factor;
}
}

Expand Down Expand Up @@ -626,6 +635,7 @@ static void P_LineEffect(line_t *target, line_t *source,
const linetype_c *special)
{
float length = R_PointToDist(0, 0, source->dx, source->dy);
float factor = 64.0 / length;

if ((special->line_effect & LINEFX_Translucency) && (target->flags & MLF_TwoSided))
{
Expand Down Expand Up @@ -771,10 +781,8 @@ static void P_LineEffect(line_t *target, line_t *source,
// experimental: scale wall texture(s) by line length
if (special->line_effect & LINEFX_Scale)
{
//AdjustScaleParts(target->side[0], 0, special->line_parts, factor);
//AdjustScaleParts(target->side[1], 1, special->line_parts, factor);
AdjustStretchParts(target->side[0], 0, special->line_parts, length);
AdjustStretchParts(target->side[1], 1, special->line_parts, length);
AdjustScaleParts(target->side[0], 0, special->line_parts, factor);
AdjustScaleParts(target->side[1], 1, special->line_parts, factor);
}

// experimental: skew wall texture(s) by sidedef Y offset
Expand Down Expand Up @@ -807,6 +815,21 @@ static void P_LineEffect(line_t *target, line_t *source,
if(source->side[0]->top.image)
sky_image = W_ImageLookup(source->side[0]->top.image->name.c_str(), INS_Texture);
}

// experimental: stretch wall texture(s) by line length
if (special->line_effect & LINEFX_StretchWidth)
{
AdjustStretchParts(target->side[0], 0, special->line_parts, length, true);
AdjustStretchParts(target->side[1], 1, special->line_parts, length, true);
}

// experimental: stretch wall texture(s) by line length
if (special->line_effect & LINEFX_StretchHeight)
{
AdjustStretchParts(target->side[0], 0, special->line_parts, length, false);
AdjustStretchParts(target->side[1], 1, special->line_parts, length, false);
}

}

//
Expand Down

0 comments on commit dff7900

Please sign in to comment.