From 853b277781c9fe332e1e162d3815a6c16905dbbd Mon Sep 17 00:00:00 2001 From: Raccoon Date: Thu, 24 May 2018 00:56:59 -0500 Subject: [PATCH] Add SetAutomapFlags and SetAutomapStyle line specials (cherry picked from commit 475d3f0829869d6906a8fcead80aa214067c0c44) --- src/p_lnspec.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 001b39be8..24b17a96e 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2772,6 +2772,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) @@ -3720,6 +3768,8 @@ static lnSpecFunc LineSpecials[] = /* 278 */ LS_Sector_SetCeilingGlow, /* 279 */ LS_Floor_MoveToValueAndCrush, /* 280 */ LS_Ceiling_MoveToValueAndCrush, + /* 281 */ LS_Line_SetAutomapFlags, + /* 282 */ LS_Line_SetAutomapStyle, };