Browse Source

Accessibility: cursor sync + spell hotkey speech

access
mojsior 2 months ago
parent
commit
2edaaf8454
  1. 22
      Source/diablo.cpp
  2. 30
      Source/panels/spell_list.cpp

22
Source/diablo.cpp

@ -4389,17 +4389,17 @@ void InitPadmapActions()
options.Padmapper.CommitActions();
}
void SetCursorPos(Point position)
{
if (ControlDevice != ControlTypes::KeyboardAndMouse) {
MousePosition = position;
return;
}
LogicalToOutput(&position.x, &position.y);
if (!demo::IsRunning())
SDL_WarpMouseInWindow(ghMainWnd, position.x, position.y);
}
void SetCursorPos(Point position)
{
MousePosition = position;
if (ControlDevice != ControlTypes::KeyboardAndMouse) {
return;
}
LogicalToOutput(&position.x, &position.y);
if (!demo::IsRunning())
SDL_WarpMouseInWindow(ghMainWnd, position.x, position.y);
}
void FreeGameMem()
{

30
Source/panels/spell_list.cpp

@ -15,11 +15,12 @@
#include "options.h"
#include "panels/spell_icons.hpp"
#include "player.h"
#include "spells.h"
#include "utils/algorithm/container.hpp"
#include "utils/language.h"
#include "utils/str_cat.hpp"
#include "utils/utf8.hpp"
#include "spells.h"
#include "utils/algorithm/container.hpp"
#include "utils/language.h"
#include "utils/screen_reader.hpp"
#include "utils/str_cat.hpp"
#include "utils/utf8.hpp"
#define SPLROWICONLS 10
@ -321,15 +322,16 @@ bool IsValidSpeedSpell(size_t slot)
return (spells & GetSpellBitmask(spellId)) != 0;
}
void ToggleSpell(size_t slot)
{
if (IsValidSpeedSpell(slot)) {
Player &myPlayer = *MyPlayer;
myPlayer._pRSpell = myPlayer._pSplHotKey[slot];
myPlayer._pRSplType = myPlayer._pSplTHotKey[slot];
RedrawEverything();
}
}
void ToggleSpell(size_t slot)
{
if (IsValidSpeedSpell(slot)) {
Player &myPlayer = *MyPlayer;
myPlayer._pRSpell = myPlayer._pSplHotKey[slot];
myPlayer._pRSplType = myPlayer._pSplTHotKey[slot];
RedrawEverything();
SpeakText(pgettext("spell", GetSpellData(myPlayer._pRSpell).sNameText), /*force=*/true);
}
}
void DoSpeedBook()
{

Loading…
Cancel
Save