Adapt set translucency linedef to UDMF

This commit is contained in:
MascaraSnake 2021-07-04 15:37:42 +02:00
parent d2ad12c034
commit 6d007f388a
5 changed files with 9191 additions and 14 deletions

View file

@ -2991,6 +2991,27 @@ udmf
} }
} }
} }
491
{
title = "Set Translucency";
prefix = "(491)";
arg0
{
title = "PolyObject ID";
type = 14;
}
arg1
{
title = "Translucency level";
}
arg2
{
title = "Set/Add?";
type = 11;
enum = "setadd";
}
}
} }
scrollpush scrollpush

View file

@ -406,6 +406,12 @@ enums
1 = "Yes"; 1 = "Yes";
} }
setadd
{
0 = "Set";
1 = "Add";
}
onoff onoff
{ {
0 = "On"; 0 = "On";

View file

@ -3741,6 +3741,15 @@ static void P_ConvertBinaryMap(void)
lines[i].args[2] = lines[i].args[1]; lines[i].args[2] = lines[i].args[1];
lines[i].special = 489; lines[i].special = 489;
break; break;
case 491: //Polyobject - set translucency
lines[i].args[0] = tag;
// If Front X Offset is specified, use that. Else, use floorheight.
lines[i].args[1] = (sides[lines[i].sidenum[0]].textureoffset ? sides[lines[i].sidenum[0]].textureoffset : lines[i].frontsector->floorheight) >> FRACBITS;
// If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000.
if (!(lines[i].flags & ML_DONTPEGBOTTOM))
lines[i].args[1] /= 100;
lines[i].args[2] = !!(lines[i].flags & ML_EFFECT3);
break;
case 500: //Scroll front wall left case 500: //Scroll front wall left
case 501: //Scroll front wall right case 501: //Scroll front wall right
lines[i].args[0] = 0; lines[i].args[0] = 0;

View file

@ -1064,16 +1064,14 @@ static void PolySetVisibilityTangibility(line_t *line)
} }
// Sets the translucency of a polyobject // Sets the translucency of a polyobject
// Frontsector floor / 100 = translevel
static void PolyTranslucency(line_t *line) static void PolyTranslucency(line_t *line)
{ {
INT32 polyObjNum = Tag_FGet(&line->tags); INT32 polyObjNum = line->args[0];
polyobj_t *po; polyobj_t *po;
INT32 value;
if (!(po = Polyobj_GetForNum(polyObjNum))) if (!(po = Polyobj_GetForNum(polyObjNum)))
{ {
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjWaypoint: bad polyobj %d\n", polyObjNum); CONS_Debug(DBG_POLYOBJ, "PolyTranslucency: bad polyobj %d\n", polyObjNum);
return; return;
} }
@ -1081,17 +1079,10 @@ static void PolyTranslucency(line_t *line)
if (po->isBad) if (po->isBad)
return; return;
// If Front X Offset is specified, use that. Else, use floorheight. if (lines->args[2]) // relative calc
value = (sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : line->frontsector->floorheight) >> FRACBITS; po->translucency += line->args[1];
// If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000.
if (!(line->flags & ML_DONTPEGBOTTOM))
value /= 100;
if (line->flags & ML_EFFECT3) // relative calc
po->translucency += value;
else else
po->translucency = value; po->translucency = line->args[1];
po->translucency = max(min(po->translucency, NUMTRANSMAPS), 0); po->translucency = max(min(po->translucency, NUMTRANSMAPS), 0);
} }

9150
src/p_spec.c.orig Normal file

File diff suppressed because it is too large Load diff