From fe8485cc2ffd6ca761e8423f08039ba5672bce29 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Sat, 17 Sep 2022 11:20:51 +0200
Subject: [PATCH] Add flag to set wind/current/push/pull strength using X
 offset

---
 extras/conf/SRB2-22.cfg | 19 +++++++++++++------
 src/p_setup.c           |  9 +++++----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg
index 0bf009f79b..6cd2f0d04f 100644
--- a/extras/conf/SRB2-22.cfg
+++ b/extras/conf/SRB2-22.cfg
@@ -3036,48 +3036,54 @@ linedeftypes
 		{
 			title = "Wind";
 			prefix = "(541)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use angle and X offset";
 		}
 
 		542
 		{
 			title = "Upwards Wind";
 			prefix = "(542)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use X offset";
 		}
 
 		543
 		{
 			title = "Downwards Wind";
 			prefix = "(543)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use X offset";
 		}
 
 		544
 		{
 			title = "Current";
 			prefix = "(544)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use angle and X offset";
 		}
 
 		545
 		{
 			title = "Upwards Current";
 			prefix = "(545)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use X offset";
 		}
 
 		546
 		{
 			title = "Downwards Current";
 			prefix = "(546)";
-			flags512text = "[9] Player slides";
 			flags64text = "[6] Exclusive";
+			flags512text = "[9] Player slides";
+			flags8192text = "[13] Use X offset";
 		}
 
 		547
@@ -3085,6 +3091,7 @@ linedeftypes
 			title = "Push/Pull";
 			prefix = "(547)";
 			flags64text = "[6] Exclusive";
+			flags8192text = "[13] Use X offset";
 		}
 	}
 
diff --git a/src/p_setup.c b/src/p_setup.c
index 9712528efe..acee2bb69f 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -5651,17 +5651,18 @@ static void P_ConvertBinaryLinedefTypes(void)
 		case 544: //Current
 		case 545: //Upwards current
 		case 546: //Downwards current
+			fixed_t speed = (lines[i].flags & ML_EFFECT6) ? sides[lines[i].sidenum[0]].textureoffset : R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y);
 			lines[i].args[0] = tag;
 			switch ((lines[i].special - 541) % 3)
 			{
 				case 0:
-					lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
+					lines[i].args[1] = speed >> FRACBITS;
 					break;
 				case 1:
-					lines[i].args[2] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
+					lines[i].args[2] = speed >> FRACBITS;
 					break;
 				case 2:
-					lines[i].args[2] = -R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
+					lines[i].args[2] = -speed >> FRACBITS;
 					break;
 			}
 			lines[i].args[3] = (lines[i].special >= 544) ? p_current : p_wind;
@@ -6308,7 +6309,7 @@ static void P_ConvertBinaryThingTypes(void)
 			}
 
 			mapthings[i].args[0] = mapthings[i].angle;
-			mapthings[i].args[1] = P_AproxDistance(line->dx >> FRACBITS, line->dy >> FRACBITS);
+			mapthings[i].args[1] = (line->flags & ML_EFFECT6) ? sides[line->sidenum[0]].textureoffset >> FRACBITS : P_AproxDistance(line->dx >> FRACBITS, line->dy >> FRACBITS);
 			if (mapthings[i].type == 755)
 				mapthings[i].args[1] *= -1;
 			if (mapthings[i].options & MTF_OBJECTSPECIAL)
-- 
GitLab