From cbe952efea026e677c878fc19dcffc5db3e3e2a3 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Fri, 14 Jan 2022 17:16:36 +0100
Subject: [PATCH] Add toggle for action 439 to use backside textures.

---
 extras/conf/SRB2-22.cfg | 1 +
 src/p_spec.c            | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg
index b780ff75f0..7b325b6287 100644
--- a/extras/conf/SRB2-22.cfg
+++ b/extras/conf/SRB2-22.cfg
@@ -2417,6 +2417,7 @@ linedeftypes
 			prefix = "(439)";
 			flags8text = "[3] Set delay by backside sector";
 			flags64text = "[6] Only existing";
+			flags8192text = "[13] Use backside textures";
 		}
 
 		440
diff --git a/src/p_spec.c b/src/p_spec.c
index ebabe6a798..ade4339b9d 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -2093,7 +2093,7 @@ void P_SwitchWeather(INT32 weathernum)
 	{
 		case PRECIP_SNOW: // snow
 			curWeather = PRECIP_SNOW;
-			
+
 			if (purge)
 				P_SpawnPrecipitation();
 
@@ -2997,6 +2997,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 				size_t linenum;
 				side_t *set = &sides[line->sidenum[0]], *this;
 				boolean always = !(line->flags & ML_NOCLIMB); // If noclimb: Only change mid texture if mid texture already exists on tagged lines, etc.
+				boolean backside = line->flags & ML_EFFECT6 && line->sidenum[1] != 0xffff; // If Effect 6 is set, use backside textures if provided
 
 				for (linenum = 0; linenum < numlines; linenum++)
 				{
@@ -3015,6 +3016,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 					if (lines[linenum].sidenum[1] == 0xffff)
 						continue; // One-sided stops here.
 
+					if (backside)
+						set = &sides[line->sidenum[1]];
+
 					// Back side
 					this = &sides[lines[linenum].sidenum[1]];
 					if (always || this->toptexture) this->toptexture = set->toptexture;
-- 
GitLab