From 81b1526c2c12edece253bc44f2fa3d5a25f5d2d6 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Sun, 9 Oct 2022 18:53:34 +0200
Subject: [PATCH] Check the correct backside for textures, then go back to
 front textures.

---
 src/p_spec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/p_spec.c b/src/p_spec.c
index e8b0bcc877..cc2a2d2532 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -2906,8 +2906,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 						if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
 					}
 
-					if (line->args[3] && lines[linenum].sidenum[1] != 0xffff)
-						set = &sides[line->sidenum[1]]; // Use back side textures
+					if (line->args[3] && line->sidenum[1] != 0xffff)
+						set = &sides[line->sidenum[1]]; // Use back side textures for target's back side
 
 					// Back side
 					if (line->args[1] != TMSD_FRONT && lines[linenum].sidenum[1] != 0xffff)
@@ -2917,6 +2917,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 						if (always || this->midtexture) this->midtexture = set->midtexture;
 						if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
 					}
+
+					set = &sides[line->sidenum[0]]; // Go back to front side textures
 				}
 			}
 			break;
-- 
GitLab