Adapt wind/current linedefs to UDMF

This commit is contained in:
MascaraSnake 2021-07-01 20:35:13 +02:00
parent 6f698b3065
commit dcba011cf3
3 changed files with 43 additions and 24 deletions

View file

@ -3745,6 +3745,32 @@ static void P_ConvertBinaryMap(void)
lines[i].args[4] |= TMST_NONEXCLUSIVE;
lines[i].special = 510;
break;
case 541: //Wind
case 542: //Upwards wind
case 543: //Downwards wind
case 544: //Current
case 545: //Upwards current
case 546: //Downwards current
lines[i].args[0] = tag;
switch ((lines[i].special - 541) % 3)
{
case 0:
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 1:
lines[i].args[2] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
break;
case 2:
lines[i].args[2] = -R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;
break;
}
lines[i].args[3] = (lines[i].special >= 544) ? p_current : p_wind;
if (lines[i].flags & ML_EFFECT4)
lines[i].args[4] |= TMPF_SLIDE;
if (!(lines[i].flags & ML_NOCLIMB))
lines[i].args[4] |= TMPF_NONEXCLUSIVE;
lines[i].special = 541;
break;
case 606: //Colormap
lines[i].args[0] = Tag_FGet(&lines[i].tags);
break;

View file

@ -8883,7 +8883,7 @@ void T_Pusher(pusher_t *p)
thing->momx += xspeed;
thing->momy += yspeed;
thing->momz += xspeed;
thing->momz += zspeed;
if (thing->player)
{
thing->player->cmomx += xspeed;
@ -8974,14 +8974,17 @@ static void P_SpawnPushers(void)
tag = Tag_FGet(&l->tags);
switch (l->special)
{
case 541: // wind
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_wind, l->dx, l->dy, 0, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 544: // current
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_current, l->dx, l->dy, 0, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
case 541: // wind/current
{
fixed_t length = R_PointToDist2(l->v2->x, l->v2->y, l->v1->x, l->v1->y);
fixed_t hspeed = l->args[1] << FRACBITS;
fixed_t dx = FixedMul(FixedDiv(l->dx, length), hspeed);
fixed_t dy = FixedMul(FixedDiv(l->dy, length), hspeed);
TAG_ITER_SECTORS(l->args[0], s)
Add_Pusher(l->args[3], dx, dy, l->args[2] << FRACBITS, s, -1, !(l->args[4] & TMPF_NONEXCLUSIVE), !!(l->args[4] & TMPF_SLIDE));
break;
}
case 547: // push/pull
TAG_ITER_SECTORS(tag, s)
{
@ -8990,22 +8993,6 @@ static void P_SpawnPushers(void)
Add_PointPusher(P_AproxDistance(l->dx >> FRACBITS, l->dy >> FRACBITS), thing, s, l->flags & ML_NOCLIMB);
}
break;
case 545: // current up
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_current, 0, 0, P_AproxDistance(l->dx, l->dy), s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 546: // current down
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_current, 0, 0, -P_AproxDistance(l->dx, l->dy), s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 542: // wind up
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_wind, 0, 0, P_AproxDistance(l->dx, l->dy), s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 543: // wind down
TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_wind, 0, 0, -P_AproxDistance(l->dx, l->dy), s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
}
}
}

View file

@ -135,6 +135,12 @@ typedef enum
TMST_NONEXCLUSIVE = 4,
} textmapscrolltype_t;
typedef enum
{
TMPF_SLIDE = 1,
TMPF_NONEXCLUSIVE = 1<<1,
} textmappusherflags_t;
// GETSECSPECIAL (specialval, section)
//
// Pulls out the special # from a particular section.