mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Expose LandingSpeed
to ZScript. This controls the minimum Z velocity from falling down that's needed to "squat" the player's view (defaults to -8).
This commit is contained in:
parent
730ef1a23a
commit
0d9855cfe7
4 changed files with 12 additions and 6 deletions
|
@ -1369,6 +1369,9 @@ public:
|
|||
int SpawnTime;
|
||||
uint32_t SpawnOrder;
|
||||
|
||||
// landing speed from a jump with normal gravity (squats the player's view)
|
||||
// (note: this is put into AActor instead of the PlayerPawn because non-players also use the value)
|
||||
double LandingSpeed;
|
||||
|
||||
// ThingIDs
|
||||
void SetTID (int newTID);
|
||||
|
|
|
@ -391,7 +391,8 @@ void AActor::Serialize(FSerializer &arc)
|
|||
A("lightlevel", LightLevel)
|
||||
A("userlights", UserLights)
|
||||
A("WorldOffset", WorldOffset)
|
||||
("modelData", modelData);
|
||||
("modelData", modelData)
|
||||
A("LandingSpeed", LandingSpeed);
|
||||
|
||||
SerializeTerrain(arc, "floorterrain", floorterrain, &def->floorterrain);
|
||||
SerializeArgs(arc, "args", args, def->args, special);
|
||||
|
@ -2584,11 +2585,9 @@ static void P_ZMovement (AActor *mo, double oldfloorz)
|
|||
mo->SetZ(mo->floorz);
|
||||
if (mo->Vel.Z < 0)
|
||||
{
|
||||
const double minvel = -8; // landing speed from a jump with normal gravity
|
||||
|
||||
// Spawn splashes, etc.
|
||||
P_HitFloor (mo);
|
||||
if (mo->DamageType == NAME_Ice && mo->Vel.Z < minvel)
|
||||
if (mo->DamageType == NAME_Ice && mo->Vel.Z < mo->LandingSpeed)
|
||||
{
|
||||
mo->tics = 1;
|
||||
mo->Vel.Zero();
|
||||
|
@ -2601,11 +2600,11 @@ static void P_ZMovement (AActor *mo, double oldfloorz)
|
|||
}
|
||||
if (mo->player)
|
||||
{
|
||||
if (mo->player->jumpTics < 0 || mo->Vel.Z < minvel)
|
||||
if (mo->player->jumpTics < 0 || mo->Vel.Z < mo->LandingSpeed)
|
||||
{ // delay any jumping for a short while
|
||||
mo->player->jumpTics = 7;
|
||||
}
|
||||
if (mo->Vel.Z < minvel && !(mo->flags & MF_NOGRAVITY))
|
||||
if (mo->Vel.Z < mo->LandingSpeed && !(mo->flags & MF_NOGRAVITY))
|
||||
{
|
||||
// Squat down.
|
||||
// Decrease viewheight for a moment after hitting the ground (hard),
|
||||
|
|
|
@ -2126,6 +2126,7 @@ DEFINE_FIELD(AActor, ShadowAimFactor)
|
|||
DEFINE_FIELD(AActor, ShadowPenaltyFactor)
|
||||
DEFINE_FIELD(AActor, AutomapOffsets)
|
||||
DEFINE_FIELD(AActor, Path)
|
||||
DEFINE_FIELD(AActor, LandingSpeed)
|
||||
|
||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
|
||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
|
||||
|
|
|
@ -262,6 +262,7 @@ class Actor : Thinker native
|
|||
native uint freezetics;
|
||||
native Vector2 AutomapOffsets;
|
||||
native Array<PathNode> Path;
|
||||
native double LandingSpeed;
|
||||
|
||||
meta String Obituary; // Player was killed by this actor
|
||||
meta String HitObituary; // Player was killed by this actor in melee
|
||||
|
@ -367,6 +368,7 @@ class Actor : Thinker native
|
|||
property ShadowAimFactor: ShadowAimFactor;
|
||||
property ShadowPenaltyFactor: ShadowPenaltyFactor;
|
||||
property AutomapOffsets : AutomapOffsets;
|
||||
property LandingSpeed: LandingSpeed;
|
||||
|
||||
// need some definition work first
|
||||
//FRenderStyle RenderStyle;
|
||||
|
@ -455,6 +457,7 @@ class Actor : Thinker native
|
|||
RenderHidden 0;
|
||||
RenderRequired 0;
|
||||
FriendlySeeBlocks 10; // 10 (blocks) * 128 (one map unit block)
|
||||
LandingSpeed -8; // landing speed from a jump with normal gravity (squats the player's view)
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
|
Loading…
Reference in a new issue