From 3124310a74633993b8be9fb5be6eefaa43f62145 Mon Sep 17 00:00:00 2001 From: Wanne Date: Thu, 1 Nov 2012 15:08:04 +0000 Subject: [PATCH] Bugfixes (by Buggler) - Close old description box to open the new one if nothing in hand while right-clicking on an item in sector stack - Ctrl + Right-Click to call info description directly for e first item in stack - Revert partially to have an empty mouse region to close item stack easily when stack is full (r5632) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5657 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- .../Map Screen Interface Map Inventory.cpp | 3 +- Strategic/mapscreen.cpp | 24 +++++++------- Tactical/Interface Items.cpp | 9 ++++-- Tactical/Interface Panels.cpp | 32 ++++++++++--------- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 29d04adf..5b4ea9a6 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -1205,7 +1205,8 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if(ValidAmmoType(twItem->object.usItem, gpItemPointer->usItem) == TRUE) fValidPointer = true; } - if(twItem->object.ubNumberOfObjects == 1 && fValidPointer) + // access description box directly if CTRL is pressed for stack items + if((twItem->object.ubNumberOfObjects == 1 || _KeyDown( CTRL )) && fValidPointer) { fShowInventoryFlag = TRUE; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index ad8d0b6a..ea210186 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9720,17 +9720,9 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) // Check for # of slots in item // CHRISL: Use new ItemSlotLimit function if we're using the new inventory system UINT8 isLimit = ItemSlotLimit(&pSoldier->inv[uiHandPos], uiHandPos, pSoldier); - if ( ( pSoldier->inv[ uiHandPos ].ubNumberOfObjects > 1 ) && ( isLimit > 0 ) ) - { - if ( !InItemStackPopup( ) ) - { - // CHRISL: Changed final parameter so that we fill the inventory screen - InitItemStackPopup( pSoldier, (UINT8)uiHandPos, 0, INV_REGION_Y, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) ); - fTeamPanelDirty=TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; - } - } - else + + // access description box directly if CTRL is pressed for stack items + if (!( ( pSoldier->inv[ uiHandPos ].ubNumberOfObjects > 1 ) && ( isLimit > 0 ) ) || _KeyDown( CTRL ) ) { if ( !InItemDescriptionBox( ) ) { @@ -9751,6 +9743,16 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) } } } + else + { + if ( !InItemStackPopup( ) ) + { + // CHRISL: Changed final parameter so that we fill the inventory screen + InitItemStackPopup( pSoldier, (UINT8)uiHandPos, 0, INV_REGION_Y, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) ); + fTeamPanelDirty=TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index a90436a8..21b9731d 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8994,7 +8994,7 @@ BOOLEAN InitSectorStackPopup( SOLDIERTYPE *pSoldier, WORLDITEM *pInventoryPoolLi aRect.iLeft = sInvX + sOffSetX; aRect.iTop = sInvY + sOffSetY; aRect.iRight = aRect.iLeft + sItemWidth * usPopupWidth; - aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)) * usPopupHeight; + aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)+1) * usPopupHeight; RestrictMouseCursor( &aRect ); @@ -9164,7 +9164,7 @@ BOOLEAN InitItemStackPopup( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sInvX aRect.iLeft = sInvX + xResOffset; aRect.iTop = sInvY + sOffSetY; aRect.iRight = aRect.iLeft + min(cnt,sItemWidth) * usPopupWidth; - aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)) * usPopupHeight; + aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)+1) * usPopupHeight; //aRect.iTop = sInvY; //aRect.iLeft = sInvX; //aRect.iBottom = sInvY + sInvHeight; @@ -9978,6 +9978,11 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) //Remove gfItemPopupRegionCallbackEndFix = TRUE; + // Close old description box when nothing in hand while clicking on an item in sector stack + if ( InItemDescriptionBox( ) && gpItemPointer == NULL && InSectorStackPopup( ) && gpItemPopupObject->ubNumberOfObjects > uiItemPos ) + { + DeleteItemDescriptionBox( ); + } DeleteItemStackPopup( ); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index d15b1f1d..5d575a80 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4046,7 +4046,23 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Check for # of slots in item // CHRISL: Use new ItemSlotLimit function if we're using the new inventory system UINT8 isLimit = ItemSlotLimit( &gpSMCurrentMerc->inv[ uiHandPos ], uiHandPos, gpSMCurrentMerc ); - if( ( gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects > 1 && isLimit > 0 ) && ( guiCurrentScreen != MAP_SCREEN ) ) + + // access description box directly if CTRL is pressed for stack items + if( !( ( gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects > 1 && isLimit > 0 ) && ( guiCurrentScreen != MAP_SCREEN ) ) || _KeyDown( CTRL ) ) + { + if ( !InItemDescriptionBox( ) ) + { + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) + { + EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); + gpItemPointer = &gItemPointer; + gpItemPointerSoldier = gpSMCurrentMerc; + } + else + InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 ); + } + } + else { if ( !InItemStackPopup( ) ) { @@ -4070,20 +4086,6 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } - else - { - if ( !InItemDescriptionBox( ) ) - { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) - { - EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); - gpItemPointer = &gItemPointer; - gpItemPointerSoldier = gpSMCurrentMerc; - } - else - InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 ); - } - } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) {