Skip to content

Commit

Permalink
fix: un-hardcode max strafe speed
Browse files Browse the repository at this point in the history
and instead tie to `sv_maxvelocity`.
using the cvar in the constructor won't work, so i changed it to current instead (to remove a nonsensical 10000, constructor value isn't used anyway)
  • Loading branch information
ThisAMJ committed Jul 25, 2023
1 parent ab5d038 commit d939054
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Features/Tas/TasTools/StrafeTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ void AutoStrafeTool::FollowLine(const TasPlayerInfo &pInfo) {

std::shared_ptr<TasToolParams> AutoStrafeTool::ParseParams(std::vector<std::string> vp) {
AutoStrafeType type = VECTORIAL;
AutoStrafeDirection dir{CURRENT, false, 0};
AutoStrafeSpeed speed = {SPECIFIED, 10000.0f};
AutoStrafeDirection dir = {CURRENT, false, 0};
float maxSpeed = Variable("sv_maxvelocity").GetFloat() * 1.5f;
AutoStrafeSpeed speed = {SPECIFIED, maxSpeed};
bool noPitchLock = false;
bool antiSpeedLock = true;

Expand All @@ -466,7 +467,7 @@ std::shared_ptr<TasToolParams> AutoStrafeTool::ParseParams(std::vector<std::stri
//speed
else if (param == "max") {
speed.type = SPECIFIED;
speed.speed = 10000.0f; // as long as it's higher than max speed times square root of 2, we should be fine?
speed.speed = maxSpeed; // as long as it's higher than max speed times square root of 2, we should be fine?
} else if (param == "keep") {
speed.type = CURRENT;
} else if (param.size() > 3 && param.substr(param.size() - 3, 3) == "ups") {
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Tas/TasTools/StrafeTool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AutoStrafeSpeed {
struct AutoStrafeParams : public TasToolParams {
AutoStrafeType strafeType = DISABLED;
AutoStrafeDirection strafeDir = {CURRENT, true, 0.0f};
AutoStrafeSpeed strafeSpeed = {SPECIFIED, 10000.0f};
AutoStrafeSpeed strafeSpeed = {CURRENT};
bool noPitchLock = false;
bool antiSpeedLock = true;

Expand Down

0 comments on commit d939054

Please sign in to comment.