Bugfix: Feature Swap merc faces

When swapping merc faces in tactical the game will now rebuild the mercs squad.

Changed NCTH behaviour for lasers: 

When USE_NEW_CTH_CALCULATION = TRUE in Ja2_Options.ini the game now uses the item property <BestLaserRange> now for a laser specific bonus instead of <ProjectionFactor>. This bonus is a percentage reduction of the base aperture in NCTH. This functionality will only be used if one of the following new parameters in CTHConstants.ini is NOT 0.

LASER_PERFORMANCE_BONUS_HIP
LASER_PERFORMANCE_BONUS_IRON
LASER_PERFORMANCE_BONUS_SCOPE

This functionality also affects the laser property that is displayed in UDB.

Changed NCTH behaviour for Iron Sights and other 1x sights:

Iron sights and other 1x sights can now receive a bonus in NCTH to make them more useful compared to scopes. This bonus is a percentage reduction of the base aperture just like lasers can do.
There is a new parameter in CTHConstants.ini for this:

IRON_SIGHT_PERFORMANCE_BONUS


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6370 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2013-09-07 12:10:45 +00:00
parent 98f9831057
commit 4808850814
20 changed files with 295 additions and 67 deletions
+49 -1
View File
@@ -7530,7 +7530,55 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT
// First, let's calculate the basic Aperture. This is the size of an unmodified aperture at 1x Normal Distance.
iBasicAperture = CalcBasicAperture( );
// when using the reworked NCTH code we do additional calculations for iron sights and lasers
if (gGameExternalOptions.fUseNewCTHCalculation)
{
// iron sights can get a percentage bonus to make them overall better but only when not shooting from hip
if ( gCTHDisplay.ScopeMagFactor <= 1.0 && !pShooter->IsValidAlternativeFireMode( pShooter->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) )
iBasicAperture = iBasicAperture * (FLOAT)( (100 - gGameCTHConstants.IRON_SIGHT_PERFORMANCE_BONUS) / 100);
// laser pointers can provide a percentage bonus to base aperture
if ( gCTHDisplay.iBestLaserRange > 0
&& ( gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) )
{
INT8 bLightLevel = LightTrueLevel(gCTHDisplay.iTargetGridNo, gsInterfaceLevel );
INT32 iMaxLaserRange = ( gCTHDisplay.iBestLaserRange*( 2*bLightLevel + 3*NORMAL_LIGHTLEVEL_NIGHT - 5*NORMAL_LIGHTLEVEL_DAY ) ) / ( 2 * ( NORMAL_LIGHTLEVEL_NIGHT - NORMAL_LIGHTLEVEL_DAY ) );
// laser only has effect when in range
if ( iMaxLaserRange > d2DDistance )
{
FLOAT fLaserBonus = 0;
// which bonus do we want to apply?
if ( pShooter->IsValidAlternativeFireMode( pShooter->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) )
// shooting from hip
fLaserBonus = gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP;
else if ( gCTHDisplay.ScopeMagFactor <= 1.0 )
// using iron sights or other 1x sights
fLaserBonus = gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON;
else
// must be using a scope
fLaserBonus = gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE;
// light level influences how easy it is to spot the laser dot on the target
FLOAT fBrightnessModifier = 1.0 - ( (FLOAT)(bLightLevel - SHADE_MAX) / (FLOAT)(SHADE_MIN - SHADE_MAX) );
// laser fully efficient
if ( gCTHDisplay.iBestLaserRange > d2DDistance )
// apply full bonus
iBasicAperture = iBasicAperture * (FLOAT)( (100 - (fLaserBonus * fBrightnessModifier)) / 100);
else
{
// beyond BestLaserRange laser bonus drops linearly to 0
FLOAT fEffectiveLaserRatio = (FLOAT)(iMaxLaserRange - d2DDistance) / (FLOAT)(iMaxLaserRange - gCTHDisplay.iBestLaserRange);
// apply partial bonus
iBasicAperture = iBasicAperture * (FLOAT)( (100 - (fLaserBonus * fBrightnessModifier * fEffectiveLaserRatio)) / 100);
}
}
}
}
// Next, find out how large the aperture can be around the target, given range. The further the target is, the
// larger the aperture can be.
iDistanceAperture = iBasicAperture * (d2DDistance / gGameCTHConstants.NORMAL_SHOOTING_DISTANCE);