From 01b28b66a6d47c604457561e01dd33ac7693ec84 Mon Sep 17 00:00:00 2001
From: sphere <spherallic@gmail.com>
Date: Mon, 13 Apr 2020 17:10:25 +0200
Subject: [PATCH] Make linedef type 461 able to set object angle, using the
 line's angle.

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

diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg
index ec030b32f2..a59771b2d8 100644
--- a/extras/conf/SRB2-22.cfg
+++ b/extras/conf/SRB2-22.cfg
@@ -15,7 +15,7 @@
 	* Oogaland
 	* Rob
 	* Shadow Hog
-	* Spherallic
+	* sphere
 	* SRB2-Playah
 	* SSNTails
 	* SteelT
@@ -2214,6 +2214,7 @@ linedeftypes
 			title = "Spawn Object";
 			prefix = "(461)";
 			flags8text = "[3] Set delay by backside sector";
+			flags32text = "[5] Use line angle for object";
 			flags64text = "[6] Spawn inside a range";
 		}
 
diff --git a/src/p_spec.c b/src/p_spec.c
index 50b7675354..13280f3fe9 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -4027,7 +4027,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 
 				mobj = P_SpawnMobj(x, y, z, type);
 				if (mobj)
+				{
+					if (line->flags & ML_EFFECT1)
+						mobj->angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y);
 					CONS_Debug(DBG_GAMELOGIC, "Linedef Type %d - Spawn Object: %d spawned at (%d, %d, %d)\n", line->special, mobj->type, mobj->x>>FRACBITS, mobj->y>>FRACBITS, mobj->z>>FRACBITS); //TODO: Convert mobj->type to a string somehow.
+				}
 				else
 					CONS_Alert(CONS_ERROR,"Linedef Type %d - Spawn Object: Object did not spawn!\n", line->special);
 			}
-- 
GitLab