From 90b77f4c3939f1da10c7a21a182e913ff0e2ec1d Mon Sep 17 00:00:00 2001 From: jak1 Date: Wed, 4 Nov 2020 09:34:16 +0100 Subject: added desync walkaround --- src/being/being.cpp | 6 ++++++ src/being/being.h | 1 + src/defaults.cpp | 1 + src/gui/widgets/checkbox.cpp | 1 + src/gui/widgets/label.cpp | 2 +- src/gui/widgets/tabs/setup_misc.cpp | 12 ++++++++++++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 072d1f30a..b12b00c08 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -140,6 +140,7 @@ bool Being::mEnableReorderSprites = true; bool Being::mHideErased = false; Move Being::mMoveNames = Move_false; bool Being::mUseDiagonal = true; +int Being::mPlayerSpeedAdjustment = 0; BadgeDrawType::Type Being::mShowBadges = BadgeDrawType::Top; int Being::mAwayEffect = -1; VisibleNamePos::Type Being::mVisibleNamePos = VisibleNamePos::Bottom; @@ -1812,6 +1813,9 @@ void Being::nextTile() restrict2 mSpeed = mWalkSpeed; } + if (this == localPlayer) + mSpeed = mSpeed + mPlayerSpeedAdjustment; + if (mX != pos.x || mY != pos.y) { mOldHeight = mMap->getHeightOffset(mX, mY); @@ -3448,6 +3452,8 @@ void Being::reReadConfig() mHideErased = config.getBoolValue("hideErased"); mMoveNames = fromBool(config.getBoolValue("moveNames"), Move); mUseDiagonal = config.getBoolValue("useDiagonalSpeed"); + mPlayerSpeedAdjustment = + serverConfig.getIntValue("playerSpeedAdjustment"); mShowBadges = static_cast( config.getIntValue("showBadges")); mVisibleNamePos = static_cast( diff --git a/src/being/being.h b/src/being/being.h index 0dd0a5743..1431aeab3 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1348,6 +1348,7 @@ class Being notfinal : public ActorSprite, static bool mHideErased; static Move mMoveNames; static bool mUseDiagonal; + static int mPlayerSpeedAdjustment; static BadgeDrawType::Type mShowBadges; static int mAwayEffect; static VisibleNamePos::Type mVisibleNamePos; diff --git a/src/defaults.cpp b/src/defaults.cpp index 91c9e11b3..9cbd478be 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -119,6 +119,7 @@ void setConfigDefaults(Configuration &cfg) AddDEF("syncPlayerMove", true); AddDEF("syncPlayerMoveDistance", 5); AddDEF("syncPlayerMoveDistanceLegacy", 15); + AddDEF("playerSpeedAdjustment", 0); AddDEF("drawPath", false); AddDEF("moveToTargetType", 10); AddDEF("crazyMoveProgram", "mumrsonmdmlon"); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index b01a4e679..c57af2eaa 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -161,6 +161,7 @@ CheckBox::~CheckBox() if (theme != nullptr) theme->unload(mSkin); } + removeMouseListener(this); } void CheckBox::draw(Graphics *const graphics) diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 9dfa7ce4d..d325e11bd 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -144,7 +144,7 @@ void Label::init() mPadding = mSkin->getPadding(); else mPadding = 0; - setSelectable(false); + setSelectable(true); } void Label::draw(Graphics *const graphics) diff --git a/src/gui/widgets/tabs/setup_misc.cpp b/src/gui/widgets/tabs/setup_misc.cpp index 40276a59e..1a04cbd64 100644 --- a/src/gui/widgets/tabs/setup_misc.cpp +++ b/src/gui/widgets/tabs/setup_misc.cpp @@ -272,6 +272,18 @@ Setup_Misc::Setup_Misc(const Widget2 *const widget) : this, "syncPlayerMoveDistanceLegacyEvent", 1, 30, MainConfig_true); + // TRANSLATORS: settings option + new SetupItemIntTextField(_("Increase your effective Walk Delay"), + // TRANSLATORS: settings description + _("Walk slower than your maximum allowed speed.\n" + "This can decrease desync when autonav is used over " + "long distances, and makes it easier for others to " + "autofollow you.\n" + "0 is off, 15~20 is recommended for evol2 servers."), + "playerSpeedAdjustment", + this, "playerSpeedAdjustmentEvent", 0, 100, + MainConfig_false); + // TRANSLATORS: settings option new SetupItemTextField(_("Crazy move A program"), "", "crazyMoveProgram", this, "crazyMoveProgramEvent", -- cgit v1.2.3-70-g09d2