Adapt linedef type 14 to UDMF

This commit is contained in:
MascaraSnake 2021-12-30 07:54:16 +01:00
parent 73ba288e5d
commit 696d4945a7
3 changed files with 45 additions and 16 deletions

View file

@ -1717,6 +1717,7 @@ udmf
stringarg0
{
title = "Sound";
type = 2;
}
}
@ -1740,6 +1741,31 @@ udmf
}
}
14
{
title = "Bustable Block Parameters";
prefix = "(14)";
arg0
{
title = "Debris spacing";
}
arg1
{
title = "Debris lifetime";
}
arg2
{
title = "Launch from center?";
type = 11;
enum = "noyes";
}
stringarg0
{
title = "Debris object type";
type = 2;
}
}
15
{
title = "Fan Particle Generator Heights";
@ -4699,6 +4725,7 @@ udmf
stringarg0
{
title = "Prompt name";
type = 2;
}
}

View file

@ -11,6 +11,7 @@
/// \file p_floor.c
/// \brief Floor animation, elevators
#include "dehacked.h"
#include "doomdef.h"
#include "doomstat.h"
#include "m_random.h"
@ -1812,7 +1813,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
fixed_t leftx, rightx, topy, bottomy, topz, bottomz, widthfactor, heightfactor, a, b, c, spacing;
mobjtype_t type;
tic_t lifetime;
INT16 flags;
boolean fromcenter;
sector_t *controlsec = rover->master->frontsector;
mtag_t tag = Tag_FGet(&controlsec->tags);
@ -1842,25 +1843,20 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
spacing = (32<<FRACBITS);
type = MT_ROCKCRUMBLE1;
lifetime = 3*TICRATE;
flags = 0;
fromcenter = false;
if (tag != 0)
{
INT32 tagline = Tag_FindLineSpecial(14, tag);
if (tagline != -1)
{
if (sides[lines[tagline].sidenum[0]].toptexture)
type = (mobjtype_t)sides[lines[tagline].sidenum[0]].toptexture; // Set as object type in p_setup.c...
if (sides[lines[tagline].sidenum[0]].textureoffset)
spacing = sides[lines[tagline].sidenum[0]].textureoffset;
if (sides[lines[tagline].sidenum[0]].rowoffset)
{
if (sides[lines[tagline].sidenum[0]].rowoffset>>FRACBITS != -1)
lifetime = (sides[lines[tagline].sidenum[0]].rowoffset>>FRACBITS);
else
lifetime = 0;
}
flags = lines[tagline].flags;
if (lines[tagline].stringargs[0])
type = get_number(lines[tagline].stringargs[0]);
if (lines[tagline].args[0])
spacing = lines[tagline].args[0] << FRACBITS;
if (lines[tagline].args[1])
lifetime = (lines[tagline].args[1] != -1) ? lines[tagline].args[1] : 0;
fromcenter = !!lines[tagline].args[2];
}
}
@ -1895,7 +1891,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
topz = *rover->topheight-(spacing>>1);
bottomz = *rover->bottomheight;
if (flags & ML_EFFECT1)
if (fromcenter)
{
widthfactor = (rightx + topy - leftx - bottomy)>>3;
heightfactor = (topz - *rover->bottomheight)>>2;
@ -1918,7 +1914,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
spawned = P_SpawnMobj(a, b, c, type);
spawned->angle += P_RandomKey(36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
if (flags & ML_EFFECT1)
if (fromcenter)
{
P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(P_AproxDistance(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor));
P_SetObjectMomZ(spawned, FixedDiv((c - bottomz), heightfactor), false);

View file

@ -3241,6 +3241,12 @@ static void P_ConvertBinaryMap(void)
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;
lines[i].args[2] = !!(lines[i].flags & ML_EFFECT1);
break;
case 14: //Bustable block parameters
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;
lines[i].args[2] = !!(lines[i].flags & ML_EFFECT1);
P_WriteConstant(sides[lines[i].sidenum[0]].toptexture, &lines[i].stringargs[0]);
break;
case 16: //Minecart parameters
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
break;