Adapt polyobject visibility/tangibility linedefs to UDMF

This commit is contained in:
MascaraSnake 2021-07-04 13:45:41 +02:00
parent 2cbda0e5ac
commit 5c2ce62f00
4 changed files with 71 additions and 36 deletions

View file

@ -2893,6 +2893,39 @@ udmf
}
}
}
489
{
title = "Set Visibility, Tangibility";
prefix = "(489)";
arg0
{
title = "PolyObject ID";
type = 14;
}
arg1
{
title = "Visibility";
type = 11;
enum
{
0 = "No change";
1 = "Visible";
2 = "Invisible";
}
}
arg2
{
title = "Tangibility";
type = 11;
enum
{
0 = "No change";
1 = "Tangible";
2 = "Intangible";
}
}
}
}
scrollpush

View file

@ -294,6 +294,20 @@ typedef struct polywaypointdata_s
UINT8 flags; // PWF_ flags
} polywaypointdata_t;
typedef enum
{
TMPV_NOCHANGE = 1,
TMPV_VISIBLE = 1<<1,
TMPV_INVISIBLE = 1<<2,
} textmappolyvisibility_t;
typedef enum
{
TMPT_NOCHANGE = 1,
TMPT_TANGIBLE = 1<<1,
TMPT_INTANGIBLE = 1<<2,
} textmappolytangibility_t;
// polyobject door types
typedef enum
{

View file

@ -3715,6 +3715,14 @@ static void P_ConvertBinaryMap(void)
if (lines[i].flags & ML_EFFECT4)
lines[i].args[4] |= PWF_LOOP;
break;
case 489: //Polyobject - turn invisible, intangible
case 490: //Polyobject - turn visible, tangible
lines[i].args[0] = tag;
lines[i].args[1] = 491 - lines[i].special;
if (!(lines[i].flags & ML_NOCLIMB))
lines[i].args[2] = lines[i].args[1];
lines[i].special = 489;
break;
case 500: //Scroll front wall left
case 501: //Scroll front wall right
lines[i].args[0] = 0;

View file

@ -1031,16 +1031,14 @@ static boolean PolyMove(line_t *line)
return EV_DoPolyObjMove(&pmd);
}
// Makes a polyobject invisible and intangible
// If NOCLIMB is ticked, the polyobject will still be tangible, just not visible.
static void PolyInvisible(line_t *line)
static void PolySetVisibilityTangibility(line_t *line)
{
INT32 polyObjNum = Tag_FGet(&line->tags);
INT32 polyObjNum = line->args[0];
polyobj_t* po;
if (!(po = Polyobj_GetForNum(polyObjNum)))
{
CONS_Debug(DBG_POLYOBJ, "PolyInvisible: bad polyobj %d\n", polyObjNum);
CONS_Debug(DBG_POLYOBJ, "PolySetVisibilityTangibility: bad polyobj %d\n", polyObjNum);
return;
}
@ -1048,38 +1046,23 @@ static void PolyInvisible(line_t *line)
if (po->isBad)
return;
if (!(line->flags & ML_NOCLIMB))
po->flags &= ~POF_SOLID;
if (line->args[1] == TMPV_VISIBLE)
{
po->flags &= ~POF_NOSPECIALS;
po->flags |= (po->spawnflags & POF_RENDERALL);
}
else if (line->args[1] == TMPV_INVISIBLE)
{
po->flags |= POF_NOSPECIALS;
po->flags &= ~POF_RENDERALL;
}
// Makes a polyobject visible and tangible
// If NOCLIMB is ticked, the polyobject will not be tangible, just visible.
static void PolyVisible(line_t *line)
{
INT32 polyObjNum = Tag_FGet(&line->tags);
polyobj_t *po;
if (!(po = Polyobj_GetForNum(polyObjNum)))
{
CONS_Debug(DBG_POLYOBJ, "PolyVisible: bad polyobj %d\n", polyObjNum);
return;
}
// don't allow line actions to affect bad polyobjects
if (po->isBad)
return;
if (!(line->flags & ML_NOCLIMB))
if (line->args[2] == TMPT_TANGIBLE)
po->flags |= POF_SOLID;
po->flags &= ~POF_NOSPECIALS;
po->flags |= (po->spawnflags & POF_RENDERALL);
else if (line->args[2] == TMPT_INTANGIBLE)
po->flags &= ~POF_SOLID;
}
// Sets the translucency of a polyobject
// Frontsector floor / 100 = translevel
static void PolyTranslucency(line_t *line)
@ -3891,10 +3874,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
PolyWaypoint(line);
break;
case 489:
PolyInvisible(line);
break;
case 490:
PolyVisible(line);
PolySetVisibilityTangibility(line);
break;
case 491:
PolyTranslucency(line);