Browse Source

Recalculate cursor position after level change

pull/5704/head
obligaron 3 years ago committed by Anders Jenbo
parent
commit
b7e2c649cf
  1. 14
      Source/diablo.cpp
  2. 5
      Source/qol/itemlabels.cpp
  3. 1
      Source/qol/itemlabels.h

14
Source/diablo.cpp

@ -747,8 +747,6 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState)
nthread_ignore_mutex(true);
PaletteFadeOut(8);
sound_stop();
LastMouseButtonAction = MouseActionType::None;
sgbMouseDown = CLICK_NONE;
ShowProgress(GetCustomEvent(event.type));
RedrawEverything();
@ -2923,12 +2921,12 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
CompleteProgress();
// Reset mouse selection of entities
pcursmonst = -1;
ObjectUnderCursor = nullptr;
pcursitem = -1;
pcursinvitem = -1;
pcursplr = -1;
// Recalculate mouse selection of entities after level change/load
LastMouseButtonAction = MouseActionType::None;
sgbMouseDown = CLICK_NONE;
ResetItemlabelHighlighted(); // level changed => item changed
pcursmonst = -1; // ensure pcurstemp is set to a valid value
CheckCursMove();
}
bool game_loop(bool bStartup)

5
Source/qol/itemlabels.cpp

@ -83,6 +83,11 @@ bool IsItemLabelHighlighted()
return isLabelHighlighted;
}
void ResetItemlabelHighlighted()
{
isLabelHighlighted = false;
}
bool IsHighlightingLabelsEnabled()
{
return altPressed != *sgOptions.Gameplay.showItemLabels;

1
Source/qol/itemlabels.h

@ -12,6 +12,7 @@ namespace devilution {
void ToggleItemLabelHighlight();
void AltPressed(bool pressed);
bool IsItemLabelHighlighted();
void ResetItemlabelHighlighted();
bool IsHighlightingLabelsEnabled();
void AddItemToLabelQueue(int id, Point position);
void DrawItemNameLabels(const Surface &out);

Loading…
Cancel
Save