mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 13:51:43 +00:00
Implement "Make FOF quicksand" linedef type
This commit is contained in:
parent
1693689305
commit
25219b614e
5 changed files with 43 additions and 9 deletions
|
@ -2047,6 +2047,25 @@ udmf
|
||||||
type = 15;
|
type = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
265
|
||||||
|
{
|
||||||
|
title = "Make FOF Quicksand";
|
||||||
|
prefix = "(265)";
|
||||||
|
arg0
|
||||||
|
{
|
||||||
|
title = "Control linedef tag";
|
||||||
|
type = 15;
|
||||||
|
}
|
||||||
|
arg1
|
||||||
|
{
|
||||||
|
title = "Sinking speed";
|
||||||
|
}
|
||||||
|
arg2
|
||||||
|
{
|
||||||
|
title = "Friction";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
linedefexecmisc
|
linedefexecmisc
|
||||||
|
|
|
@ -190,6 +190,8 @@ enum ffloor_e {
|
||||||
ffloor_busttype,
|
ffloor_busttype,
|
||||||
ffloor_bustflags,
|
ffloor_bustflags,
|
||||||
ffloor_busttag,
|
ffloor_busttag,
|
||||||
|
ffloor_sinkspeed,
|
||||||
|
ffloor_friction,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const ffloor_opt[] = {
|
static const char *const ffloor_opt[] = {
|
||||||
|
@ -211,6 +213,8 @@ static const char *const ffloor_opt[] = {
|
||||||
"busttype",
|
"busttype",
|
||||||
"bustflags",
|
"bustflags",
|
||||||
"busttag",
|
"busttag",
|
||||||
|
"sinkspeed",
|
||||||
|
"friction",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
#ifdef HAVE_LUA_SEGS
|
#ifdef HAVE_LUA_SEGS
|
||||||
|
@ -1767,6 +1771,12 @@ static int ffloor_get(lua_State *L)
|
||||||
case ffloor_busttag:
|
case ffloor_busttag:
|
||||||
lua_pushinteger(L, ffloor->busttag);
|
lua_pushinteger(L, ffloor->busttag);
|
||||||
return 1;
|
return 1;
|
||||||
|
case ffloor_sinkspeed:
|
||||||
|
lua_pushfixed(L, ffloor->sinkspeed);
|
||||||
|
return 1;
|
||||||
|
case ffloor_friction:
|
||||||
|
lua_pushfixed(L, ffloor->friction);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6943,7 +6943,12 @@ void P_SpawnSpecials(boolean fromnetsave)
|
||||||
if (!(lines[i].args[1]))
|
if (!(lines[i].args[1]))
|
||||||
ffloorflags |= FF_RIPPLE;
|
ffloorflags |= FF_RIPPLE;
|
||||||
|
|
||||||
P_AddFakeFloorsByLine(i, ffloorflags, secthinkers);
|
for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
|
||||||
|
{
|
||||||
|
ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, ffloorflags, secthinkers);
|
||||||
|
fflr->sinkspeed = abs(lines[i].args[2]) << (FRACBITS - 1);
|
||||||
|
fflr->fricttion = abs(lines[i].args[3]) << (FRACBITS - 6);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 258: // Laser block
|
case 258: // Laser block
|
||||||
|
|
12
src/p_user.c
12
src/p_user.c
|
@ -2862,7 +2862,7 @@ bouncydone:
|
||||||
static void P_CheckQuicksand(player_t *player)
|
static void P_CheckQuicksand(player_t *player)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
fixed_t sinkspeed, friction;
|
fixed_t sinkspeed;
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0))
|
if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0))
|
||||||
|
@ -2880,9 +2880,7 @@ static void P_CheckQuicksand(player_t *player)
|
||||||
|
|
||||||
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
|
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
|
||||||
{
|
{
|
||||||
sinkspeed = abs(rover->master->args[2]) << (FRACBITS - 1);
|
sinkspeed = FixedDiv(rover->sinkspeed,TICRATE*FRACUNIT);
|
||||||
|
|
||||||
sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT);
|
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
|
@ -2909,10 +2907,8 @@ static void P_CheckQuicksand(player_t *player)
|
||||||
P_PlayerHitFloor(player, false);
|
P_PlayerHitFloor(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
friction = abs(rover->master->args[3]) << (FRACBITS - 6);
|
player->mo->momx = FixedMul(player->mo->momx, rover->friction);
|
||||||
|
player->mo->momy = FixedMul(player->mo->momy, rover->friction);
|
||||||
player->mo->momx = FixedMul(player->mo->momx, friction);
|
|
||||||
player->mo->momy = FixedMul(player->mo->momy, friction);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,10 @@ typedef struct ffloor_s
|
||||||
UINT8 bustflags;
|
UINT8 bustflags;
|
||||||
INT16 busttag;
|
INT16 busttag;
|
||||||
|
|
||||||
|
// Only relevant for FF_QUICKSAND
|
||||||
|
fixed_t sinkspeed;
|
||||||
|
fixed_t friction;
|
||||||
|
|
||||||
// these are saved for netgames, so do not let Lua touch these!
|
// these are saved for netgames, so do not let Lua touch these!
|
||||||
ffloortype_e spawnflags; // flags the 3D floor spawned with
|
ffloortype_e spawnflags; // flags the 3D floor spawned with
|
||||||
INT32 spawnalpha; // alpha the 3D floor spawned with
|
INT32 spawnalpha; // alpha the 3D floor spawned with
|
||||||
|
|
Loading…
Reference in a new issue