Add linedef executor for modifying (as opposed to copying) a sector's light level

This commit is contained in:
MascaraSnake 2021-09-20 07:54:10 +02:00
parent 6871262909
commit 1784c7b0ef
4 changed files with 91 additions and 2 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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,