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

5
Source/qol/itemlabels.cpp

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

1
Source/qol/itemlabels.h

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

Loading…
Cancel
Save