mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- NCTH Scope Modes Update (by silversurfer)
o Updated formula to get better results with different scopes o 10x scopes are still useless on "normal" maps. Could be better on bigmaps (70+ tiles) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6165 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+6
-28
@@ -12650,33 +12650,8 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
||||
else
|
||||
CurrentFactor = 1.0f;
|
||||
|
||||
// Actual Scope Mag Factor is what we get at the distance the target's at.
|
||||
ActualCurrentFactor = __min(CurrentFactor, (TargetMagFactor/rangeModifier));
|
||||
|
||||
// using NCTH system?
|
||||
if ( pObj->exists() == true && UsingNewCTHSystem() == true )
|
||||
{
|
||||
if (ActualCurrentFactor >= CurrentFactor)
|
||||
{
|
||||
// This scope gives no penalty. Record this as the best factor found.
|
||||
BestFactor = CurrentFactor;
|
||||
iBestTotalPenalty = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This scope gives a penalty for shooting under its range.
|
||||
FLOAT dScopePenaltyRatio = (CurrentFactor * rangeModifier / TargetMagFactor);
|
||||
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
||||
|
||||
BestFactor = CurrentFactor;
|
||||
iBestTotalPenalty = iScopePenalty;
|
||||
}
|
||||
}
|
||||
|
||||
if(iBestTotalPenalty < 0 && iProjectionFactor > 1.0f)
|
||||
BestFactor = 1.0f;
|
||||
|
||||
return( __max(1.0f, BestFactor) );
|
||||
// with scope modes we just return the scope factor of the selected optics
|
||||
return( __max(1.0f, CurrentFactor) );
|
||||
}
|
||||
// if not using scope modes find the best scope
|
||||
else
|
||||
@@ -12744,7 +12719,10 @@ FLOAT GetBestScopeMagnificationFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj,
|
||||
INT32 iScopePenalty = (INT32)((dScopePenaltyRatio * gGameCTHConstants.AIM_TOO_CLOSE_SCOPE) * (CurrentFactor / 2));
|
||||
|
||||
// Is this scope any better than the ones we've already processed?
|
||||
if (iScopePenalty > iBestTotalPenalty)
|
||||
// this new formula takes gaps between different scopes into account because
|
||||
// even with a penalty a higher power scope is not necessarily a bad choice
|
||||
// 10x sniper scopes still suck though, at the moment they are useless because of the big penalty
|
||||
if (dScopePenaltyRatio <= CurrentFactor / (( CurrentFactor + BestFactor ) /2 -1 ) && CurrentFactor > BestFactor)
|
||||
{
|
||||
// This is the best scope we've found so far. Record it.
|
||||
BestFactor = CurrentFactor;
|
||||
|
||||
Reference in New Issue
Block a user