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:
ChrisL
2009-04-09 15:28:41 +00:00
parent 9a65840def
commit 72174db37c
8 changed files with 52 additions and 39 deletions
+7 -7
View File
@@ -840,13 +840,13 @@ void LoadGameExternalOptions()
gGameExternalOptions.iSuppressionEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_EFFECTIVENESS",100); gGameExternalOptions.iSuppressionEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_EFFECTIVENESS",100);
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given turn (0=unlimited) // HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given turn (0=unlimited)
gGameExternalOptions.iMaxSuppressionAPLossPerTurn = iniReader.ReadInteger("JA2 HAM Settings","MAX_SUPPRESSION_AP_LOSS_PER_TURN",8); gGameExternalOptions.fSuppressionAPLossPerTurn = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_TURN",TRUE);
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given attack (0=unlimited) // HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given attack (0=unlimited)
gGameExternalOptions.iMaxSuppressionAPLossPerAttack = iniReader.ReadInteger("JA2 HAM Settings","MAX_SUPPRESSION_AP_LOSS_PER_ATTACK",8); gGameExternalOptions.fSuppressionAPLossPerAttack = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_ATTACK",TRUE);
// HEADROCK HAM B2: Rigid limit to which a soldier's APs can drop due to suppression fire. (0=unlimited) gGameExternalOptions.iSuppressionToleranceMax = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_TOLERANCE_MAX", 18, 1, 24);
gGameExternalOptions.iMinAPLimitFromSuppression = iniReader.ReadInteger("JA2 HAM Settings","MIN_LIMIT_SUPPRESSION_AP_LOSS",0); gGameExternalOptions.iSuppressionToleranceMin = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_TOLERANCE_MIN", 1, 0, 24);
// HEADROCK HAM B2: Suppression Shock ON/OFF // HEADROCK HAM B2: Suppression Shock ON/OFF
gGameExternalOptions.fSuppressionShock = iniReader.ReadBoolean("JA2 HAM Settings","SUPPRESSION_SHOCK",FALSE); gGameExternalOptions.fSuppressionShock = iniReader.ReadBoolean("JA2 HAM Settings","SUPPRESSION_SHOCK",FALSE);
@@ -860,9 +860,6 @@ void LoadGameExternalOptions()
// HEADROCK HAM B2.3: A "cowering" soldier is twice as susceptible to suppression. // HEADROCK HAM B2.3: A "cowering" soldier is twice as susceptible to suppression.
gGameExternalOptions.iCowerEffectOnSuppression = iniReader.ReadInteger("JA2 HAM Settings","COWER_EFFECT_ON_SUPPRESSION",0); gGameExternalOptions.iCowerEffectOnSuppression = iniReader.ReadInteger("JA2 HAM Settings","COWER_EFFECT_ON_SUPPRESSION",0);
// HEADROCK HAM B2.4: How many APs must be lost due to suppression for every 1 point of morale lost?
gGameExternalOptions.iAPLostPerMoraleDrop = iniReader.ReadInteger("JA2 HAM Settings","AP_LOST_PER_MORALE_DROP",2);
// HEADROCK HAM B2.5: Turn on Realistic Tracers. 0 = off (regular tracers). 1 = Fully realistic tracers. 2 = Tracer Bump + 1.13 Autofire Penalty Reduction // HEADROCK HAM B2.5: Turn on Realistic Tracers. 0 = off (regular tracers). 1 = Fully realistic tracers. 2 = Tracer Bump + 1.13 Autofire Penalty Reduction
gGameExternalOptions.iRealisticTracers = iniReader.ReadInteger("JA2 HAM Settings","REALISTIC_TRACERS",0); gGameExternalOptions.iRealisticTracers = iniReader.ReadInteger("JA2 HAM Settings","REALISTIC_TRACERS",0);
@@ -1068,6 +1065,9 @@ void LoadGameAPBPConstants()
APBPConstants[AP_RELOAD_LOOSE] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_RELOAD_LOOSE",8),8); APBPConstants[AP_RELOAD_LOOSE] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_RELOAD_LOOSE",8),8);
APBPConstants[AP_UNJAM] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_UNJAM",2),2); APBPConstants[AP_UNJAM] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_UNJAM",2),2);
APBPConstants[AP_MAX_SUPPRESSED] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MAX_SUPPRESSED",32),32); APBPConstants[AP_MAX_SUPPRESSED] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MAX_SUPPRESSED",32),32);
APBPConstants[AP_MAX_TURN_SUPPRESSED] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MAX_TURN_SUPPRESSED",100),100);
APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MIN_LIMIT_SUPPRESSION_LOSS",-100),-100);
APBPConstants[AP_LOST_PER_MORALE_DROP] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_LOST_PER_MORALE_DROP",12),12);
APBPConstants[AP_SUPPRESSION_MOD] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_SUPPRESSION_MOD",24),24); APBPConstants[AP_SUPPRESSION_MOD] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_SUPPRESSION_MOD",24),24);
APBPConstants[DEFAULT_APS] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","DEFAULT_APS",80),80); APBPConstants[DEFAULT_APS] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","DEFAULT_APS",80),80);
APBPConstants[DEFAULT_AIMSKILL] = iniReader.ReadInteger("APConstants","DEFAULT_AIMSKILL",80); APBPConstants[DEFAULT_AIMSKILL] = iniReader.ReadInteger("APConstants","DEFAULT_AIMSKILL",80);
+4 -7
View File
@@ -513,13 +513,13 @@ BOOLEAN gbBulletTracer;
INT16 iSuppressionEffectiveness; INT16 iSuppressionEffectiveness;
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given turn (0=unlimited) // HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given turn (0=unlimited)
UINT8 iMaxSuppressionAPLossPerTurn; BOOLEAN fSuppressionAPLossPerTurn;
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given attack (0=unlimited) // HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given attack (0=unlimited)
UINT8 iMaxSuppressionAPLossPerAttack; BOOLEAN fSuppressionAPLossPerAttack;
// HEADROCK HAM B2: Rigid limit to which a soldier's APs can drop due to suppression fire. (0=unlimited) UINT8 iSuppressionToleranceMax;
INT8 iMinAPLimitFromSuppression; UINT8 iSuppressionToleranceMin;
// HEADROCK HAM B2: Suppression Shock ON/OFF // HEADROCK HAM B2: Suppression Shock ON/OFF
BOOLEAN fSuppressionShock; BOOLEAN fSuppressionShock;
@@ -533,9 +533,6 @@ BOOLEAN gbBulletTracer;
// HEADROCK HAM B2.3: It is now possible for "cowering" to increase a target's suppression. // HEADROCK HAM B2.3: It is now possible for "cowering" to increase a target's suppression.
UINT16 iCowerEffectOnSuppression; UINT16 iCowerEffectOnSuppression;
// HEADROCK HAM B2.4: How many APs must be lost due to suppression for every 1 point of morale lost?
UINT8 iAPLostPerMoraleDrop;
// HEADROCK HAM B2.5: Turn on Realistic Tracers. 0 = off (regular tracers). 1 = Fully realistic tracers. 2 = Tracer Bump + 1.13 Autofire Penalty Reduction // HEADROCK HAM B2.5: Turn on Realistic Tracers. 0 = off (regular tracers). 1 = Fully realistic tracers. 2 = Tracer Bump + 1.13 Autofire Penalty Reduction
UINT8 iRealisticTracers; UINT8 iRealisticTracers;
+3
View File
@@ -90,6 +90,9 @@ AP_RELOAD_LOOSE,
AP_UNJAM, AP_UNJAM,
AP_WRONG_MAG, AP_WRONG_MAG,
AP_MAX_SUPPRESSED, AP_MAX_SUPPRESSED,
AP_MAX_TURN_SUPPRESSED,
AP_MIN_LIMIT_SUPPRESSION_LOSS,
AP_LOST_PER_MORALE_DROP,
AP_SUPPRESSION_MOD, AP_SUPPRESSION_MOD,
AUTOFIRE_SHOTS_AP_VALUE, AUTOFIRE_SHOTS_AP_VALUE,
BAD_AP_COST, BAD_AP_COST,
+8
View File
@@ -3423,6 +3423,14 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason)
fRightDown = FALSE; fRightDown = FALSE;
gfItemAmmoDown = 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( guiCurrentItemDescriptionScreen == MAP_SCREEN )
{ {
//if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer, ubStatusIndex ) ) //if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer, ubStatusIndex ) )
+18 -13
View File
@@ -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 ); return( bTolerance );
@@ -7213,9 +7218,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// External options. // External options.
UINT8 MAX_APS_SUPPRESSED = gGameExternalOptions.iMaxSuppressionAPLossPerAttack; BOOLEAN APS_SUPPRESSED = gGameExternalOptions.fSuppressionAPLossPerAttack;
UINT8 MAX_APS_SUPPRESSED_TOTAL = gGameExternalOptions.iMaxSuppressionAPLossPerTurn; BOOLEAN APS_SUPPRESSED_TOTAL = gGameExternalOptions.fSuppressionAPLossPerTurn;
INT8 SUPPRESSION_AP_LIMIT = gGameExternalOptions.iMinAPLimitFromSuppression; //INT8 SUPPRESSION_AP_LIMIT = gGameExternalOptions.iMinAPLimitFromSuppression;
INT8 MAXIMUM_SUPPRESSION_SHOCK = gGameExternalOptions.iMaxSuppressionShock; INT8 MAXIMUM_SUPPRESSION_SHOCK = gGameExternalOptions.iMaxSuppressionShock;
INT8 bTolerance; INT8 bTolerance;
INT16 sClosestOpponent, sClosestOppLoc; INT16 sClosestOpponent, sClosestOppLoc;
@@ -7263,7 +7268,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// cap the # of APs we can lose // cap the # of APs we can lose
// HEADROCK HAM B2: This now reads an external value. 0 means no limit. // 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]) 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, // 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 // Keeps a number for later reference
@@ -7366,9 +7371,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// morale modifier // morale modifier
// For every 2 APs lost, subtract morale by a certain value. // For every 2 APs lost, subtract morale by a certain value.
// HEADROCK: Modified - now externalized to INI. // 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 ); 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")); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: reduce action points"));
// Reduce action points! // Reduce action points!
// HEADROCK HAM Beta 2.2: Enforce a minimum limit via INI. // 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 else
{ {
+5 -5
View File
@@ -1131,7 +1131,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
sAPCost += ((Weapon[ usItemNum ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction(&pSoldier->inv[HANDPOS])) / 100) + 1) / 2; sAPCost += ((Weapon[ usItemNum ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction(&pSoldier->inv[HANDPOS])) / 100) + 1) / 2;
// Add regular aim time for the first 4 aiming actions. // 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 the weapon has a scope, and the target is within eligible range for scope use
if ( IsScoped(&pSoldier->inv[HANDPOS]) if ( IsScoped(&pSoldier->inv[HANDPOS])
@@ -1140,24 +1140,24 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
// Add time to adjust eye to scope // Add time to adjust eye to scope
if (bAimTime > 0) if (bAimTime > 0)
{ {
sAPCost += 1; sAPCost += APBPConstants[AP_CLICK_AIM];
} }
// Add 2 APs for each aiming point between 5 and 6 // Add 2 APs for each aiming point between 5 and 6
if (bAimTime > 4) 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. // Add 3 APs for each aiming point beyond 6.
if (bAimTime > 6) if (bAimTime > 6)
{ {
sAPCost += (bAimTime - 6) * 3; sAPCost += (bAimTime - 6) * APBPConstants[AP_CLICK_AIM] * 3;
} }
} }
} }
} }
else else
{ {
sAPCost += bAimTime; sAPCost += bAimTime * APBPConstants[AP_CLICK_AIM];
} }
} }
} }
+2 -2
View File
@@ -1850,8 +1850,8 @@ INT16 SOLDIERTYPE::CalcActionPoints( void )
// If resulting APs are below our permitted minimum, raise them to it! // 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. // HEADROCK: Enforce new minimums due to suppression. I should've done this neater though.
if (ubPoints < gGameExternalOptions.iMinAPLimitFromSuppression) if (ubPoints < APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS])
ubPoints = gGameExternalOptions.iMinAPLimitFromSuppression; ubPoints = APBPConstants[AP_MIN_LIMIT_SUPPRESSION_LOSS];
// make sure action points doesn't exceed the permitted maximum // make sure action points doesn't exceed the permitted maximum
ubMaxAPs = gubMaxActionPoints[ this->ubBodyType ]; ubMaxAPs = gubMaxActionPoints[ this->ubBodyType ];
+5 -5
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8.00"
Name="ja2_2005Express" Name="ja2_2005Express"
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}" ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
RootNamespace="ja2_2005Express" RootNamespace="ja2_2005Express"
@@ -66,7 +66,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\JA2_v1.13.2660_EN_Debug.exe" OutputFile="$(OutDir)\JA2_v1.13.2695_EN_Debug.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
@@ -145,7 +145,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\JA2_v1.13.2660_RU_Release.exe" OutputFile="$(OutDir)\JA2_v1.13.2695_EN_Release.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -229,7 +229,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\MapEditor_2634_EN_Release.exe" OutputFile="$(OutDir)\MapEditor_2695_EN_Release.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -316,7 +316,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\MapEditor_2634_EN_Debug.exe" OutputFile="$(OutDir)\MapEditor_2695_EN_Debug.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"