mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
New modifier for NCTH to alter the behaviour of the scope penalty:
- AIM_TOO_CLOSE_THRESHOLD = 0.8 This defines the point within scope range where the penalty starts. http://www.ja-galaxy-forum.com/ubbthreads.php/topics/334158/Re:_(Potential)_NCTH_Code_Chan#Post334158 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7328 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3367,6 +3367,7 @@ void LoadCTHConstants()
|
|||||||
gGameCTHConstants.AIM_DEX = iniReader.ReadFloat("Aiming CTH","AIM_DEX",2.0, 0.0, 100.0);
|
gGameCTHConstants.AIM_DEX = iniReader.ReadFloat("Aiming CTH","AIM_DEX",2.0, 0.0, 100.0);
|
||||||
|
|
||||||
gGameCTHConstants.AIM_TOO_CLOSE_SCOPE = iniReader.ReadFloat("Aiming CTH","AIM_TOO_CLOSE_SCOPE",-4.0, -1000.0, 0.0);
|
gGameCTHConstants.AIM_TOO_CLOSE_SCOPE = iniReader.ReadFloat("Aiming CTH","AIM_TOO_CLOSE_SCOPE",-4.0, -1000.0, 0.0);
|
||||||
|
gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD = iniReader.ReadFloat("Aiming CTH","AIM_TOO_CLOSE_THRESHOLD",1.0, 0.0, 1.0);
|
||||||
gGameCTHConstants.AIM_GUN_CONDITION = iniReader.ReadFloat("Aiming CTH","AIM_GUN_CONDITION",-2.0, -1000.0, 1000.0);
|
gGameCTHConstants.AIM_GUN_CONDITION = iniReader.ReadFloat("Aiming CTH","AIM_GUN_CONDITION",-2.0, -1000.0, 1000.0);
|
||||||
gGameCTHConstants.AIM_LOW_MORALE = iniReader.ReadFloat("Aiming CTH","AIM_LOW_MORALE",-2.0, -1000.0, 1000.0);
|
gGameCTHConstants.AIM_LOW_MORALE = iniReader.ReadFloat("Aiming CTH","AIM_LOW_MORALE",-2.0, -1000.0, 1000.0);
|
||||||
gGameCTHConstants.AIM_HIGH_MORALE = iniReader.ReadFloat("Aiming CTH","AIM_HIGH_MORALE",1.0, -1000.0, 1000.0);
|
gGameCTHConstants.AIM_HIGH_MORALE = iniReader.ReadFloat("Aiming CTH","AIM_HIGH_MORALE",1.0, -1000.0, 1000.0);
|
||||||
|
|||||||
@@ -1981,6 +1981,7 @@ typedef struct
|
|||||||
FLOAT AIM_DEX; // Importance of Dexterity for AIMING CTH
|
FLOAT AIM_DEX; // Importance of Dexterity for AIMING CTH
|
||||||
|
|
||||||
FLOAT AIM_TOO_CLOSE_SCOPE; // Applied per tile closer than the scope's minimum range.
|
FLOAT AIM_TOO_CLOSE_SCOPE; // Applied per tile closer than the scope's minimum range.
|
||||||
|
FLOAT AIM_TOO_CLOSE_THRESHOLD; // Affects at what point AIM_TOO_CLOSE_SCOPE kicks in (0.0 to 1.0).
|
||||||
FLOAT AIM_GUN_CONDITION; // Applied per point of condition below 50.
|
FLOAT AIM_GUN_CONDITION; // Applied per point of condition below 50.
|
||||||
FLOAT AIM_LOW_MORALE; // Applied gradually when morale is below 50.
|
FLOAT AIM_LOW_MORALE; // Applied gradually when morale is below 50.
|
||||||
FLOAT AIM_HIGH_MORALE; // Applied gradually when morale is above 50.
|
FLOAT AIM_HIGH_MORALE; // Applied gradually when morale is above 50.
|
||||||
|
|||||||
+4
-4
@@ -12863,7 +12863,7 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
|||||||
// Actual Scope Mag Factor is what we get at the distance the target's at.
|
// Actual Scope Mag Factor is what we get at the distance the target's at.
|
||||||
ActualCurrentFactor = __min(CurrentFactor, (TargetMagFactor/rangeModifier));
|
ActualCurrentFactor = __min(CurrentFactor, (TargetMagFactor/rangeModifier));
|
||||||
|
|
||||||
if (ActualCurrentFactor >= CurrentFactor)
|
if (ActualCurrentFactor >= CurrentFactor * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD)
|
||||||
{
|
{
|
||||||
// This scope gives no penalty. Record this as the best factor found so far.
|
// This scope gives no penalty. Record this as the best factor found so far.
|
||||||
BestFactor = CurrentFactor;
|
BestFactor = CurrentFactor;
|
||||||
@@ -12872,7 +12872,7 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This scopes gives a penalty for shooting under its range.
|
// This scopes gives a penalty for shooting under its range.
|
||||||
FLOAT dScopePenaltyRatio = (CurrentFactor * rangeModifier / TargetMagFactor);
|
FLOAT dScopePenaltyRatio = (CurrentFactor * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD * rangeModifier / TargetMagFactor);
|
||||||
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
||||||
|
|
||||||
// There's no previous scope to compare with so record this as the best factor for now.
|
// There's no previous scope to compare with so record this as the best factor for now.
|
||||||
@@ -12893,7 +12893,7 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
|||||||
// Actual Scope Mag Factor is what we get at the distance the target's at.
|
// Actual Scope Mag Factor is what we get at the distance the target's at.
|
||||||
ActualCurrentFactor = __min(CurrentFactor, (TargetMagFactor/rangeModifier));
|
ActualCurrentFactor = __min(CurrentFactor, (TargetMagFactor/rangeModifier));
|
||||||
|
|
||||||
if (ActualCurrentFactor >= CurrentFactor)
|
if (ActualCurrentFactor >= CurrentFactor * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD)
|
||||||
{
|
{
|
||||||
// This scope gives no penalty. Is it any better than the ones we've already processed?
|
// This scope gives no penalty. Is it any better than the ones we've already processed?
|
||||||
if (iBestTotalPenalty <= 0 && CurrentFactor > BestFactor)
|
if (iBestTotalPenalty <= 0 && CurrentFactor > BestFactor)
|
||||||
@@ -12906,7 +12906,7 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This scope will give a penalty if used. Is it worth using compared to other scopes found?
|
// This scope will give a penalty if used. Is it worth using compared to other scopes found?
|
||||||
FLOAT dScopePenaltyRatio = (CurrentFactor * rangeModifier / TargetMagFactor);
|
FLOAT dScopePenaltyRatio = (CurrentFactor * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD * rangeModifier / TargetMagFactor);
|
||||||
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
||||||
|
|
||||||
// Is this scope any better than the ones we've already processed?
|
// Is this scope any better than the ones we've already processed?
|
||||||
|
|||||||
@@ -5466,10 +5466,10 @@ if (gGameExternalOptions.fUseNewCTHCalculation)
|
|||||||
// factor in scopes under their range
|
// factor in scopes under their range
|
||||||
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
||||||
{
|
{
|
||||||
if (fScopeMagFactor > 1.0 && iRange < (INT32)uiBestScopeRange)
|
if (fScopeMagFactor > 1.0 && iRange < (INT32)(uiBestScopeRange * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD))
|
||||||
{
|
{
|
||||||
// Calculate how much penalty this scope should give at this range
|
// Calculate how much penalty this scope should give at this range
|
||||||
FLOAT dScopePenaltyRatio = ((FLOAT)uiBestScopeRange / (FLOAT)iRange);
|
FLOAT dScopePenaltyRatio = ((FLOAT)uiBestScopeRange * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD / (FLOAT)iRange);
|
||||||
FLOAT iScopePenalty = (FLOAT)(dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE * (fScopeMagFactor /2));
|
FLOAT iScopePenalty = (FLOAT)(dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE * (fScopeMagFactor /2));
|
||||||
fAimModifier += iScopePenalty;
|
fAimModifier += iScopePenalty;
|
||||||
}
|
}
|
||||||
@@ -6322,10 +6322,10 @@ else
|
|||||||
// factor in scopes under their range
|
// factor in scopes under their range
|
||||||
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
||||||
{
|
{
|
||||||
if (iScopeMagFactor > 1.0 && iRange < (INT32)uiBestScopeRange)
|
if (iScopeMagFactor > 1.0 && iRange < (INT32)(uiBestScopeRange * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD))
|
||||||
{
|
{
|
||||||
// Calculate how much penalty this scope should give at this range
|
// Calculate how much penalty this scope should give at this range
|
||||||
FLOAT dScopePenaltyRatio = ((FLOAT)uiBestScopeRange / (FLOAT)iRange);
|
FLOAT dScopePenaltyRatio = ((FLOAT)uiBestScopeRange * gGameCTHConstants.AIM_TOO_CLOSE_THRESHOLD / (FLOAT)iRange);
|
||||||
INT32 iScopePenalty = (INT32)(dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE * (iScopeMagFactor /2));
|
INT32 iScopePenalty = (INT32)(dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE * (iScopeMagFactor /2));
|
||||||
iMaxAimBonus += iScopePenalty;
|
iMaxAimBonus += iScopePenalty;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user