mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
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:
@@ -213,7 +213,6 @@ UINT32 uiNumberOfUnSeenItems = 0;
|
||||
//MOUSE_REGION MapInventoryPoolSlots[ MAP_INVENTORY_POOL_SLOT_COUNT ];
|
||||
MOUSE_REGION MapInventoryPoolSlots[ MAP_INVENTORY_POOL_MAX_SLOTS ];
|
||||
MOUSE_REGION MapInventoryPoolMask;
|
||||
MOUSE_REGION MapInventoryPageScrollArea;
|
||||
// HEADROCK HAM 5: This rectangle describes the inventory. It is used to limit cursor movement while waiting for zoom input.
|
||||
SGPRect MapInventoryRect;
|
||||
|
||||
@@ -925,14 +924,6 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen )
|
||||
// create buttons
|
||||
CreateMapInventoryButtons( );
|
||||
|
||||
// Create mouseregion for page scroll
|
||||
MSYS_DefineRegion(
|
||||
&MapInventoryPageScrollArea,
|
||||
UI_MAP.BorderRegion.x, UI_MAP.BorderRegion.y,
|
||||
UI_MAP.BorderRegion.x + UI_MAP.BorderRegion.width, UI_MAP.BorderRegion.y + UI_MAP.BorderRegion.height,
|
||||
MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK
|
||||
);
|
||||
|
||||
// Flugente: certain features need to alter an item's temperature value depending on the time passed
|
||||
// if we do these functions here and adjust for the time passed since this sector was loaded last, it will seem to the player
|
||||
// as if these checks are always performed in any sector
|
||||
@@ -985,8 +976,6 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen )
|
||||
|
||||
DestroyInventoryPoolDoneButton( );
|
||||
|
||||
MSYS_RemoveRegion(&MapInventoryPageScrollArea);
|
||||
|
||||
// HEADROCK HAM 5: Destroy big item graphics.
|
||||
if (fMapInventoryZoom)
|
||||
{
|
||||
@@ -6318,53 +6307,25 @@ void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::v
|
||||
}
|
||||
|
||||
|
||||
void ResetMapInventoryWheelStates(void)
|
||||
{
|
||||
MapInventoryPageScrollArea.WheelState = 0;
|
||||
for (UINT32 i = 0; i < MAP_INVENTORY_POOL_SLOT_COUNT; i++)
|
||||
{
|
||||
MapInventoryPoolSlots[i].WheelState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleMousePageScroll(void)
|
||||
{
|
||||
boolean scroll = false;
|
||||
if (MapInventoryPageScrollArea.WheelState > 0)
|
||||
SGPPoint MousePos;
|
||||
GetMousePos(&MousePos);
|
||||
const auto x = MousePos.iX;
|
||||
const auto y = MousePos.iY;
|
||||
if ( (UI_MAP.BorderRegion.x < x && x < (UI_MAP.BorderRegion.x + UI_MAP.BorderRegion.width)) && (UI_MAP.BorderRegion.y < y && y < (UI_MAP.BorderRegion.y + UI_MAP.BorderRegion.height)) )
|
||||
{
|
||||
scroll = true;
|
||||
}
|
||||
for (UINT32 i = 0; i < MAP_INVENTORY_POOL_SLOT_COUNT; i++)
|
||||
{
|
||||
if (MapInventoryPoolSlots[i].WheelState > 0)
|
||||
const auto Wheelstate = _WheelValue * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1);
|
||||
if (Wheelstate < 0)
|
||||
{
|
||||
scroll = true;
|
||||
break;
|
||||
MapInvNextPage();
|
||||
}
|
||||
}
|
||||
if (scroll == true)
|
||||
{
|
||||
MapInvPreviousPage();
|
||||
ResetMapInventoryWheelStates();
|
||||
return;
|
||||
}
|
||||
|
||||
if (MapInventoryPageScrollArea.WheelState < 0)
|
||||
{
|
||||
scroll = true;
|
||||
}
|
||||
for (UINT32 i = 0; i < MAP_INVENTORY_POOL_SLOT_COUNT; i++)
|
||||
{
|
||||
if (MapInventoryPoolSlots[i].WheelState < 0)
|
||||
else if (Wheelstate > 0)
|
||||
{
|
||||
scroll = true;
|
||||
break;
|
||||
MapInvPreviousPage();
|
||||
}
|
||||
}
|
||||
if (scroll == true)
|
||||
{
|
||||
MapInvNextPage();
|
||||
ResetMapInventoryWheelStates();
|
||||
_WheelValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user