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
This commit is contained in:
Wanne
2012-11-01 15:08:04 +00:00
parent 04278c7ad9
commit 3124310a74
4 changed files with 39 additions and 29 deletions
@@ -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;
+13 -11
View File
@@ -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 )
{
+7 -2
View File
@@ -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( );
+17 -15
View File
@@ -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 )
{