From 475d3f0829869d6906a8fcead80aa214067c0c44 Mon Sep 17 00:00:00 2001 From: Raccoon Date: Thu, 24 May 2018 00:56:59 -0500 Subject: [PATCH] Adds line specials --- src/p_lnspec.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index acf99d5d1..9e2ef889e 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2765,6 +2765,54 @@ FUNC(LS_Line_SetBlocking) return true; } +FUNC(LS_Line_SetAutomapFlags) +// Line_SetAutomapFlags (id, setflags, clearflags) +{ + static const int flagtrans[] = + { + ML_SECRET, + ML_DONTDRAW, + ML_MAPPED, + ML_REVEALED, + -1 + }; + + if (arg0 == 0) return false; + + int setflags = 0; + int clearflags = 0; + + for (int i = 0; flagtrans[i] != ML_PORTALCONNECT; i++, arg1 >>= 1, arg2 >>= 1) + { + if (arg1 & 1) setflags |= flagtrans[i]; + if (arg2 & 1) clearflags |= flagtrans[i]; + } + + FLineIdIterator itr(arg0); + int line; + while ((line = itr.Next()) >= 0) + { + level.lines[line].flags = (level.lines[line].flags & ~clearflags) | setflags; + } + + return true; +} + +FUNC(LS_Line_SetAutomapStyle) +// Line_SetAutomapStyle (id, setflags, clearflags) +{ + if (arg1 < AMLS_COUNT && arg1 >= 0) { + FLineIdIterator itr(arg0); + int line; + while ((line = itr.Next()) >= 0) + { + level.lines[line].automapstyle = (AutomapLineStyle) arg1; + } + + return true; + } + return false; +} FUNC(LS_ChangeCamera) @@ -3713,6 +3761,8 @@ static lnSpecFunc LineSpecials[] = /* 278 */ LS_Sector_SetCeilingGlow, /* 279 */ LS_Floor_MoveToValueAndCrush, /* 280 */ LS_Ceiling_MoveToValueAndCrush, + /* 281 */ LS_Line_SetAutomapFlags, + /* 282 */ LS_Line_SetAutomapStyle, };