Implements mouse wheel scrolling for switching mercs in strategic map when hovering mouse above teamlist, character inventory and character info panels (by Asdow).

Simplified the r9266 inventory scrolling and made it obey inverted mouse wheel scrolling direction that is in the options screen (by Asdow).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9267 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2022-01-18 22:05:01 +00:00
parent f1ba48f51f
commit abdfd022ae
2 changed files with 34 additions and 50 deletions
+23
View File
@@ -9025,6 +9025,29 @@ void PollWheelInMapView(UINT32 *puiNewEvent)
}
}
// Scroll through mercenaries if the mouse is inside any of these three panels. Couldn't use MOUSE_REGION wheelstates because it would've been messy due to the panels having higher priority mouse regions on top of the larger areas.
// This way there are only three cleanly defined areas to check for.
SGPPoint MousePos;
GetMousePos(&MousePos);
const auto x = MousePos.iX;
const auto y = MousePos.iY;
if (
( (UI_CHARINV.Region.x < x && x < (UI_CHARINV.Region.x + UI_CHARINV.Region.width)) && (UI_CHARINV.Region.y < y && y < (UI_CHARINV.Region.y + UI_CHARINV.Region.height)) ) ||
((UI_CHARPANEL.Region.x < x && x < (UI_CHARPANEL.Region.x + UI_CHARPANEL.Region.width)) && (UI_CHARPANEL.Region.y < y && y < (UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height))) ||
((UI_CHARLIST.Region.x < x && x < (UI_CHARLIST.Region.x + UI_CHARLIST.Region.width)) && (UI_CHARLIST.Region.y < y && y < (UI_CHARLIST.Region.y + UI_CHARLIST.Region.height)))
)
{
const auto Wheelstate = _WheelValue * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1);
if (Wheelstate < 0)
{
GoToNextCharacterInList();
}
else if (Wheelstate > 0)
{
GoToPrevCharacterInList();
}
_WheelValue = 0;
}
}
void PollLeftButtonInMapView( UINT32 *puiNewEvent )