mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Updates to the HAM/100AP integration.
Added Min/Max Suppression Tolerance values (from Headrock). Bugfix: Took away the ability to reload a weapon from the item description box while using an ammo crate. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2695 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3423,6 +3423,14 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
fRightDown = FALSE;
|
||||
gfItemAmmoDown = FALSE;
|
||||
|
||||
//CHRISL: We dont' want to be able to reload guns using the ammo crate from this function
|
||||
if(gpItemPointer != NULL && Item[gpItemPointer->usItem].ammocrate)
|
||||
{
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
return;
|
||||
}
|
||||
|
||||
if( guiCurrentItemDescriptionScreen == MAP_SCREEN )
|
||||
{
|
||||
//if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer, ubStatusIndex ) )
|
||||
|
||||
+18
-13
@@ -7196,9 +7196,14 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
if (bTolerance < 0)
|
||||
if (bTolerance < gGameExternalOptions.iSuppressionToleranceMin)
|
||||
{
|
||||
bTolerance = 0;
|
||||
bTolerance = gGameExternalOptions.iSuppressionToleranceMin;
|
||||
}
|
||||
|
||||
if (bTolerance > gGameExternalOptions.iSuppressionToleranceMax)
|
||||
{
|
||||
bTolerance = gGameExternalOptions.iSuppressionToleranceMax;
|
||||
}
|
||||
|
||||
return( bTolerance );
|
||||
@@ -7213,9 +7218,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// External options.
|
||||
UINT8 MAX_APS_SUPPRESSED = gGameExternalOptions.iMaxSuppressionAPLossPerAttack;
|
||||
UINT8 MAX_APS_SUPPRESSED_TOTAL = gGameExternalOptions.iMaxSuppressionAPLossPerTurn;
|
||||
INT8 SUPPRESSION_AP_LIMIT = gGameExternalOptions.iMinAPLimitFromSuppression;
|
||||
BOOLEAN APS_SUPPRESSED = gGameExternalOptions.fSuppressionAPLossPerAttack;
|
||||
BOOLEAN APS_SUPPRESSED_TOTAL = gGameExternalOptions.fSuppressionAPLossPerTurn;
|
||||
//INT8 SUPPRESSION_AP_LIMIT = gGameExternalOptions.iMinAPLimitFromSuppression;
|
||||
INT8 MAXIMUM_SUPPRESSION_SHOCK = gGameExternalOptions.iMaxSuppressionShock;
|
||||
INT8 bTolerance;
|
||||
INT16 sClosestOpponent, sClosestOppLoc;
|
||||
@@ -7263,7 +7268,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
|
||||
// cap the # of APs we can lose
|
||||
// HEADROCK HAM B2: This now reads an external value. 0 means no limit.
|
||||
if (MAX_APS_SUPPRESSED > 0)
|
||||
if (APS_SUPPRESSED == TRUE)
|
||||
{
|
||||
if (ubPointsLost > APBPConstants[AP_MAX_SUPPRESSED])
|
||||
{
|
||||
@@ -7272,11 +7277,11 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
}
|
||||
|
||||
// HEADROCK HAM B2: This makes sure that we never lose more APs than we're allowed per turn,
|
||||
if (MAX_APS_SUPPRESSED_TOTAL > 0)
|
||||
if (APS_SUPPRESSED_TOTAL = TRUE)
|
||||
{
|
||||
if (pSoldier->ubAPsLostToSuppression + ubPointsLost > MAX_APS_SUPPRESSED_TOTAL)
|
||||
if (pSoldier->ubAPsLostToSuppression + ubPointsLost > APBPConstants[AP_MAX_SUPPRESSED])
|
||||
{
|
||||
ubPointsLost = MAX_APS_SUPPRESSED_TOTAL - pSoldier->ubAPsLostToSuppression;
|
||||
ubPointsLost = APBPConstants[AP_MAX_SUPPRESSED] - pSoldier->ubAPsLostToSuppression;
|
||||
}
|
||||
}
|
||||
// Keeps a number for later reference
|
||||
@@ -7366,9 +7371,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
// morale modifier
|
||||
// For every 2 APs lost, subtract morale by a certain value.
|
||||
// HEADROCK: Modified - now externalized to INI.
|
||||
if (gGameExternalOptions.iAPLostPerMoraleDrop > 0 && ubPointsLost > 0)
|
||||
if (APBPConstants[AP_LOST_PER_MORALE_DROP] > 0 && ubPointsLost > 0)
|
||||
{
|
||||
for ( ubLoop2 = 0; ubLoop2 < (ubPointsLost / gGameExternalOptions.iAPLostPerMoraleDrop); ubLoop2++ )
|
||||
for ( ubLoop2 = 0; ubLoop2 < (ubPointsLost / APBPConstants[AP_LOST_PER_MORALE_DROP]); ubLoop2++ )
|
||||
{
|
||||
HandleMoraleEvent( pSoldier, MORALE_SUPPRESSED, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
|
||||
}
|
||||
@@ -7451,9 +7456,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: reduce action points"));
|
||||
// Reduce action points!
|
||||
// HEADROCK HAM Beta 2.2: Enforce a minimum limit via INI.
|
||||
if (pSoldier->bActionPoints - ubPointsLost < gGameExternalOptions.iMinAPLimitFromSuppression )
|
||||
if (pSoldier->bActionPoints - ubPointsLost < APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS] )
|
||||
{
|
||||
pSoldier->bActionPoints = gGameExternalOptions.iMinAPLimitFromSuppression;
|
||||
pSoldier->bActionPoints = APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+5
-5
@@ -1131,7 +1131,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
|
||||
sAPCost += ((Weapon[ usItemNum ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction(&pSoldier->inv[HANDPOS])) / 100) + 1) / 2;
|
||||
|
||||
// Add regular aim time for the first 4 aiming actions.
|
||||
sAPCost += __min(bAimTime,4);
|
||||
sAPCost += __min((bAimTime*APBPConstants[AP_CLICK_AIM]),(4*APBPConstants[AP_CLICK_AIM]));
|
||||
|
||||
// If the weapon has a scope, and the target is within eligible range for scope use
|
||||
if ( IsScoped(&pSoldier->inv[HANDPOS])
|
||||
@@ -1140,24 +1140,24 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
|
||||
// Add time to adjust eye to scope
|
||||
if (bAimTime > 0)
|
||||
{
|
||||
sAPCost += 1;
|
||||
sAPCost += APBPConstants[AP_CLICK_AIM];
|
||||
}
|
||||
// Add 2 APs for each aiming point between 5 and 6
|
||||
if (bAimTime > 4)
|
||||
{
|
||||
sAPCost += __min(((bAimTime - 4) * 2), 4);
|
||||
sAPCost += __min(((bAimTime - 4) * APBPConstants[AP_CLICK_AIM] * 2), (4*APBPConstants[AP_CLICK_AIM]));
|
||||
}
|
||||
// Add 3 APs for each aiming point beyond 6.
|
||||
if (bAimTime > 6)
|
||||
{
|
||||
sAPCost += (bAimTime - 6) * 3;
|
||||
sAPCost += (bAimTime - 6) * APBPConstants[AP_CLICK_AIM] * 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sAPCost += bAimTime;
|
||||
sAPCost += bAimTime * APBPConstants[AP_CLICK_AIM];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1850,8 +1850,8 @@ INT16 SOLDIERTYPE::CalcActionPoints( void )
|
||||
|
||||
// If resulting APs are below our permitted minimum, raise them to it!
|
||||
// HEADROCK: Enforce new minimums due to suppression. I should've done this neater though.
|
||||
if (ubPoints < gGameExternalOptions.iMinAPLimitFromSuppression)
|
||||
ubPoints = gGameExternalOptions.iMinAPLimitFromSuppression;
|
||||
if (ubPoints < APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS])
|
||||
ubPoints = APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS];
|
||||
|
||||
// make sure action points doesn't exceed the permitted maximum
|
||||
ubMaxAPs = gubMaxActionPoints[ this->ubBodyType ];
|
||||
|
||||
Reference in New Issue
Block a user