From 8ef8279764812a385fd1a4d18a69aa17f3ca71aa Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Wed, 22 Sep 2021 07:32:39 +0200 Subject: [PATCH] Adapt FOF-related linedef executors to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 164 +++++++++++++++++++ src/p_setup.c | 55 +++++++ src/p_spec.c | 109 ++++++------ src/p_spec.h | 26 +++ 4 files changed, 298 insertions(+), 56 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index a08c61463..9fbcc0a22 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -3332,6 +3332,22 @@ udmf } } + 436 + { + title = "Shatter FOF"; + prefix = "(436)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + } + 439 { title = "Change Tagged Linedef's Textures"; @@ -3396,6 +3412,60 @@ udmf } } + 445 + { + title = "Make FOF Disappear/Reappear"; + prefix = "(445)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Effect"; + type = 11; + enum + { + 0 = "Disappear"; + 1 = "Reappear"; + } + } + } + + 446 + { + title = "Make FOF Crumble"; + prefix = "(446)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Respawn?"; + type = 11; + enum + { + 0 = "Yes"; + 1 = "No"; + 2 = "Unless FF_NORETURN"; + 3 = "Only if FF_NORETURN"; + } + } + } + 447 { title = "Change Tagged Sector's Colormap"; @@ -3510,6 +3580,100 @@ udmf } } + 452 + { + title = "Set FOF Translucency"; + prefix = "(452)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Alpha"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current translucency"; + 2 = "Don't handle FF_TRANSLUCENT"; + } + } + } + + 453 + { + title = "Fade FOF"; + prefix = "(453)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Alpha"; + } + arg3 + { + title = "Fading speed"; + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current translucency"; + 2 = "Interrupt ongoing fades"; + 4 = "Speed is duration"; + 8 = "Don't change collision"; + 16 = "No collision during fade"; + 32 = "Don't handle FF_TRANSLUCENT"; + 64 = "Don't handle FF_EXISTS"; + 128 = "Don't fade lighting"; + 256 = "Don't fade colormap"; + 512 = "Use exact alpha in OpenGL"; + } + } + } + + 454 + { + title = "Stop Fading FOF"; + prefix = "(454)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Finalize collision?"; + type = 11; + enum = "yesno"; + } + } + 455 { title = "Fade Tagged Sector's Colormap"; diff --git a/src/p_setup.c b/src/p_setup.c index 155985a41..0e393d267 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3963,6 +3963,10 @@ static void P_ConvertBinaryMap(void) lines[i].args[0] = tag; lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; break; + case 436: //Shatter FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + break; case 437: //Disable player control lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); @@ -4011,6 +4015,19 @@ static void P_ConvertBinaryMap(void) lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; break; + case 445: //Make FOF disappear/reappear + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 446: //Make FOF crumble + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= TMFR_NORETURN; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] |= TMFR_CHECKFLAG; + break; case 447: //Change colormap lines[i].args[0] = tag; if (lines[i].flags & ML_EFFECT3) @@ -4052,6 +4069,44 @@ static void P_ConvertBinaryMap(void) lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; break; + case 452: //Set FOF translucency + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].textureoffset >> FRACBITS) : (P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS); + if (lines[i].flags & ML_EFFECT3) + lines[i].args[3] |= TMST_RELATIVE; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMST_DONTDOTRANSLUCENT; + break; + case 453: //Fade FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].textureoffset >> FRACBITS) : (lines[i].dx >> FRACBITS); + lines[i].args[3] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].rowoffset >> FRACBITS) : (abs(lines[i].dy) >> FRACBITS); + if (lines[i].flags & ML_EFFECT3) + lines[i].args[4] |= TMFT_RELATIVE; + if (lines[i].flags & ML_EFFECT5) + lines[i].args[4] |= TMFT_OVERRIDE; + if (lines[i].flags & ML_EFFECT4) + lines[i].args[4] |= TMFT_TICBASED; + if (lines[i].flags & ML_BOUNCY) + lines[i].args[4] |= TMFT_IGNORECOLLISION; + if (lines[i].flags & ML_EFFECT1) + lines[i].args[4] |= TMFT_GHOSTFADE; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= TMFT_DONTDOTRANSLUCENT; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[4] |= TMFT_DONTDOEXISTS; + if (lines[i].flags & ML_EFFECT2) + lines[i].args[4] |= (TMFT_DONTDOLIGHTING|TMFT_DONTDOCOLORMAP); + if (lines[i].flags & ML_TFERLINE) + lines[i].args[4] |= TMFT_USEEXACTALPHA; + break; + case 454: //Stop fading FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_BLOCKMONSTERS); + break; case 455: //Fade colormap { INT32 speed = (INT32)((((lines[i].flags & ML_DONTPEGBOTTOM) || !sides[lines[i].sidenum[0]].rowoffset) && lines[i].sidenum[1] != 0xFFFF) ? diff --git a/src/p_spec.c b/src/p_spec.c index bf6e05b7f..812577ed5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2765,8 +2765,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 436: // Shatter block remotely { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to crumble boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -2950,10 +2950,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; } - case 445: // Force block disappear remotely (reappear if noclimb) + case 445: // Force block disappear remotely (reappear if args[2] is set) { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible (or not visible) in ffloor_t *rover; // FOF to vanish/un-vanish boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -2978,7 +2978,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) oldflags = rover->flags; // Abracadabra! - if (line->flags & ML_NOCLIMB) + if (line->args[2]) rover->flags |= FF_EXISTS; else rover->flags &= ~FF_EXISTS; @@ -3003,8 +3003,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 446: // Make block fall remotely (acts like FF_CRUMBLE) { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to make fall down boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3014,7 +3014,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (mo) // NULL check player = mo->player; - if (line->flags & ML_NOCLIMB) // don't respawn! + if (line->args[2] & TMFR_NORETURN) // don't respawn! respawn = false; TAG_ITER_SECTORS(sectag, secnum) @@ -3033,8 +3033,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { foundrover = true; - if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead? - respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts + if (line->args[2] & TMFR_CHECKFLAG) // FOF flags determine respawn ability instead? + respawn = !(rover->flags & FF_NORETURN) ^ !!(line->args[2] & TMFR_NORETURN); // TMFR_NORETURN inverts EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn); } @@ -3191,10 +3191,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 452: // Set FOF alpha { - INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS); - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 destvalue = (INT16)(line->args[2]); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3218,7 +3217,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // If fading an invisible FOF whose render flags we did not yet set, // initialize its alpha to 1 // for relative alpha calc - if (!(line->flags & ML_NOCLIMB) && // do translucent + if (!(line->args[3] & TMST_DONTDOTRANSLUCENT) && // do translucent (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE !(rover->spawnflags & FF_RENDERSIDES) && !(rover->spawnflags & FF_RENDERPLANES) && @@ -3228,16 +3227,16 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_RemoveFakeFloorFader(rover); P_FadeFakeFloor(rover, rover->alpha, - max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), - 0, // set alpha immediately - false, NULL, // tic-based logic - false, // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // handle FF_TRANSLUCENT - false, // do not handle lighting - false, // do not handle colormap - false, // do not handle collision - false, // do not do ghost fade (no collision during fade) - true); // use exact alpha values (for opengl) + max(1, min(256, (line->args[3] & TMST_RELATIVE) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + false, // do not handle FF_EXISTS + !(line->args[3] & TMST_DONTDOTRANSLUCENT), // handle FF_TRANSLUCENT + false, // do not handle lighting + false, // do not handle colormap + false, // do not handle collision + false, // do not do ghost fade (no collision during fade) + true); // use exact alpha values (for opengl) } } @@ -3252,12 +3251,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 453: // Fade FOF { - INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(line->dx>>FRACBITS); - INT16 speed = line->sidenum[1] != 0xffff ? - (INT16)(abs(sides[line->sidenum[1]].rowoffset>>FRACBITS)) : (INT16)(abs(line->dy)>>FRACBITS); - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 destvalue = (INT16)(line->args[2]); + INT16 speed = (INT16)(line->args[3]); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3280,7 +3277,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) foundrover = true; // Prevent continuous execs from interfering on an existing fade - if (!(line->flags & ML_EFFECT5) + if (!(line->args[4] & TMFT_OVERRIDE) && rover->fadingdata) //&& ((fade_t*)rover->fadingdata)->timer > (ticbased ? 2 : speed*2)) { @@ -3292,21 +3289,21 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_AddFakeFloorFader(rover, secnum, j, destvalue, speed, - (line->flags & ML_EFFECT4), // tic-based logic - (line->flags & ML_EFFECT3), // Relative destvalue - !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT - !(line->flags & ML_EFFECT2), // do not handle lighting - !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) - !(line->flags & ML_BOUNCY), // do not handle collision - (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) - (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + (line->args[4] & TMFT_TICBASED), // tic-based logic + (line->args[4] & TMFT_RELATIVE), // Relative destvalue + !(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FF_EXISTS + !(line->args[4] & TMFT_DONTDOTRANSLUCENT), // do not handle FF_TRANSLUCENT + !(line->args[4] & TMFT_DONTDOLIGHTING), // do not handle lighting + !(line->args[4] & TMFT_DONTDOCOLORMAP), // do not handle colormap + !(line->args[4] & TMFT_IGNORECOLLISION), // do not handle collision + (line->args[4] & TMFT_GHOSTFADE), // do ghost fade (no collision during fade) + (line->args[4] & TMFT_USEEXACTALPHA)); // use exact alpha values (for opengl) else { // If fading an invisible FOF whose render flags we did not yet set, // initialize its alpha to 1 // for relative alpha calc - if (!(line->flags & ML_NOCLIMB) && // do translucent + if (!(line->args[4] & TMFT_DONTDOTRANSLUCENT) && // do translucent (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE !(rover->spawnflags & FF_RENDERSIDES) && !(rover->spawnflags & FF_RENDERPLANES) && @@ -3316,16 +3313,16 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_RemoveFakeFloorFader(rover); P_FadeFakeFloor(rover, rover->alpha, - max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), - 0, // set alpha immediately - false, NULL, // tic-based logic - !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT - !(line->flags & ML_EFFECT2), // do not handle lighting - !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) - !(line->flags & ML_BOUNCY), // do not handle collision - (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) - (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + max(1, min(256, (line->args[4] & TMFT_RELATIVE) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + !(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FF_EXISTS + !(line->args[4] & TMFT_DONTDOTRANSLUCENT), // do not handle FF_TRANSLUCENT + !(line->args[4] & TMFT_DONTDOLIGHTING), // do not handle lighting + !(line->args[4] & TMFT_DONTDOCOLORMAP), // do not handle colormap + !(line->args[4] & TMFT_IGNORECOLLISION), // do not handle collision + (line->args[4] & TMFT_GHOSTFADE), // do ghost fade (no collision during fade) + (line->args[4] & TMFT_USEEXACTALPHA)); // use exact alpha values (for opengl) } } j++; @@ -3342,8 +3339,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 454: // Stop fading FOF { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3365,7 +3362,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) foundrover = true; P_ResetFakeFloorFader(rover, NULL, - !(line->flags & ML_BLOCKMONSTERS)); // do not finalize collision flags + !(line->args[2])); // do not finalize collision flags } } diff --git a/src/p_spec.h b/src/p_spec.h index c5c1c6162..b8fbc3734 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -169,6 +169,32 @@ typedef enum TMB_SYNC = 1<<1, } textmapblinkinglightflags_t; +typedef enum +{ + TMFR_NORETURN = 1, + TMFR_CHECKFLAG = 1<<1, +} textmapfofrespawnflags_t; + +typedef enum +{ + TMST_RELATIVE = 1, + TMST_DONTDOTRANSLUCENT = 1<<1, +} textmapsettranslucencyflags_t; + +typedef enum +{ + TMFT_RELATIVE = 1, + TMFT_OVERRIDE = 1<<1, + TMFT_TICBASED = 1<<2, + TMFT_IGNORECOLLISION = 1<<3, + TMFT_GHOSTFADE = 1<<4, + TMFT_DONTDOTRANSLUCENT = 1<<5, + TMFT_DONTDOEXISTS = 1<<6, + TMFT_DONTDOLIGHTING = 1<<7, + TMFT_DONTDOCOLORMAP = 1<<8, + TMFT_USEEXACTALPHA = 1<<9, +} textmapfadetranslucencyflags_t; + typedef enum { TMS_VIEWPOINT = 0,