Skip to content

Commit

Permalink
fix #6133
Browse files Browse the repository at this point in the history
for some reason ZK still relies on a hacky raw-raw move gadget
which should have long been superseded by the engine's native
implementation
  • Loading branch information
rt committed Feb 13, 2019
1 parent 04a00e8 commit 189e95c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 5 additions & 2 deletions rts/Sim/MoveTypes/GroundMoveType.cpp
Expand Up @@ -594,6 +594,7 @@ void CGroundMoveType::StartMovingRaw(const float3 moveGoalPos, float moveGoalRad

useMainHeading = false;
useRawMovement = true;

progressState = Active;

numIdlingUpdates = 0;
Expand Down Expand Up @@ -665,9 +666,11 @@ void CGroundMoveType::StopMoving(bool callScript, bool hardStop, bool cancelRaw)
// StartMoving-->StartEngine will follow
StopEngine(callScript, hardStop);

useMainHeading = false;
// force WantToStop to return true when useRawMovement is enabled
atEndOfPath |= useRawMovement;
// only a new StartMoving call can normally reset this
useRawMovement &= (!cancelRaw);
useMainHeading = false;

progressState = Done;
}
Expand Down Expand Up @@ -725,7 +728,7 @@ bool CGroundMoveType::FollowPath()
}
}

// atEndOfPath never becomes true when useRawMovement
// atEndOfPath never becomes true when useRawMovement, except via StopMoving
if (!atEndOfPath && !useRawMovement) {
SetNextWayPoint();
} else {
Expand Down
14 changes: 7 additions & 7 deletions rts/Sim/MoveTypes/GroundMoveType.h
Expand Up @@ -53,7 +53,7 @@ class CGroundMoveType : public AMoveType
bool OnSlope(float minSlideTolerance);
bool IsReversing() const override { return reversing; }
bool IsPushResistant() const override { return pushResistant; }
bool WantToStop() const { return (pathID == 0 && !useRawMovement); }
bool WantToStop() const { return (pathID == 0 && (!useRawMovement || atEndOfPath)); }

void TriggerSkipWayPoint() {
currWayPoint.y = -1.0f;
Expand Down Expand Up @@ -171,11 +171,11 @@ class CGroundMoveType : public AMoveType
float3 flatFrontDir;
float3 lastAvoidanceDir;
float3 mainHeadingPos;
float3 skidRotVector; /// vector orthogonal to skidDir
float3 skidRotVector; /// vector orthogonal to skidDir

float turnRate = 0.1f; /// maximum angular speed (angular units/frame)
float turnSpeed = 0.0f; /// current angular speed (angular units/frame)
float turnAccel = 0.0f; /// angular acceleration (angular units/frame^2)
float turnRate = 0.1f; /// maximum angular speed (angular units/frame)
float turnSpeed = 0.0f; /// current angular speed (angular units/frame)
float turnAccel = 0.0f; /// angular acceleration (angular units/frame^2)

float accRate = 0.01f;
float decRate = 0.01f;
Expand Down Expand Up @@ -217,8 +217,8 @@ class CGroundMoveType : public AMoveType
bool idling = false;
bool pushResistant = false;
bool canReverse = false;
bool useMainHeading = false; /// if true, turn toward mainHeadingPos until weapons[0] can TryTarget() it
bool useRawMovement = false; /// if true, move towards goal without invoking PFS
bool useMainHeading = false; /// if true, turn toward mainHeadingPos until weapons[0] can TryTarget() it
bool useRawMovement = false; /// if true, move towards goal without invoking PFS (unrelated to MoveDef::allowRawMovement)
};

#endif // GROUNDMOVETYPE_H
Expand Down

0 comments on commit 189e95c

Please sign in to comment.