From 27c0d1f8fe2faf52a8f3f8e92858a273bb366b78 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 31 Dec 2021 20:46:44 +0000 Subject: [PATCH] With ALTERNATE_MOUSE_COMMANDS = TRUE, mouse wheel allows to change active interface level. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9224 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Real Time Input.cpp | 6 ++++-- Tactical/Turn Based Input.cpp | 40 ++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 650d71bd4..c47476118 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -148,6 +148,8 @@ extern void HandleTBPickUpBackpacks( void ); extern void HandleTBDropBackpacks( void ); extern void HandleTBLocatePrevMerc( void ); extern void HandleTBLocateNextMerc( void ); +extern void HandleTBLevelDown(void); +extern void HandleTBLevelUp(void); extern void HandleTBSwapGoogles( void ); extern void HandleTBSwapSidearm( void ); extern void HandleTBSwapKnife( void ); @@ -1957,7 +1959,7 @@ void HandleAltMouseRTWheel(void) else if (_KeyDown(SHIFT)) // SHIFT HandleTBCycleThroughVisibleEnemiesBackward(); else - ; + HandleTBLevelUp(); } else // wheel down { @@ -1983,7 +1985,7 @@ void HandleAltMouseRTWheel(void) else if (_KeyDown(SHIFT)) // SHIFT HandleTBCycleThroughVisibleEnemies(); else - ; + HandleTBLevelDown(); } } } diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 6ef82ab5d..bc30f4463 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -336,6 +336,8 @@ void HandleTBGotoHigherStance(void); void HandleTBGotoLowerStance(void); void HandleTBLocateNextMerc( void ); void HandleTBLocatePrevMerc( void ); +void HandleTBLevelDown(void); +void HandleTBLevelUp(void); void HandleTBDropBackpacks( void ); void HandleTBPickUpBackpacks( void ); void HandleTBSoldierRun( void ); @@ -5614,7 +5616,7 @@ void HandleRadioCursorClick(INT32 usMapPos, UINT32 *puiNewEvent) INT32 sMoveSpot = usMapPos; BOOLEAN fClimbingNecessary; INT32 sClimbSpot; - INT32 iPathCost = EstimatePathCostToLocation(pTMilitiaSoldier, sMoveSpot, gsInterfaceLevel, FALSE, &fClimbingNecessary, &sClimbSpot); + INT32 iPathCost = EstimatePathCostToLocation(pTMilitiaSoldier, sMoveSpot, (INT8)gsInterfaceLevel, FALSE, &fClimbingNecessary, &sClimbSpot); // See if we can get there if (iPathCost > 0) @@ -7251,7 +7253,7 @@ void HandleAltMouseTBWheel( void ) else if (_KeyDown(SHIFT)) // SHIFT HandleTBCycleThroughVisibleEnemiesBackward(); else - ; + HandleTBLevelUp(); } else // wheel down { @@ -7277,7 +7279,7 @@ void HandleAltMouseTBWheel( void ) else if (_KeyDown(SHIFT)) // SHIFT HandleTBCycleThroughVisibleEnemies(); else - ; + HandleTBLevelDown(); } } } @@ -8196,6 +8198,38 @@ void HandleTBLocatePrevMerc( void ) } } +void HandleTBLevelDown(void) +{ + if (gsInterfaceLevel > 0 && + gpItemPointer == NULL && + (gsCurInterfacePanel != SM_PANEL || ButtonList[iSMPanelButtons[UPDOWN_BUTTON]]->uiFlags & BUTTON_ENABLED)) + { + UIHandleChangeLevel(NULL); + + if (gsCurInterfacePanel == SM_PANEL) + { + // Remember soldier's new value + gpSMCurrentMerc->bUIInterfaceLevel = (INT8)gsInterfaceLevel; + } + } +} + +void HandleTBLevelUp(void) +{ + if (gsInterfaceLevel == 0 && + gpItemPointer == NULL && + (gsCurInterfacePanel != SM_PANEL || ButtonList[iSMPanelButtons[UPDOWN_BUTTON]]->uiFlags & BUTTON_ENABLED)) + { + UIHandleChangeLevel(NULL); + + if (gsCurInterfacePanel == SM_PANEL) + { + // Remember soldier's new value + gpSMCurrentMerc->bUIInterfaceLevel = (INT8)gsInterfaceLevel; + } + } +} + void HandleTBDropBackpacks( void ) { //if( UsingNewInventorySystem() && gusSelectedSoldier != NOBODY )