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
+79 -16
View File
@@ -1605,8 +1605,11 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
/////////////////// PROJECTION FACTOR
if (UsingNewCTHSystem() == true &&
(Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) )
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor but we still need the mouse region
if (UsingNewCTHSystem() == true &&
( (Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) ||
( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) )
{
ubRegionOffset = 6;
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + ubRegionOffset ] );
@@ -2957,7 +2960,29 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
///////////////////// PROJECTION FACTOR
if (GetProjectionFactor( gpItemDescObject ) > 1.0 )
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor
if ( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) )
{
if( UsingNewCTHSystem() == true )
{
if (cnt >= sFirstLine && cnt < sLastLine)
{
if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_WEAPON|IC_PUNCH))
{
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 64 ], szUDBAdvStatsExplanationsTooltipTextForWeapons[ 14 ]);
}
else
{
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 64 ], szUDBAdvStatsExplanationsTooltipText[ 14 ]);
}
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ] );
}
cnt++;
}
}
else if (GetProjectionFactor( gpItemDescObject ) > 1.0 )
{
if( UsingNewCTHSystem() == true )
{
@@ -4100,8 +4125,11 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject )
}
//////////////////// PROJECTION FACTOR
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor but we use the same icon
if (UsingNewCTHSystem() == true &&
(Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) )
( (Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) ||
( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) )
{
ubNumLine = 6;
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 14, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
@@ -4819,8 +4847,11 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
}
///////////////////// PROJECTION FACTOR
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor but we use the same icon
if (cnt-sFirstLine < sLastLine &&
GetProjectionFactor( gpItemDescObject ) > 1.0 )
( GetProjectionFactor( gpItemDescObject ) > 1.0 ||
( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) )
{
if( UsingNewCTHSystem() == true )
{
@@ -6267,21 +6298,40 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
}
///////////////// (LASER) PROJECTION FACTOR
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor
if (UsingNewCTHSystem() == true &&
(Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) )
( (Item[gpItemDescObject->usItem].projectionfactor > 1.0 || GetProjectionFactor( gpItemDescObject ) > 1.0) ||
( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) )
{
// Set line to draw into
ubNumLine = 6;
// Set Y coordinates
sTop = gItemDescGenRegions[ubNumLine][1].sTop;
sHeight = gItemDescGenRegions[ubNumLine][1].sBottom - sTop;
FLOAT iProjectionValue = 0;
FLOAT iProjectionModifier = 0;
FLOAT iFinalProjectionValue = 0;
// Get base Projection value
FLOAT iProjectionValue = __max(1.0f, Item[ gpItemDescObject->usItem ].projectionfactor);
// Get best Projection value
FLOAT iProjectionModifier = GetProjectionFactor( gpItemDescObject );
// Get final Projection value
FLOAT iFinalProjectionValue = __max( iProjectionValue, iProjectionModifier );
if ( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) )
{
// Get base laser range
iProjectionValue = __max(1.0f, Item[ gpItemDescObject->usItem ].bestlaserrange / CELL_X_SIZE);
// Get best laser range
iProjectionModifier = ((FLOAT)GetBestLaserRange( gpItemDescObject ) / CELL_X_SIZE);
// Get final laser range
iFinalProjectionValue = __max( iProjectionValue, iProjectionModifier );
}
else
{
// Get base Projection value
iProjectionValue = __max(1.0f, Item[ gpItemDescObject->usItem ].projectionfactor);
// Get best Projection value
iProjectionModifier = GetProjectionFactor( gpItemDescObject );
// Get final Projection value
iFinalProjectionValue = __max( iProjectionValue, iProjectionModifier );
}
// Print base value
SetFontForeground( 5 );
@@ -9490,11 +9540,21 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
cnt++;
}
BOOLEAN bNewCode = FALSE;
///////////////////// PROJECTION FACTOR
iFloatModifier[0] = GetProjectionFactor( gpItemDescObject );
// with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor
if ( gGameExternalOptions.fUseNewCTHCalculation && GetBestLaserRange( gpItemDescObject ) > 0
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) )
{
iFloatModifier[0] = ((FLOAT)GetBestLaserRange( gpItemDescObject ) / CELL_X_SIZE);
bNewCode = TRUE;
}
else
iFloatModifier[0] = GetProjectionFactor( gpItemDescObject );
iFloatModifier[1] = iFloatModifier[0];
iFloatModifier[2] = iFloatModifier[0];
if (iFloatModifier[0] > 1.0 && UsingNewCTHSystem() == true )
if ( UsingNewCTHSystem() == true && (iFloatModifier[0] > 1.0 || bNewCode) )
{
if (cnt >= sFirstLine && cnt < sLastLine)
{
@@ -9508,10 +9568,13 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
SetFontForeground( 5 );
sLeft = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sLeft;
sWidth = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sRight - sLeft;
if (iFloatModifier[cnt2] > 1.0)
if (iFloatModifier[cnt2] > 1.0 || bNewCode)
{
SetFontForeground( ITEMDESC_FONTPOSITIVE );
swprintf( pStr, L"%3.1fx", iFloatModifier[cnt2] );
if ( bNewCode )
swprintf( pStr, L"%3.0f", iFloatModifier[cnt2] );
else
swprintf( pStr, L"%3.1fx", iFloatModifier[cnt2] );
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY);
}
else