diff options
-rw-r--r-- | src/actions/actions.cpp | 6 | ||||
-rw-r--r-- | src/actions/statusbar.cpp | 5 | ||||
-rw-r--r-- | src/actions/statusbar.h | 1 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/enums/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/gamemodifiers.cpp | 12 | ||||
-rw-r--r-- | src/gamemodifiers.h | 1 | ||||
-rw-r--r-- | src/gui/popups/statuspopup.cpp | 3 | ||||
-rw-r--r-- | src/gui/popups/statuspopup.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_quick.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 3 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/input/pages/basic.cpp | 6 | ||||
-rw-r--r-- | src/settings.h | 2 |
14 files changed, 48 insertions, 5 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index a8d21367e..a4520543c 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -807,12 +807,12 @@ impHandler(targetAttack) target = nullptr; } } - if (!target) + + if (!target && !settings.targetingType) target = localPlayer->getTarget(); - // A set target has highest priority + if (!target) { - // Only auto target Monsters target = actorManager->findNearestLivingBeing( localPlayer, 90, ActorType::Monster, AllowSort_true); } diff --git a/src/actions/statusbar.cpp b/src/actions/statusbar.cpp index 971bfd0f6..331275ba3 100644 --- a/src/actions/statusbar.cpp +++ b/src/actions/statusbar.cpp @@ -80,6 +80,11 @@ impHandler0(changeAttackType) callYellowBar(changeAttackType); } +impHandler0(changeTargetingType) +{ + callYellowBar(changeTargetingType); +} + impHandler0(changeFollowMode) { callYellowBar(changeFollowMode); diff --git a/src/actions/statusbar.h b/src/actions/statusbar.h index 3802a255b..fc304c873 100644 --- a/src/actions/statusbar.h +++ b/src/actions/statusbar.h @@ -33,6 +33,7 @@ namespace Actions decHandler(changeMoveType); decHandler(changeAttackWeaponType); decHandler(changeAttackType); + decHandler(changeTargetingType); decHandler(changeFollowMode); decHandler(changeImitationMode); decHandler(changeMagicAttackType); diff --git a/src/defaults.cpp b/src/defaults.cpp index 43f3c57eb..6c6bf412a 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -97,6 +97,7 @@ DefaultsData* getConfigDefaults() AddDEF("pickUpType", 3); AddDEF("magicAttackType", 0); AddDEF("attackType", 2); + AddDEF("targetingType", 0); AddDEF("followMode", 0); AddDEF("imitationMode", 0); AddDEF("syncPlayerMove", false); diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 5032ca2b6..8a991896b 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -602,6 +602,7 @@ enumStart(InputAction) SERVER_CONF_SET, CONG_GET, SERVER_CONG_GET, + CHANGE_TARGETING_TYPE, TOTAL } enumEnd(InputAction); diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index ba0bdaab6..e55c4060f 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -87,6 +87,7 @@ void GameModifiers::init() settings.followMode = config.getIntValue("followMode"); settings.attackWeaponType = config.getIntValue("attackWeaponType"); settings.attackType = config.getIntValue("attackType"); + settings.targetingType = config.getIntValue("targetingType"); settings.quickDropCounter = config.getIntValue("quickDropCounter"); settings.pickUpType = config.getIntValue("pickUpType"); settings.magicAttackType = config.getIntValue("magicAttackType"); @@ -269,6 +270,16 @@ addModifier2(AttackType, attackType, "attackType", 4, N_("(?) attack") }) +addModifier2(TargetingType, targetingType, "targetingType", 2, +{ + // TRANSLATORS: targeting type in status bar + N_("(D) don't switch target"), + // TRANSLATORS: targeting type in status bar + N_("(C) always attack closest"), + // TRANSLATORS: targeting type in status bar + N_("(?) targeting") +}) + const unsigned GameModifiers::mQuickDropCounterSize = 31; changeMethod(QuickDropCounter, quickDropCounter, "quickDropCounter") @@ -490,6 +501,7 @@ void GameModifiers::resetModifiers() settings.pvpAttackType = config.resetIntValue("pvpAttackType"); settings.quickDropCounter = config.resetIntValue("quickDropCounter"); settings.pickUpType = config.resetIntValue("pickUpType"); + settings.targetingType = config.resetIntValue("targetingType"); settings.mapDrawType = MapType::NORMAL; if (viewport) { diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h index cc9503987..5b84dc932 100644 --- a/src/gamemodifiers.h +++ b/src/gamemodifiers.h @@ -52,6 +52,7 @@ class GameModifiers final declModifier(FollowMode) declModifier(AttackWeaponType) declModifier(AttackType) + declModifier(TargetingType) declModifier(QuickDropCounter) declModifier(PickUpType) declModifier(MagicAttackType) diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp index c54a57874..b81e3fe1e 100644 --- a/src/gui/popups/statuspopup.cpp +++ b/src/gui/popups/statuspopup.cpp @@ -75,6 +75,7 @@ void StatusPopup::postInit() addLabel(12); addLabel(13); addLabel(14); + addLabel(15); y += 4; addLabel(11); } @@ -164,4 +165,6 @@ void StatusPopup::updateLabels() const InputAction::AWAY); setLabelText(14, GameModifiers::getCameraModeString(), InputAction::CAMERA); + setLabelText(15, GameModifiers::getTargetingTypeString(), + InputAction::CHANGE_TARGETING_TYPE); } diff --git a/src/gui/popups/statuspopup.h b/src/gui/popups/statuspopup.h index 43b793821..ed39c3ab6 100644 --- a/src/gui/popups/statuspopup.h +++ b/src/gui/popups/statuspopup.h @@ -30,7 +30,7 @@ class Label; -const int STATUSPOPUP_NUM_LABELS = 15; +const int STATUSPOPUP_NUM_LABELS = 16; /** * A popup that displays information about an item. diff --git a/src/gui/widgets/tabs/setup_quick.cpp b/src/gui/widgets/tabs/setup_quick.cpp index a85fdc0ca..e9199aa45 100644 --- a/src/gui/widgets/tabs/setup_quick.cpp +++ b/src/gui/widgets/tabs/setup_quick.cpp @@ -104,6 +104,10 @@ Setup_Quick::Setup_Quick(const Widget2 *const widget) : &GameModifiers::getAwayModeString, &GameModifiers::changeAwayMode); + new SetupQuickItem("", this, "targetingTypeEvent", + &GameModifiers::getTargetingTypeString, + &GameModifiers::changeTargetingType); + setDimension(Rect(0, 0, 550, 350)); } diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 5f8df4ef7..ea73c46b5 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -671,7 +671,8 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar, .append(" ").append(translateLetter2( GameModifiers::getImitationModeString())) .append(translateLetter2(GameModifiers::getCameraModeString())) - .append(translateLetter2(GameModifiers::getAwayModeString()))); + .append(translateLetter2(GameModifiers::getAwayModeString())) + .append(translateLetter2(GameModifiers::getTargetingTypeString()))); bar->setProgress(50); if (settings.disableGameModifiers) diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index b96a187f8..9c00f0557 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4490,6 +4490,12 @@ static const InputActionData inputActionData InputCondition::INGAME, "servconfget|getservconf", UseArgs_true}, + {"keyChangeTargetingType", + defaultAction(&Actions::changeTargetingType), + InputCondition::GAME | InputCondition::VALIDSPEED + | InputCondition::EMODS, + "", + UseArgs_false}, }; #undef defaultAction diff --git a/src/input/pages/basic.cpp b/src/input/pages/basic.cpp index c87ac56d9..d304098e6 100644 --- a/src/input/pages/basic.cpp +++ b/src/input/pages/basic.cpp @@ -133,6 +133,12 @@ SetupActionData setupActionDataBasic[] = }, { // TRANSLATORS: input action name + N_("Change targeting type"), + InputAction::CHANGE_TARGETING_TYPE, + "", + }, + { + // TRANSLATORS: input action name N_("Target pet"), InputAction::TARGET_PET, "", diff --git a/src/settings.h b/src/settings.h index bb5e0a67b..6d3476438 100644 --- a/src/settings.h +++ b/src/settings.h @@ -66,6 +66,7 @@ class Settings final imitationMode(0U), cameraMode(0U), crazyMoveState(0U), + targetingType(0U), mapDrawType(MapType::NORMAL), persistentIp(true), limitFps(false), @@ -111,6 +112,7 @@ class Settings final unsigned int imitationMode; unsigned int cameraMode; unsigned int crazyMoveState; + unsigned int targetingType; MapTypeT mapDrawType; bool persistentIp; bool limitFps; |