Add MaxSlopeSteepness actor property

This commit is contained in:
Nikolay Ambartsumov 2020-10-03 08:24:33 +03:00 committed by drfrag
parent 3a8ccda80f
commit 2b64b4f688
5 changed files with 14 additions and 9 deletions

View file

@ -1210,6 +1210,7 @@ public:
double MaxDropOffHeight; double MaxDropOffHeight;
double MaxStepHeight; double MaxStepHeight;
double MaxSlopeSteepness;
int32_t Mass; int32_t Mass;
int16_t PainChance; int16_t PainChance;

View file

@ -964,7 +964,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (!(tm.thing->flags & MF_DROPOFF) && if (!(tm.thing->flags & MF_DROPOFF) &&
!(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) !(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 // on the boundary of a steep slope
return false; return false;
@ -3266,7 +3266,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
if (t < 0) if (t < 0)
{ // Desired location is behind (below) the plane { // Desired location is behind (below) the plane
// (i.e. Walking up 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 { // Can't climb up slopes of ~45 degrees or more
if (actor->flags & MF_NOCLIP) if (actor->flags & MF_NOCLIP)
{ {
@ -3277,12 +3277,12 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
const msecnode_t *node; const msecnode_t *node;
bool dopush = true; 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) for (node = actor->touching_sectorlist; node; node = node->m_tnext)
{ {
sector_t *sec = node->m_sector; sector_t *sec = node->m_sector;
if (sec->floorplane.fC() >= STEEPSLOPE) if (sec->floorplane.fC() >= actor->MaxSlopeSteepness)
{ {
DVector3 pos = actor->PosRelative(sec) +move; DVector3 pos = actor->PosRelative(sec) +move;

View file

@ -304,6 +304,7 @@ void AActor::Serialize(FSerializer &arc)
A("meleestate", MeleeState) A("meleestate", MeleeState)
A("missilestate", MissileState) A("missilestate", MissileState)
A("maxdropoffheight", MaxDropOffHeight) A("maxdropoffheight", MaxDropOffHeight)
A("maxslopesteepness", MaxSlopeSteepness)
A("maxstepheight", MaxStepHeight) A("maxstepheight", MaxStepHeight)
A("bounceflags", BounceFlags) A("bounceflags", BounceFlags)
A("bouncefactor", bouncefactor) A("bouncefactor", bouncefactor)
@ -3924,18 +3925,18 @@ void AActor::Tick ()
// Check 3D floors as well // Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz)); floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz));
if (floorplane.fC() < STEEPSLOPE && if (floorplane.fC() < MaxSlopeSteepness &&
floorplane.ZatPoint (PosRelative(floorsector)) <= floorz) floorplane.ZatPoint (PosRelative(floorsector)) <= floorz)
{ {
const msecnode_t *node; const msecnode_t *node;
bool dopush = true; bool dopush = true;
if (floorplane.fC() > STEEPSLOPE*2/3) if (floorplane.fC() > MaxSlopeSteepness*2/3)
{ {
for (node = touching_sectorlist; node; node = node->m_tnext) for (node = touching_sectorlist; node; node = node->m_tnext)
{ {
const sector_t *sec = node->m_sector; 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) if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight)
{ {

View file

@ -1909,6 +1909,7 @@ DEFINE_FIELD(AActor, WallBounceSound)
DEFINE_FIELD(AActor, CrushPainSound) DEFINE_FIELD(AActor, CrushPainSound)
DEFINE_FIELD(AActor, MaxDropOffHeight) DEFINE_FIELD(AActor, MaxDropOffHeight)
DEFINE_FIELD(AActor, MaxStepHeight) DEFINE_FIELD(AActor, MaxStepHeight)
DEFINE_FIELD(AActor, MaxSlopeSteepness)
DEFINE_FIELD(AActor, PainChance) DEFINE_FIELD(AActor, PainChance)
DEFINE_FIELD(AActor, PainType) DEFINE_FIELD(AActor, PainType)
DEFINE_FIELD(AActor, DeathType) 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, LinePart);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, SectorPlane); DEFINE_FIELD_X(FLineTraceData, FLineTraceData, SectorPlane);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitType); DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitType);

View file

@ -73,6 +73,7 @@ class Actor : Thinker native
const DEFAULT_HEALTH = 1000; const DEFAULT_HEALTH = 1000;
const ONFLOORZ = -2147483648.0; const ONFLOORZ = -2147483648.0;
const ONCEILINGZ = 2147483647.0; const ONCEILINGZ = 2147483647.0;
const STEEPSLOPE = (46342./65536.); // [RH] Minimum floorplane.c value for walking
const FLOATRANDZ = ONCEILINGZ-1; const FLOATRANDZ = ONCEILINGZ-1;
const TELEFRAG_DAMAGE = 1000000; const TELEFRAG_DAMAGE = 1000000;
const MinVel = 1./65536; const MinVel = 1./65536;
@ -216,6 +217,7 @@ class Actor : Thinker native
native sound CrushPainSound; native sound CrushPainSound;
native double MaxDropoffHeight; native double MaxDropoffHeight;
native double MaxStepHeight; native double MaxStepHeight;
native double MaxSlopeSteepness;
native int16 PainChance; native int16 PainChance;
native name PainType; native name PainType;
native name DeathType; native name DeathType;
@ -312,6 +314,7 @@ class Actor : Thinker native
property MinMissileChance: MinMissileChance; property MinMissileChance: MinMissileChance;
property MaxStepHeight: MaxStepHeight; property MaxStepHeight: MaxStepHeight;
property MaxDropoffHeight: MaxDropoffHeight; property MaxDropoffHeight: MaxDropoffHeight;
property MaxSlopeSteepness: MaxSlopeSteepness;
property PoisonDamageType: PoisonDamageType; property PoisonDamageType: PoisonDamageType;
property RadiusDamageFactor: RadiusDamageFactor; property RadiusDamageFactor: RadiusDamageFactor;
property SelfDamageFactor: SelfDamageFactor; property SelfDamageFactor: SelfDamageFactor;
@ -370,6 +373,7 @@ class Actor : Thinker native
MeleeRange 64 - 20; MeleeRange 64 - 20;
MaxDropoffHeight 24; MaxDropoffHeight 24;
MaxStepHeight 24; MaxStepHeight 24;
MaxSlopeSteepness STEEPSLOPE;
BounceFactor 0.7; BounceFactor 0.7;
WallBounceFactor 0.75; WallBounceFactor 0.75;
BounceCount -1; BounceCount -1;