From 5957af60aaca9466dc727bb7326e1e347c54e38d Mon Sep 17 00:00:00 2001 From: Wanne Date: Fri, 19 Oct 2012 08:33:11 +0000 Subject: [PATCH] - Bugfixes (by Buggler) o Fixed Restrict Mouse Region for Stack Popup Screen. Also a Dirty CTD fix for illegal Holster/Backpack pickup in Strategic Key Panel Popup o Fixed Item Transfer Exploit in Stack Popup Screen/Item in Hand during Combat mode by using hotkeys to select other mercs in Strategic & Tactical Interface o Corrected Numerator & Denominator Order for Armor Protection Raw Values in Popup Info text git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5632 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface.cpp | 6 ++++++ Strategic/mapscreen.cpp | 6 ++++++ Tactical/Interface Items.cpp | 18 +++++++++--------- Tactical/Interface Panels.cpp | 12 ++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 770174ff..da8dad25 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -2342,6 +2342,12 @@ BOOLEAN ValidSelectableCharForNextOrPrev( INT32 iNewCharSlot ) { BOOLEAN fHoldingItem = FALSE; + // not in popup + if ( InItemStackPopup( ) || InSectorStackPopup( ) || InKeyRingPopup( ) ) + { + return( FALSE ); + } + // if holding an item if ( ( gMPanelRegion.Cursor == EXTERN_CURSOR ) || gpItemPointer || fMapInventoryItem ) { diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 3dd26fbb..ddf78bfd 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -16106,6 +16106,12 @@ void ChangeCharacterListSortMethod( INT32 iValue ) return; } + // not in popup or item in hand + if( InItemStackPopup( ) || InSectorStackPopup( ) || InKeyRingPopup( ) || gpItemPointer != NULL ) + { + return; + } + if( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) ) { AbortMovementPlottingMode( ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 11d5b056..a90436a8 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8990,11 +8990,11 @@ BOOLEAN InitSectorStackPopup( SOLDIERTYPE *pSoldier, WORLDITEM *pInventoryPoolLi gfInSectorStackPopup = TRUE; fShowInventoryFlag = TRUE; - //Reserict mouse cursor to panel + //Restrict mouse cursor to panel aRect.iLeft = sInvX + sOffSetX; aRect.iTop = sInvY + sOffSetY; aRect.iRight = aRect.iLeft + sItemWidth * usPopupWidth; - aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)+1) * usPopupHeight; + aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)) * usPopupHeight; RestrictMouseCursor( &aRect ); @@ -9160,11 +9160,11 @@ BOOLEAN InitItemStackPopup( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sInvX gfInItemStackPopup = TRUE; - //Reserict mouse cursor to panel + //Restrict mouse cursor to panel aRect.iLeft = sInvX + xResOffset; aRect.iTop = sInvY + sOffSetY; - aRect.iRight = aRect.iLeft + sItemWidth * usPopupWidth; - aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)+1) * usPopupHeight; + aRect.iRight = aRect.iLeft + min(cnt,sItemWidth) * usPopupWidth; + aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sItemWidth)) * usPopupHeight; //aRect.iTop = sInvY; //aRect.iLeft = sInvX; //aRect.iBottom = sInvY + sInvHeight; @@ -9469,11 +9469,11 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 gfInKeyRingPopup = TRUE; - //Reserict mouse cursor to panel + //Restrict mouse cursor to panel aRect.iLeft = gsKeyRingPopupInvX + sOffSetX; aRect.iTop = sInvY + sOffSetY; aRect.iRight = aRect.iLeft + sKeyRingItemWidth * usPopupWidth; - aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sKeyRingItemWidth)+1) * usPopupHeight; + aRect.iBottom = aRect.iTop + (INT32)(ceil((float)cnt/(float)sKeyRingItemWidth)) * usPopupHeight; RestrictMouseCursor( &aRect ); @@ -11961,8 +11961,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier sThreshold, //repair threshold pInvPanelTitleStrings[ 4 ], //Protection string iProtection, //Protection rating in % based on best armor - Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) pInvPanelTitleStrings[ 3 ], //Camo string GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus gWeaponStatsDesc[ 12 ], //Weight string @@ -11982,8 +11982,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier sValue, //Item condition pInvPanelTitleStrings[ 4 ], //Protection string iProtection, //Protection rating in % based on best armor - Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) pInvPanelTitleStrings[ 3 ], //Camo string GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus gWeaponStatsDesc[ 12 ], //Weight string diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index c6585ae0..d15b1f1d 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -736,6 +736,18 @@ void SetSMPanelCurrentMerc( UINT8 ubNewID ) DeleteItemDescriptionBox( ); } + // Remove stack popup panel if one up.... + if ( InItemStackPopup( ) || InSectorStackPopup( ) ) + { + DeleteItemStackPopup( ); + } + + // Remove keyring popup panel if one up.... + if ( InKeyRingPopup( ) ) + { + DeleteKeyRingPopup( ); + } + if ( gfInItemPickupMenu ) { gfSMDisableForItems = TRUE;