mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +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:
+76
-46
@@ -704,6 +704,7 @@ UINT8 GetStatColor( INT8 bStat );
|
||||
|
||||
//Hotkey Assignment
|
||||
void HandleAimMemberKeyBoardInput();
|
||||
void HandleAimMemberMouseInput(void);
|
||||
|
||||
void WaitForMercToFinishTalkingOrUserToClick();
|
||||
|
||||
@@ -1080,7 +1081,7 @@ void HandleAIMMembers()
|
||||
}
|
||||
|
||||
HandleAimMemberKeyBoardInput();
|
||||
|
||||
HandleAimMemberMouseInput();
|
||||
MarkButtonsDirty( );
|
||||
}
|
||||
|
||||
@@ -1757,6 +1758,57 @@ void BtnWeaponboxSelectButtonCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
}
|
||||
|
||||
void PreviousAimMember(void)
|
||||
{
|
||||
InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0);
|
||||
|
||||
if (gbCurrentIndex > 0)
|
||||
{
|
||||
if (_KeyDown(17)) // CTRL
|
||||
gbCurrentIndex = 0;
|
||||
else if (_KeyDown(16)) // SHIFT
|
||||
gbCurrentIndex = __max(gbCurrentIndex - 10, 0);
|
||||
else
|
||||
gbCurrentIndex--;
|
||||
}
|
||||
else
|
||||
gbCurrentIndex = MAX_NUMBER_MERCS - 1;
|
||||
|
||||
gfRedrawScreen = TRUE;
|
||||
|
||||
// gbCurrentSoldier = AimMercArray[gbCurrentIndex];
|
||||
gbCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
|
||||
gbCurrentSoldierBio = gAimAvailability[AimMercArray[gbCurrentIndex]].AimBio;
|
||||
|
||||
gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE;
|
||||
}
|
||||
|
||||
void NextAimMember(void)
|
||||
{
|
||||
InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0);
|
||||
|
||||
if (gbCurrentIndex < MAX_NUMBER_MERCS - 1)
|
||||
{
|
||||
if (_KeyDown(17)) // CTRL
|
||||
gbCurrentIndex = MAX_NUMBER_MERCS - 1;
|
||||
else if (_KeyDown(16)) // SHIFT
|
||||
gbCurrentIndex = __min(MAX_NUMBER_MERCS - 1, gbCurrentIndex + 10);
|
||||
else
|
||||
gbCurrentIndex++;
|
||||
}
|
||||
else
|
||||
gbCurrentIndex = 0;
|
||||
|
||||
// gbCurrentSoldier = AimMercArray[gbCurrentIndex];
|
||||
gbCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
|
||||
|
||||
gbCurrentSoldierBio = gAimAvailability[AimMercArray[gbCurrentIndex]].AimBio;
|
||||
|
||||
gfRedrawScreen = TRUE;
|
||||
|
||||
gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE;
|
||||
}
|
||||
|
||||
void BtnPreviousButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
|
||||
@@ -1772,28 +1824,7 @@ BOOLEAN Stop = FALSE;
|
||||
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0);
|
||||
|
||||
if( gbCurrentIndex > 0)
|
||||
{
|
||||
if (_KeyDown( 17 ) ) // CTRL
|
||||
gbCurrentIndex = 0;
|
||||
else if (_KeyDown( 16 ) ) // SHIFT
|
||||
gbCurrentIndex = __max(gbCurrentIndex - 10, 0);
|
||||
else
|
||||
gbCurrentIndex--;
|
||||
}
|
||||
else
|
||||
gbCurrentIndex = MAX_NUMBER_MERCS - 1;
|
||||
|
||||
gfRedrawScreen = TRUE;
|
||||
|
||||
// gbCurrentSoldier = AimMercArray[gbCurrentIndex];
|
||||
gbCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
|
||||
gbCurrentSoldierBio = gAimAvailability[AimMercArray[gbCurrentIndex]].AimBio;
|
||||
|
||||
gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE;
|
||||
PreviousAimMember();
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
@@ -1854,29 +1885,7 @@ BOOLEAN Stop = FALSE;
|
||||
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0);
|
||||
|
||||
if( gbCurrentIndex < MAX_NUMBER_MERCS - 1 )
|
||||
{
|
||||
if (_KeyDown( 17 ) ) // CTRL
|
||||
gbCurrentIndex = MAX_NUMBER_MERCS - 1;
|
||||
else if (_KeyDown( 16 ) ) // SHIFT
|
||||
gbCurrentIndex = __min(MAX_NUMBER_MERCS - 1, gbCurrentIndex + 10);
|
||||
else
|
||||
gbCurrentIndex++;
|
||||
}
|
||||
else
|
||||
gbCurrentIndex = 0;
|
||||
|
||||
// gbCurrentSoldier = AimMercArray[gbCurrentIndex];
|
||||
gbCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
|
||||
|
||||
gbCurrentSoldierBio = gAimAvailability[AimMercArray[gbCurrentIndex]].AimBio;
|
||||
|
||||
gfRedrawScreen = TRUE;
|
||||
|
||||
gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE;
|
||||
|
||||
NextAimMember();
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
@@ -5215,6 +5224,27 @@ void HandleAimMemberKeyBoardInput()
|
||||
}
|
||||
|
||||
|
||||
void HandleAimMemberMouseInput(void)
|
||||
{
|
||||
gSelectedFaceRegion.WheelState = gSelectedFaceRegion.WheelState * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1);
|
||||
|
||||
if (gSelectedFaceRegion.uiFlags & MSYS_MOUSE_IN_AREA)
|
||||
{
|
||||
if (gSelectedFaceRegion.WheelState != 0)
|
||||
{
|
||||
if (gSelectedFaceRegion.WheelState > 0)
|
||||
{
|
||||
PreviousAimMember();
|
||||
}
|
||||
else
|
||||
{
|
||||
NextAimMember();
|
||||
}
|
||||
ResetWheelState(&gSelectedFaceRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaitForMercToFinishTalkingOrUserToClick()
|
||||
{
|
||||
//if the region is not active
|
||||
|
||||
@@ -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