mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Adds mouse wheel functionality to AIM member page when hovering mouse over the merc photo and for browsing Bobby Rays inventory pages. If mouse is over an item's big picture, 'ctrl' + mouse wheel will allow adding or removing items from shopping cart (by Asdow).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9283 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -364,6 +364,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber );
|
||||
|
||||
//Hotkey Assignment
|
||||
void HandleBobbyRGunsKeyBoardInput();
|
||||
void HandleBobbyRayMouseWheel(void);
|
||||
|
||||
void GameInitBobbyRGuns()
|
||||
{
|
||||
@@ -447,6 +448,7 @@ void HandleBobbyRGuns()
|
||||
{
|
||||
//Hotkey Assignment
|
||||
HandleBobbyRGunsKeyBoardInput();
|
||||
HandleBobbyRayMouseWheel();
|
||||
}
|
||||
|
||||
void RenderBobbyRGuns()
|
||||
@@ -4027,6 +4029,67 @@ void HandleBobbyRGunsKeyBoardInput()
|
||||
}
|
||||
}
|
||||
|
||||
void HandleBobbyRayMouseWheel(void)
|
||||
{
|
||||
// Purchase and unpurchase via mousewheel if pressing ctrl
|
||||
for (size_t i = 0; i < BOBBYR_NUM_WEAPONS_ON_PAGE; i++)
|
||||
{
|
||||
auto &mouseRegion = gSelectedBigImageRegion[i];
|
||||
auto wheelState = mouseRegion.WheelState * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1);
|
||||
if (mouseRegion.uiFlags & MSYS_MOUSE_IN_AREA)
|
||||
{
|
||||
if (_KeyDown(17)) // CTRL
|
||||
{
|
||||
UINT16 usItemNum = (UINT16)MSYS_GetRegionUserData(&mouseRegion, 0);
|
||||
if (wheelState < 0)
|
||||
{
|
||||
PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[usItemNum], FALSE);
|
||||
}
|
||||
else if (wheelState > 0)
|
||||
{
|
||||
UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[usItemNum], FALSE);
|
||||
}
|
||||
ResetWheelState(&mouseRegion);
|
||||
|
||||
fReDrawScreenFlag = TRUE;
|
||||
fPausedReDrawScreenFlag = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scroll through pages with regular mouse wheel
|
||||
SGPPoint MousePos;
|
||||
GetMousePos(&MousePos);
|
||||
const auto x = MousePos.iX;
|
||||
const auto y = MousePos.iY;
|
||||
if ( (LAPTOP_SCREEN_UL_X < x && x < LAPTOP_SCREEN_LR_X) && (LAPTOP_SCREEN_WEB_UL_Y < y && y < LAPTOP_SCREEN_WEB_LR_Y) )
|
||||
{
|
||||
if (!_KeyDown(17)) // CTRL
|
||||
{
|
||||
const auto Wheelstate = _WheelValue * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1);
|
||||
if (Wheelstate < 0)
|
||||
{
|
||||
if (gubCurPage < gubNumPages - 1)
|
||||
{
|
||||
gubCurPage++;
|
||||
fReDrawScreenFlag = TRUE;
|
||||
fPausedReDrawScreenFlag = TRUE;
|
||||
}
|
||||
}
|
||||
else if (Wheelstate > 0)
|
||||
{
|
||||
if (gubCurPage > 0)
|
||||
{
|
||||
gubCurPage--;
|
||||
fReDrawScreenFlag = TRUE;
|
||||
fPausedReDrawScreenFlag = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
_WheelValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
|
||||
{
|
||||
CHAR16 zItemName[ SIZE_ITEM_NAME ];
|
||||
|
||||
Reference in New Issue
Block a user