Adapt "change plane scroller direction" linedef type to UDMF

This commit is contained in:
MascaraSnake 2021-07-02 12:51:39 +02:00
parent 6dfca597c5
commit 805bafd936
3 changed files with 27 additions and 3 deletions

View file

@ -2462,6 +2462,21 @@ udmf
enum = "floorceiling"; enum = "floorceiling";
} }
} }
435
{
title = "Change Plane Scroller Direction";
prefix = "(435)";
arg0
{
title = "Target sector tag";
type = 13;
}
arg1
{
title = "Speed";
}
}
} }
linedefexecplane linedefexecplane

View file

@ -3611,6 +3611,10 @@ static void P_ConvertBinaryMap(void)
} }
lines[i].special = 429; lines[i].special = 429;
break; break;
case 435: //Change plane scroller direction
lines[i].args[0] = tag;
lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
break;
case 443: //Call Lua function case 443: //Call Lua function
if (lines[i].text) if (lines[i].text)
{ {

View file

@ -2945,17 +2945,22 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
scroll_t *scroller; scroll_t *scroller;
thinker_t *th; thinker_t *th;
fixed_t length = R_PointToDist2(line->v2->x, line->v2->y, line->v1->x, line->v1->y);
fixed_t speed = line->args[1] << FRACBITS;
fixed_t dx = FixedMul(FixedMul(FixedDiv(line->dx, length), speed) >> SCROLL_SHIFT, CARRYFACTOR);
fixed_t dy = FixedMul(FixedMul(FixedDiv(line->dy, length), speed) >> SCROLL_SHIFT, CARRYFACTOR);
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next) for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
{ {
if (th->function.acp1 != (actionf_p1)T_Scroll) if (th->function.acp1 != (actionf_p1)T_Scroll)
continue; continue;
scroller = (scroll_t *)th; scroller = (scroll_t *)th;
if (!Tag_Find(&sectors[scroller->affectee].tags, tag)) if (!Tag_Find(&sectors[scroller->affectee].tags, line->args[0]))
continue; continue;
scroller->dx = FixedMul(line->dx>>SCROLL_SHIFT, CARRYFACTOR); scroller->dx = dx;
scroller->dy = FixedMul(line->dy>>SCROLL_SHIFT, CARRYFACTOR); scroller->dy = dy;
} }
} }
break; break;