From 33b3707381297536da645cbf44ce4783b511f9b4 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Mon, 16 Jun 2014 16:47:35 +0000 Subject: [PATCH] Bugfix: UDB display/color coding of handling, armor piercing and their respective comparison feature was wrong. Also enabled display of maximum counter force modifier for other items than guns. Bugfix: Calculation of maximum counter force modifier was wrong. Stance based bonus was applied to gun and each of its attachments. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7275 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Enhanced.cpp | 22 +++++++++++----------- Tactical/Items.cpp | 17 +++++++++++------ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 4d885239..5798f84e 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -3259,7 +3259,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr || GetObjectModifier( gpItemDescSoldier, gpItemDescObject, ANIM_CROUCH, ITEMMODIFIER_COUNTERFORCEMAX ) != 0 || GetObjectModifier( gpItemDescSoldier, gpItemDescObject, ANIM_PRONE, ITEMMODIFIER_COUNTERFORCEMAX ) != 0 ) { - if( UsingNewCTHSystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) + if( UsingNewCTHSystem() == true ) //&& Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) { if (cnt >= sFirstLine && cnt < sLastLine) { @@ -5344,7 +5344,7 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject ) || GetObjectModifier( gpItemDescSoldier, gpComparedItemDescObject, ANIM_CROUCH, ITEMMODIFIER_COUNTERFORCEMAX ) != 0 || GetObjectModifier( gpItemDescSoldier, gpComparedItemDescObject, ANIM_PRONE, ITEMMODIFIER_COUNTERFORCEMAX ) != 0 ) ) ) { - if( UsingNewCTHSystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) + if( UsingNewCTHSystem() == true ) //&& Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) { if (cnt >= sFirstLine && cnt < sLastLine) { @@ -6865,7 +6865,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print base value DrawPropertyValueInColour( iHandlingValue, ubNumLine, 1, fComparisonMode, FALSE, TRUE ); // Print modifier - DrawPropertyValueInColour( iHandlingModifier, ubNumLine, 2, fComparisonMode, TRUE, TRUE ); + DrawPropertyValueInColour( iHandlingModifier, ubNumLine, 2, fComparisonMode, TRUE, FALSE ); // Print final value DrawPropertyValueInColour( iFinalHandlingValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE, FONT_MCOLOR_WHITE ); } @@ -6883,11 +6883,11 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Get Final Gun Handling value UINT16 iComparedFinalHandlingValue = iComparedHandlingValue + iComparedHandlingModifier; // Print difference in base value - DrawPropertyValueInColour( iComparedHandlingValue - iHandlingValue, ubNumLine, 1, fComparisonMode, FALSE, TRUE ); + DrawPropertyValueInColour( iComparedHandlingValue - iHandlingValue, ubNumLine, 1, fComparisonMode, FALSE, FALSE ); // Print difference in modifier - DrawPropertyValueInColour( iComparedHandlingModifier - iHandlingModifier, ubNumLine, 2, fComparisonMode, TRUE, TRUE ); + DrawPropertyValueInColour( iComparedHandlingModifier - iHandlingModifier, ubNumLine, 2, fComparisonMode, TRUE, FALSE ); // Print difference in final value - DrawPropertyValueInColour( iComparedFinalHandlingValue - iFinalHandlingValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE ); + DrawPropertyValueInColour( iComparedFinalHandlingValue - iFinalHandlingValue, ubNumLine, 3, fComparisonMode, FALSE, FALSE ); } } else if( fComparisonMode && UsingNewCTHSystem() == TRUE && @@ -8726,7 +8726,7 @@ void DrawAmmoValues( OBJECTTYPE * gpItemDescObject, int shotsLeft ) if( !fComparisonMode ) { // Print base value - DrawPropertyValueInColourFloat( fArmourImpactReduction, ubNumLine, 1, fComparisonMode, FALSE, TRUE, 0, 1.0f, 2 ); + DrawPropertyValueInColourFloat( fArmourImpactReduction, ubNumLine, 1, fComparisonMode, FALSE, FALSE, 0, 1.0f, 2 ); // Print modifier DrawPropertyTextInColour( L"--", ubNumLine, 2 ); // Print final value @@ -8774,11 +8774,11 @@ void DrawAmmoValues( OBJECTTYPE * gpItemDescObject, int shotsLeft ) // Get base Tumbling FLOAT fComparedFinalAfterArmourImpactReduction = fComparedAfterArmourImpactReduction; // Print difference in base value - DrawPropertyValueInColourFloat( fComparedAfterArmourImpactReduction - fAfterArmourImpactReduction, ubNumLine, 1, fComparisonMode, FALSE, FALSE, 0, 0.0f, 2 ); + DrawPropertyValueInColourFloat( fComparedAfterArmourImpactReduction - fAfterArmourImpactReduction, ubNumLine, 1, fComparisonMode, FALSE, TRUE, 0, 0.0f, 2 ); // Print difference in modifier DrawPropertyTextInColour( L"=", ubNumLine, 2 ); // Print difference in final value - DrawPropertyValueInColourFloat( fComparedFinalAfterArmourImpactReduction - fFinalAfterArmourImpactReduction, ubNumLine, 3, fComparisonMode, FALSE, FALSE, 0, 0.0f, 2 ); + DrawPropertyValueInColourFloat( fComparedFinalAfterArmourImpactReduction - fFinalAfterArmourImpactReduction, ubNumLine, 3, fComparisonMode, FALSE, TRUE, 0, 0.0f, 2 ); } } @@ -11248,8 +11248,8 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) iComparedModifier[1] = GetObjectModifier( gpItemDescSoldier, gpComparedItemDescObject, ANIM_CROUCH, ITEMMODIFIER_COUNTERFORCEMAX ); iComparedModifier[2] = GetObjectModifier( gpItemDescSoldier, gpComparedItemDescObject, ANIM_PRONE, ITEMMODIFIER_COUNTERFORCEMAX ); } - if ( ((iModifier[0] != 0 || iModifier[1] != 0 || iModifier[2] != 0) && UsingNewCTHSystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) || - ( fComparisonMode && (iComparedModifier[0] != 0 || iComparedModifier[1] != 0 || iComparedModifier[2] != 0) && UsingNewCTHSystem() == true && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN ) ) + if ( ((iModifier[0] != 0 || iModifier[1] != 0 || iModifier[2] != 0) && UsingNewCTHSystem() == true /*&& Item[gpItemDescObject->usItem].usItemClass == IC_GUN*/ ) || + ( fComparisonMode && (iComparedModifier[0] != 0 || iComparedModifier[1] != 0 || iComparedModifier[2] != 0) && UsingNewCTHSystem() == true /*&& Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN*/ ) ) { if (cnt >= sFirstLine && cnt < sLastLine) { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 7772bee3..9b0386da 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -10241,12 +10241,6 @@ INT32 GetItemModifier(OBJECTTYPE* pObj, UINT8 ubRef, UINT8 usType) break; case ITEMMODIFIER_COUNTERFORCEMAX: iModifier += BonusReduceMore( Item[pObj->usItem].maxcounterforcemodifier[ubRef], (*pObj)[0]->data.objectStatus ); - - if(ubRef == 1) - iModifier += (INT32)gGameCTHConstants.RECOIL_MAX_COUNTER_CROUCH; - else if (ubRef == 2) - iModifier += (INT32)gGameCTHConstants.RECOIL_MAX_COUNTER_PRONE; - break; case ITEMMODIFIER_COUNTERFORCEACCURACY: iModifier += BonusReduceMore( Item[pObj->usItem].counterforceaccuracymodifier[ubRef], (*pObj)[0]->data.objectStatus ); @@ -10281,6 +10275,17 @@ INT32 GetObjectModifier( SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, UINT8 ubStance // simply add the object modifier iModifier += GetItemModifier( pObj, ubRef, usType); + // silversurfer: add stance based max counter force modifier here and not in function GetItemModifier() because + // that function is called for everything including attachments multiple times giving an insane bonus to max counter force modifier. + // An attachment that provides such bonus is not affected by this change. This stance based modifier only applies to guns. + if( usType == ITEMMODIFIER_COUNTERFORCEMAX && Item[pObj->usItem].usItemClass & IC_GUN ) + { + if(ubRef == 1) + iModifier += (INT32)gGameCTHConstants.RECOIL_MAX_COUNTER_CROUCH; + else if (ubRef == 2) + iModifier += (INT32)gGameCTHConstants.RECOIL_MAX_COUNTER_PRONE; + } + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { if( iter->exists() )