Implement FOF type 251

This commit is contained in:
MascaraSnake 2020-04-14 09:43:49 +02:00
parent 916f831edb
commit 32a1131c68
4 changed files with 50 additions and 13 deletions

View file

@ -1644,6 +1644,30 @@ udmf
} }
} }
251
{
title = "Thwomp Block";
prefix = "(251);
arg0
{
title = "Target sector tag";
type = 13;
}
arg1
{
title = "Falling speed";
}
arg2
{
title = "Rising speed";
}
stringarg0
{
title = "Crushing sound";
type = 2;
}
}
linedefexecmisc linedefexecmisc
{ {
title = "Linedef Executor (misc.)"; title = "Linedef Executor (misc.)";

View file

@ -11,6 +11,7 @@
/// \file p_floor.c /// \file p_floor.c
/// \brief Floor animation, elevators /// \brief Floor animation, elevators
#include "dehacked.h"
#include "doomdef.h" #include "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#include "m_random.h" #include "m_random.h"
@ -1885,10 +1886,7 @@ void T_ThwompSector(levelspecthink_t *thwomp)
sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].bottomtexture; sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].bottomtexture;
/// \note this should only have to be done once, but is already done repeatedly, above /// \note this should only have to be done once, but is already done repeatedly, above
if (thwomp->sourceline->flags & ML_EFFECT5) thwomp->speed = thwomp->sourceline->args[2] << (FRACBITS - 3);
thwomp->speed = thwomp->sourceline->dx/8;
else
thwomp->speed = 2*FRACUNIT;
res = T_MovePlane res = T_MovePlane
( (
@ -1924,10 +1922,7 @@ void T_ThwompSector(levelspecthink_t *thwomp)
// Set the texture from the upper one (angry) // Set the texture from the upper one (angry)
sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].toptexture; sides[thwomp->sourceline->sidenum[0]].midtexture = sides[thwomp->sourceline->sidenum[0]].toptexture;
if (thwomp->sourceline->flags & ML_EFFECT5) thwomp->speed = thwomp->sourceline->args[1] << (FRACBITS - 3);
thwomp->speed = thwomp->sourceline->dy/8;
else
thwomp->speed = 10*FRACUNIT;
res = T_MovePlane res = T_MovePlane
( (
@ -1961,10 +1956,8 @@ void T_ThwompSector(levelspecthink_t *thwomp)
if (!rover || (rover->flags & FF_EXISTS)) if (!rover || (rover->flags & FF_EXISTS))
{ {
if (thwomp->sourceline->flags & ML_EFFECT4) sfxenum_t sound = (thwomp->sourceline->stringargs[0]) ? get_number(thwomp->sourceline->stringargs[0]) : sfx_thwomp;
S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); S_StartSound(mp, sound);
else
S_StartSound(mp, sfx_thwomp);
} }
thwomp->direction = 1; // start heading back up thwomp->direction = 1; // start heading back up

View file

@ -2938,6 +2938,26 @@ static void P_ConvertBinaryMap(void)
if (lines[i].flags & ML_EFFECT1) //Invisible if (lines[i].flags & ML_EFFECT1) //Invisible
lines[i].args[1] |= 2; lines[i].args[1] |= 2;
break; break;
case 251: //FOF: Thwomp block
lines[i].args[0] = lines[i].tag;
if (lines[i].flags & ML_EFFECT5) //Custom speeds
{
lines[i].args[1] = lines[i].dy >> FRACBITS;
lines[i].args[2] = lines[i].dx >> FRACBITS;
}
else
{
lines[i].args[1] = 80;
lines[i].args[2] = 16;
}
if (lines[i].flags & ML_EFFECT4)
{
char buffer[6];
sprintf(buffer, "%d", sides[lines[i].sidenum[0]].textureoffset >> FRACBITS);
lines[i].stringargs[0] = Z_Malloc(strlen(buffer) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[0], buffer, strlen(buffer) + 1);
}
break;
case 443: //Call Lua function case 443: //Call Lua function
if (lines[i].text) if (lines[i].text)
{ {

View file

@ -6997,7 +6997,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 251: // A THWOMP! case 251: // A THWOMP!
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
{ {
P_AddThwompThinker(&sectors[sec], &sectors[s], &lines[i]); P_AddThwompThinker(&sectors[sec], &sectors[s], &lines[i]);
P_AddFakeFloor(&sectors[s], &sectors[sec], lines + i, P_AddFakeFloor(&sectors[s], &sectors[sec], lines + i,