Browse Source

Add Shift+E quest entrance navigation

Shift+E now points to the nearest quest set-level entrance on the current level (Poisoned Water, Skeleton King, Chamber of Bone, Lazarus), which is not represented by normal triggers.

Also updates keymapper description and Polish translations.
access
mojsior 2 months ago
parent
commit
b28287a131
  1. 63
      Source/diablo.cpp
  2. 12
      Translations/pl.po

63
Source/diablo.cpp

@ -3371,6 +3371,45 @@ std::optional<Point> FindNearestTownPortalOnCurrentLevel()
return bestPosition;
}
struct QuestSetLevelEntrance {
_setlevels questLevel;
Point entrancePosition;
int distance;
};
std::optional<QuestSetLevelEntrance> FindNearestQuestSetLevelEntranceOnCurrentLevel()
{
if (MyPlayer == nullptr || setlevel)
return std::nullopt;
const Point playerPosition = MyPlayer->position.future;
std::optional<QuestSetLevelEntrance> best;
int bestDistance = 0;
for (const Quest &quest : Quests) {
if (quest._qslvl == SL_NONE)
continue;
if (quest._qactive == QUEST_NOTAVAIL)
continue;
if (quest._qlevel != currlevel)
continue;
if (!InDungeonBounds(quest.position))
continue;
const int distance = playerPosition.WalkingDistance(quest.position);
if (!best || distance < bestDistance) {
best = QuestSetLevelEntrance {
.questLevel = quest._qslvl,
.entrancePosition = quest.position,
.distance = distance,
};
bestDistance = distance;
}
}
return best;
}
void SpeakNearestExitKeyPressed()
{
if (!CanPlayerTakeAction())
@ -3384,6 +3423,28 @@ void SpeakNearestExitKeyPressed()
const Point startPosition = MyPlayer->position.future;
const SDL_Keymod modState = SDL_GetModState();
const bool seekQuestEntrance = (modState & SDL_KMOD_SHIFT) != 0;
if (seekQuestEntrance) {
if (const std::optional<QuestSetLevelEntrance> entrance = FindNearestQuestSetLevelEntranceOnCurrentLevel(); entrance) {
const Point targetPosition = entrance->entrancePosition;
const std::optional<std::vector<int8_t>> path = FindKeyboardWalkPathForSpeech(*MyPlayer, startPosition, targetPosition);
std::string message { _(QuestLevelNames[entrance->questLevel]) };
message.append(": ");
if (!path)
AppendDirectionalFallback(message, targetPosition - startPosition);
else
AppendKeyboardWalkPathForSpeech(message, *path);
SpeakText(message, true);
return;
}
SpeakText(_("No quest entrances found."), true);
return;
}
if (leveltype != DTYPE_TOWN) {
if (const std::optional<Point> portalPosition = FindNearestTownPortalOnCurrentLevel(); portalPosition) {
const std::optional<std::vector<int8_t>> path = FindKeyboardWalkPathForSpeech(*MyPlayer, startPosition, *portalPosition);
@ -3993,7 +4054,7 @@ void InitKeymapActions()
options.Keymapper.AddAction(
"SpeakNearestExit",
N_("Nearest exit"),
N_("Speaks the nearest exit."),
N_("Speaks the nearest exit. Hold Shift for quest entrances."),
'E',
SpeakNearestExitKeyPressed,
nullptr,

12
Translations/pl.po

@ -12030,6 +12030,10 @@ msgstr "Najpierw zamknij mapę."
msgid "No exits found."
msgstr "Nie znaleziono wyjść."
#: Source/diablo.cpp
msgid "No quest entrances found."
msgstr "Nie znaleziono wejść questowych."
#: Source/diablo.cpp
msgid "Not in town."
msgstr "Nie jesteś w mieście."
@ -12050,6 +12054,14 @@ msgstr "Najbliższe schody w górę"
msgid "Speaks directions to the nearest stairs up."
msgstr "Podaje wskazówki dojścia do najbliższych schodów w górę."
#: Source/diablo.cpp
msgid "Nearest exit"
msgstr "Najbliższe wyjście"
#: Source/diablo.cpp
msgid "Speaks the nearest exit. Hold Shift for quest entrances."
msgstr "Podaje wskazówki dojścia do najbliższego wyjścia. Przytrzymaj Shift, aby namierzyć wejścia questowe."
#: Source/diablo.cpp
msgid "Nearest exit: "
msgstr "Najbliższe wyjście: "

Loading…
Cancel
Save