diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index a75c98b4d83ca67ab79872ccbae76dc49f28ca65..430645decd85a8e88637d7201fff1aef76ad3b2a 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -762,7 +762,7 @@ doom } 402 { - title = "Set Tagged Sector's Light Level"; + title = "Copy Light Level to Tagged Sectors"; prefix = "(402)"; } 408 @@ -815,6 +815,11 @@ doom title = "Change Plane Scroller Direction"; prefix = "(435)"; } + 467 + { + title = "Set Tagged Sector's Light Level"; + prefix = "(467)"; + } } linedefexecplane @@ -2513,7 +2518,7 @@ udmf 402 { - title = "Copy Light Level"; + title = "Copy Light Level to Tagged Sectors"; prefix = "(402)"; arg0 { @@ -2700,6 +2705,38 @@ udmf title = "Speed"; } } + + 467 + { + title = "Set Tagged Sector's Light Level"; + prefix = "(467)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Light level"; + } + arg2 + { + title = "Affected area"; + type = 11; + enum + { + 0 = "Sector"; + 1 = "Floor"; + 2 = "Ceiling"; + } + } + arg3 + { + title = "Set/Add?"; + type = 11; + enum = "setadd"; + } + } } linedefexecplane diff --git a/src/p_setup.c b/src/p_setup.c index 251e0fbb333a6793f33892994de05ba22731f08e..c93a7ac2f2fd15d550488cf6ac2b38c5034035cd 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3826,6 +3826,12 @@ static void P_ConvertBinaryMap(void) case 456: //Stop fading colormap lines[i].args[0] = Tag_FGet(&lines[i].tags); break; + case 467: //Set light level + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = TML_SECTOR; + lines[i].args[3] = !!(lines[i].flags & ML_EFFECT3); + break; case 480: //Polyobject - door slide case 481: //Polyobject - door move lines[i].args[0] = tag; diff --git a/src/p_spec.c b/src/p_spec.c index aeb657988b82c0ae52a882fc7c63e9f027f959f7..c460c5a9822a86ac463795fb587616652d4c4874 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3683,6 +3683,45 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } break; + case 467: // Set light level + TAG_ITER_SECTORS(line->args[0], secnum) + { + if (sectors[secnum].lightingdata) + { + // Stop any lighting effects going on in the sector + P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + sectors[secnum].lightingdata = NULL; + + // No, it's not an elevator_t, but any struct with a thinker_t named + // 'thinker' at the beginning will do here. (We don't know what it + // actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.) + } + + if (line->args[2] == TML_FLOOR) + { + if (line->args[3]) + sectors[secnum].floorlightlevel += line->args[1]; + else + sectors[secnum].floorlightlevel = line->args[1]; + } + else if (line->args[2] == TML_CEILING) + { + if (line->args[3]) + sectors[secnum].ceilinglightlevel += line->args[1]; + else + sectors[secnum].ceilinglightlevel = line->args[1]; + } + else + { + if (line->args[3]) + sectors[secnum].lightlevel += line->args[1]; + else + sectors[secnum].lightlevel = line->args[1]; + sectors[secnum].lightlevel = max(0, min(255, sectors[secnum].lightlevel)); + } + } + break; + case 480: // Polyobj_DoorSlide case 481: // Polyobj_DoorSwing PolyDoor(line); diff --git a/src/p_spec.h b/src/p_spec.h index ca0bf0cb374edde3bb09079de22d5dd519f97dc2..adebf99d2834d4767637d770043241a5398fb206 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -112,6 +112,13 @@ typedef enum TMP_BOTH = 2, } textmapplanes_t; +typedef enum +{ + TML_SECTOR = 0, + TML_FLOOR = 1, + TML_CEILING = 2, +} textmaplightareas_t; + typedef enum { TMLC_NOSECTOR = 1,