Speed Pads TERRAIN effect

- Use `SpeedPad` to set the strength. Intended to be scaled like Trick Panels, so 1 for yellow, 2 for red, so on. Can use floating point.
- Use `SpeedPadAngle` to rotate the thrust direction. This is in the same system as map angles, so east is 0, north is 90, west is 180, and south is 270. Also accepts floating point.
- Speed Pad angle accounts for the flat alignment itself, as well.
- Like Sneaker and Trick Panels, the sector / line special are now deprecated.
This commit is contained in:
Sally Coolatta 2022-10-11 02:26:54 -04:00 committed by NepDisk
parent 91e88690e4
commit c93034437c
3 changed files with 80 additions and 2 deletions

View file

@ -522,6 +522,64 @@ void K_ProcessTerrainEffect(mobj_t *mo)
K_DoSneaker(player, 0);
}
// Speed pad
if (terrain->speedPad > 0)
{
if (player->floorboost != 0)
{
player->floorboost = 2;
}
else
{
fixed_t thrustSpeed = terrain->speedPad * 16;
angle_t thrustAngle = terrain->speedPadAngle;
fixed_t playerSpeed = P_AproxDistance(player->mo->momx, player->mo->momy);
// FIXME: come up with a better way to get the touched
// texture's rotation to this function. At least this
// will work for 90% of scenarios...
if (player->mo->eflags & MFE_VERTICALFLIP)
{
if (player->mo->ceilingrover != NULL)
{
thrustAngle += *player->mo->ceilingrover->bottomangle;
}
else
{
thrustAngle += player->mo->subsector->sector->ceilingpic_angle;
}
}
else
{
if (player->mo->floorrover != NULL)
{
thrustAngle += *player->mo->floorrover->topangle;
}
else
{
thrustAngle += player->mo->subsector->sector->floorpic_angle;
}
}
// Map scale for Shrink, object scale for Grow.
thrustSpeed = FixedMul(thrustSpeed, max(mapobjectscale, player->mo->scale));
thrustAngle = K_ReflectAngle(
K_MomentumAngle(player->mo), thrustAngle,
playerSpeed, thrustSpeed
);
P_InstaThrust(player->mo, thrustAngle, max(thrustSpeed, 2*playerSpeed));
player->dashpadcooldown = TICRATE/3;
player->pogospring = 0;
player->floorboost = 2;
S_StartSound(player->mo, sfx_cdfm62);
}
}
// Pogospring panel
if (terrain->pogoSpring > 0 && !(mo->eflags & MFE_SPRUNG))
@ -1403,6 +1461,8 @@ static void K_TerrainDefaults(terrain_t *terrain)
terrain->offroad = 0;
terrain->damageType = -1;
terrain->pogoSpring = 0;
terrain->speedPad = 0;
terrain->speedPadAngle = 0;
terrain->flags = 0;
}
@ -1477,6 +1537,14 @@ static void K_ParseTerrainParameter(size_t i, char *param, char *val)
{
terrain->floorClip = FLOAT_TO_FIXED(atof(val));
}
else if (stricmp(param, "speedPad") == 0)
{
terrain->speedPad = FLOAT_TO_FIXED(atof(val));
}
else if (stricmp(param, "speedPadAngle") == 0)
{
terrain->speedPadAngle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
}
else if (stricmp(param, "floorClip") == 0)
{
terrain->floorClip = FLOAT_TO_FIXED(atof(val));

View file

@ -114,6 +114,8 @@ typedef struct terrain_s
fixed_t offroad; // The default offroad level of this texture.
INT16 damageType; // The default damage type of this texture. (Negative means no damage).
UINT8 pogoSpring; // Is this panel a pogo spring?
fixed_t speedPad; // Speed pad strength
angle_t speedPadAngle; // Speed pad angle
fixed_t floorClip; // Offset for sprites on this ground
UINT32 flags; // Flag values (see: terrain_flags_t)
} terrain_t;

View file

@ -46,8 +46,16 @@ boolean R_NoEncore(sector_t *sector, levelflat_t *flat, boolean ceiling)
const boolean invertEncore = (sector->flags & MSF_INVERTENCORE);
const terrain_t *terrain = (flat != NULL ? flat->terrain : NULL);
if ((terrain != NULL)
&& !(terrain->flags & TRF_SNEAKERPANEL))
if ((terrain == NULL)
|| (terrain->pogoSpring <= 0
&& terrain->speedPad <= 0
&& !(terrain->flags & TRF_SNEAKERPANEL)))
{
return invertEncore;
}
if ((!(sector->special & (1<<8)) || (sector->special & ((4|8)<<8))) // spring panel
&& GETSECSPECIAL(sector->special, 4) != 6) // sneaker panel
{
return invertEncore;
}