Add "change sector's gravity" linedef executor in UDMF to replace linedef type 1

This commit is contained in:
MascaraSnake 2021-12-30 19:28:01 +01:00
parent b3863c57be
commit 7b830fbddf
3 changed files with 74 additions and 0 deletions

View file

@ -3677,6 +3677,43 @@ udmf
enum = "setadd"; enum = "setadd";
} }
} }
469
{
title = "Change Tagged Sector's Gravity";
prefix = "(469)";
arg0
{
title = "Target sector tag";
type = 13;
}
arg1
{
title = "Set/Multiply?";
type = 11;
enum
{
0 = "Set";
1 = "Multiply";
}
}
arg2
{
title = "Flip flag";
type = 11;
enum
{
0 = "Don't change";
1 = "Set";
2 = "Remove";
}
}
stringarg0
{
title = "Gravity value";
type = 2;
}
}
} }
linedefexecplane linedefexecplane

View file

@ -3801,6 +3801,33 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
} }
break; break;
case 469: // Change sector gravity
{
fixed_t gravityvalue;
if (!udmf)
break;
if (!line->stringargs[0])
break;
gravityvalue = FloatToFixed(atof(line->stringargs[0]));
TAG_ITER_SECTORS(line->args[0], secnum)
{
if (line->args[1])
sectors[secnum].gravity = FixedMul(sectors[secnum].gravity, gravityvalue);
else
sectors[secnum].gravity = gravityvalue;
if (line->args[2] == TMF_ADD)
sectors[secnum].flags |= MSF_GRAVITYFLIP;
else if (line->args[2] == TMF_REMOVE)
sectors[secnum].flags &= ~MSF_GRAVITYFLIP;
}
}
break;
case 480: // Polyobj_DoorSlide case 480: // Polyobj_DoorSlide
case 481: // Polyobj_DoorSwing case 481: // Polyobj_DoorSwing
PolyDoor(line); PolyDoor(line);
@ -6112,6 +6139,9 @@ void P_SpawnSpecials(boolean fromnetsave)
ffloortype_e ffloorflags; ffloortype_e ffloorflags;
case 1: // Definable gravity per sector case 1: // Definable gravity per sector
if (udmf)
break;
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s) TAG_ITER_SECTORS(tag, s)
{ {

View file

@ -412,6 +412,13 @@ typedef enum
//TMP_FREEZETHINKERS = 1<<6, //TMP_FREEZETHINKERS = 1<<6,
} textmappromptflags_t; } textmappromptflags_t;
typedef enum
{
TMF_NOCHANGE = 0,
TMF_ADD = 1,
TMF_REMOVE = 2,
} textmapsetflagflags_t;
typedef enum typedef enum
{ {
TMSD_FRONT = 0, TMSD_FRONT = 0,