diff --git a/src/actor.h b/src/actor.h index cf924d3b3..478e8a95f 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1210,6 +1210,7 @@ public: double MaxDropOffHeight; double MaxStepHeight; + double MaxSlopeSteepness; int32_t Mass; int16_t PainChance; diff --git a/src/p_map.cpp b/src/p_map.cpp index 9b461f530..6c91dcca9 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -964,7 +964,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (!(tm.thing->flags & MF_DROPOFF) && !(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) { - if ((open.frontfloorplane.fC() < STEEPSLOPE) != (open.backfloorplane.fC() < STEEPSLOPE)) + if ((open.frontfloorplane.fC() < tm.thing->MaxSlopeSteepness) != (open.backfloorplane.fC() < tm.thing->MaxSlopeSteepness)) { // on the boundary of a steep slope return false; @@ -3266,7 +3266,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move) if (t < 0) { // Desired location is behind (below) the plane // (i.e. Walking up the plane) - if (plane->fC() < STEEPSLOPE) + if (plane->fC() < actor->MaxSlopeSteepness) { // Can't climb up slopes of ~45 degrees or more if (actor->flags & MF_NOCLIP) { @@ -3277,12 +3277,12 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move) const msecnode_t *node; bool dopush = true; - if (plane->fC() > STEEPSLOPE * 2 / 3) + if (plane->fC() > actor->MaxSlopeSteepness * 2 / 3) { for (node = actor->touching_sectorlist; node; node = node->m_tnext) { sector_t *sec = node->m_sector; - if (sec->floorplane.fC() >= STEEPSLOPE) + if (sec->floorplane.fC() >= actor->MaxSlopeSteepness) { DVector3 pos = actor->PosRelative(sec) +move; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9c1bd943a..e594f03cf 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -304,6 +304,7 @@ void AActor::Serialize(FSerializer &arc) A("meleestate", MeleeState) A("missilestate", MissileState) A("maxdropoffheight", MaxDropOffHeight) + A("maxslopesteepness", MaxSlopeSteepness) A("maxstepheight", MaxStepHeight) A("bounceflags", BounceFlags) A("bouncefactor", bouncefactor) @@ -3924,18 +3925,18 @@ void AActor::Tick () // Check 3D floors as well floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz)); - if (floorplane.fC() < STEEPSLOPE && + if (floorplane.fC() < MaxSlopeSteepness && floorplane.ZatPoint (PosRelative(floorsector)) <= floorz) { const msecnode_t *node; bool dopush = true; - if (floorplane.fC() > STEEPSLOPE*2/3) + if (floorplane.fC() > MaxSlopeSteepness*2/3) { for (node = touching_sectorlist; node; node = node->m_tnext) { const sector_t *sec = node->m_sector; - if (sec->floorplane.fC() >= STEEPSLOPE) + if (sec->floorplane.fC() >= MaxSlopeSteepness) { if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight) { diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index 76861fe93..6e0029f2c 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1909,6 +1909,7 @@ DEFINE_FIELD(AActor, WallBounceSound) DEFINE_FIELD(AActor, CrushPainSound) DEFINE_FIELD(AActor, MaxDropOffHeight) DEFINE_FIELD(AActor, MaxStepHeight) +DEFINE_FIELD(AActor, MaxSlopeSteepness) DEFINE_FIELD(AActor, PainChance) DEFINE_FIELD(AActor, PainType) DEFINE_FIELD(AActor, DeathType) @@ -1995,5 +1996,3 @@ DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LineSide); DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LinePart); DEFINE_FIELD_X(FLineTraceData, FLineTraceData, SectorPlane); DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitType); - - diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 48859454a..5119c070f 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -73,6 +73,7 @@ class Actor : Thinker native const DEFAULT_HEALTH = 1000; const ONFLOORZ = -2147483648.0; const ONCEILINGZ = 2147483647.0; + const STEEPSLOPE = (46342./65536.); // [RH] Minimum floorplane.c value for walking const FLOATRANDZ = ONCEILINGZ-1; const TELEFRAG_DAMAGE = 1000000; const MinVel = 1./65536; @@ -216,6 +217,7 @@ class Actor : Thinker native native sound CrushPainSound; native double MaxDropoffHeight; native double MaxStepHeight; + native double MaxSlopeSteepness; native int16 PainChance; native name PainType; native name DeathType; @@ -312,6 +314,7 @@ class Actor : Thinker native property MinMissileChance: MinMissileChance; property MaxStepHeight: MaxStepHeight; property MaxDropoffHeight: MaxDropoffHeight; + property MaxSlopeSteepness: MaxSlopeSteepness; property PoisonDamageType: PoisonDamageType; property RadiusDamageFactor: RadiusDamageFactor; property SelfDamageFactor: SelfDamageFactor; @@ -370,6 +373,7 @@ class Actor : Thinker native MeleeRange 64 - 20; MaxDropoffHeight 24; MaxStepHeight 24; + MaxSlopeSteepness STEEPSLOPE; BounceFactor 0.7; WallBounceFactor 0.75; BounceCount -1;