From 16936893058bab2a10c75e7026d87bdac9bd771d Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 2 May 2020 21:50:49 +0200 Subject: [PATCH] Implement "make FOF bustable" linedef type --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 39 ++++++++++++ src/p_spec.c | 67 ++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index cacff27e1..d1696df2e 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2008,6 +2008,45 @@ udmf enum = "yesno"; } } + + 264 + { + title = "Make FOF Bustable"; + prefix = "(264)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Bustable type"; + type = 11; + enum + { + 0 = "Touch"; + 1 = "Spin"; + 2 = "Regular"; + 3 = "Strong"; + } + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bustable by pushables"; + 2 = "Trigger linedef executor"; + 4 = "Only bustable from below"; + } + } + arg3 + { + title = "Linedef executor tag"; + type = 15; + } + } } linedefexecmisc diff --git a/src/p_spec.c b/src/p_spec.c index e17da83a8..2d8b1e48a 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7267,6 +7267,73 @@ void P_SpawnSpecials(boolean fromnetsave) } } + // And another round, this time with all FOFs already created + for (i = 0; i < numlines; i++) + { + switch (lines[i].special) + { + INT32 s; + INT32 l; + + case 264: // Make FOF bustable + { + UINT8 busttype = BT_REGULAR; + UINT8 bustflags = 0; + + if (!udmf) + break; + + switch (lines[i].args[1]) + { + case TMFB_TOUCH: + busttype = BT_TOUCH; + break; + case TMFB_SPIN: + busttype = BT_SPIN; + break; + case TMFB_REGULAR: + busttype = BT_REGULAR; + break; + case TMFB_STRONG: + busttype = BT_STRONG; + break; + } + + if (lines[i].args[2] & TMFB_PUSHABLES) + bustflags |= BF_PUSHABLES; + if (lines[i].args[2] & TMFB_EXECUTOR) + bustflags |= BF_EXECUTOR; + if (lines[i].args[2] & TMFB_ONLYBOTTOM) + bustflags |= BF_ONLYBOTTOM; + + for (l = -1; (l = P_FindLineFromTag(lines[i].args[0], l)) >= 0 ;) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + for (s = -1; (s = P_FindSectorFromTag(lines[l].args[0], s)) >= 0 ;) + { + ffloor_t *rover; + + for (rover = sectors[s].ffloors; rover; rover = rover->next) + { + if (rover->master != lines + l) + continue; + + rover->flags |= FF_BUSTUP; + rover->busttype = busttype; + rover->bustflags = bustflags; + rover->busttag = lines[i].args[3]; + CheckForBustableBlocks = true; + break; + } + } + } + break; + } + } + } + // Allocate each list for (i = 0; i < numsectors; i++) if(secthinkers[i].thinkers)