From c43d5c7183479fce9496e5d1d04f4cbaac617218 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Thu, 9 Dec 2021 19:49:17 +0100 Subject: [PATCH] Adapt linedef types 334-336 to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 38 ++++++++++++++++++++ src/p_setup.c | 23 ++++++++++-- src/p_spec.c | 30 +++++----------- 3 files changed, 66 insertions(+), 25 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index eef89d144..f5fb423f3 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -739,6 +739,21 @@ doom title = "Player Skin - Once"; prefix = "(333)"; } + 334 + { + title = "Object Dye - Continuous"; + prefix = "(334)"; + } + 335 + { + title = "Object Dye - Each Time"; + prefix = "(335)"; + } + 336 + { + title = "Object Dye - Once"; + prefix = "(336)"; + } 399 { title = "Level Load"; @@ -3025,6 +3040,29 @@ udmf } } + 334 + { + title = "Object Dye"; + prefix = "(334)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Invert choice?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Color"; + type = 2; + } + } + 399 { title = "Level Load"; diff --git a/src/p_setup.c b/src/p_setup.c index abdc643c5..95e3c487b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1302,9 +1302,6 @@ static void P_LoadSidedefs(UINT8 *data) case 9: // Mace parameters case 14: // Bustable block parameters case 15: // Fan particle spawner parameters - case 334: // Trigger linedef executor: Object dye - Continuous - case 335: // Trigger linedef executor: Object dye - Each time - case 336: // Trigger linedef executor: Object dye - Once { char process[8*3+1]; memset(process,0,8*3+1); @@ -1324,6 +1321,9 @@ static void P_LoadSidedefs(UINT8 *data) case 331: // Trigger linedef executor: Skin - Continuous case 332: // Trigger linedef executor: Skin - Each time case 333: // Trigger linedef executor: Skin - Once + case 334: // Trigger linedef executor: Object dye - Continuous + case 335: // Trigger linedef executor: Object dye - Each time + case 336: // Trigger linedef executor: Object dye - Once case 425: // Calls P_SetMobjState on calling mobj case 434: // Custom Power case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors @@ -3898,6 +3898,23 @@ static void P_ConvertBinaryMap(void) } lines[i].special = 331; break; + case 334: // Object dye - continuous + case 335: // Object dye - each time + case 336: // Object dye - once + if (lines[i].special == 336) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 335) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + lines[i].special = 334; + break; case 400: //Set tagged sector's floor height/texture case 401: //Set tagged sector's ceiling height/texture lines[i].args[0] = tag; diff --git a/src/p_spec.c b/src/p_spec.c index 94a4cc7da..f5982e6f2 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1814,15 +1814,12 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!(stricmp(triggerline->stringargs[0], skins[actor->player->skin].name) == 0) ^ !!(triggerline->args[1])) return false; break; - case 334: // object dye - continuous - case 335: // object dye - each time - case 336: // object dye - once + case 334: // object dye { - INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture; + INT32 triggercolor = triggerline->stringargs[0] ? get_number(triggerline->stringargs[0]) : SKINCOLOR_NONE; UINT16 color = (actor->player ? actor->player->powers[pw_dye] : actor->color); - boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false); - if (invert ^ (triggercolor != color)) + if (!!(triggerline->args[1]) ^ (triggercolor != color)) return false; } default: @@ -1855,8 +1852,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || (specialtype == 325 && triggerline->args[0]) // DeNightserize - Once || (specialtype == 327 && triggerline->args[0]) // Nights lap - Once || (specialtype == 329 && triggerline->args[0]) // Nights Bonus Time - Once - || (specialtype == 333 && triggerline->args[0] == TMT_ONCE) // Player skin - || specialtype == 336 // Dye - Once + || (specialtype == 331 && triggerline->args[0] == TMT_ONCE) // Player skin + || (specialtype == 334 && triggerline->args[0] == TMT_ONCE) // Object dye || specialtype == 399) // Level Load triggerline->special = 0; // Clear it out @@ -1903,16 +1900,14 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) || lines[masterline].special == 314 // Number of pushables || lines[masterline].special == 317 // Condition set trigger || lines[masterline].special == 319 // Unlockable trigger - || lines[masterline].special == 331) // Player skin + || lines[masterline].special == 331 // Player skin + || lines[masterline].special == 334) // Object dye && lines[masterline].args[0] > TMT_EACHTIMEMASK) continue; if (lines[masterline].special == 321 && lines[masterline].args[0] > TMXT_EACHTIMEMASK) // Trigger after X calls continue; - if (lines[masterline].special == 335) // Dye - continue; - if (!P_RunTriggerLinedef(&lines[masterline], actor, caller)) return; // cancel P_LinedefExecute if function returns false } @@ -6692,6 +6687,7 @@ void P_SpawnSpecials(boolean fromnetsave) case 317: // Condition set trigger case 319: // Unlockable trigger case 331: // Player skin + case 334: // Object dye if (lines[i].args[0] > TMT_EACHTIMEMASK) P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); break; @@ -6719,11 +6715,6 @@ void P_SpawnSpecials(boolean fromnetsave) P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); break; - // Each time executors - case 335: - P_AddEachTimeThinker(&lines[i], !!(lines[i].flags & ML_BOUNCY)); - break; - // No More Enemies Linedef Exec case 313: P_AddNoEnemiesThinker(&lines[i]); @@ -6743,11 +6734,6 @@ void P_SpawnSpecials(boolean fromnetsave) case 329: break; - // Object dye executors - case 334: - case 336: - break; - case 399: // Linedef execute on map load // This is handled in P_RunLevelLoadExecutors. break;