If CAN_FAN_THE_HAMMER is set for Gunslingers in Skills_Settings.ini, they can use burst fire if using revolvers with fBurstOnlyByFanTheHammer set to 1 and burst data set in Weapons.xml if they are in hipfire mode.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8651 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2019-01-24 21:48:44 +00:00
parent 08ed5cf378
commit 61553feb57
23 changed files with 163 additions and 22 deletions
+69 -3
View File
@@ -85,7 +85,7 @@ UINT32 guiItemInfoAdvancedIcon;
UINT32 guiItemInfoWH40KIcon;
// HEADROCK HAM 4: New tooltip regions for UDB replace the old regions.
#define NUM_UDB_FASTHELP_REGIONS 102
#define NUM_UDB_FASTHELP_REGIONS 103
MOUSE_REGION gUDBFasthelpRegions[NUM_UDB_FASTHELP_REGIONS];
extern INV_DESC_STATS gMoneyStats[];
@@ -1476,7 +1476,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
// with the new Laser Performance Bonus we need to display a different text for laser on a weapons general tab
if ( cnt == 6
&& (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) )
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[64], szUDBGenWeaponsStatsExplanationsTooltipText[ cnt ]);
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 64 ], szUDBGenWeaponsStatsExplanationsTooltipText[ cnt ]);
else if ( cnt == 10 && gGameExternalOptions.fAdvRepairSystem && !gSkillTraitValues.fTETraitsCanRestoreItemThreshold )
swprintf( pStr, L"%s%s", szUDBGenWeaponsStatsTooltipText[ cnt ], szUDBGenWeaponsStatsExplanationsTooltipText[ 22 ]);
else
@@ -3232,7 +3232,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
else
{
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 65 ], szUDBAdvStatsExplanationsTooltipText[ 64 ]);
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 65 ], szUDBAdvStatsExplanationsTooltipText[ 65 ]);
}
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ]), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ] );
@@ -4069,6 +4069,21 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
}
///////////////////// FANTHEHAMMER
if ( Item[gpItemDescObject->usItem].usItemClass & ( IC_GUN | IC_LAUNCHER ) && gGameOptions.fNewTraitSystem && gSkillTraitValues.fCanFanTheHammer )
{
if ( !fDrawGenIndexes )
fDrawGenIndexes = ++cnt; // new index line here?
if ( cnt >= sFirstLine && cnt < sLastLine )
{
swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 66 ], szUDBAdvStatsExplanationsTooltipText[ 66 ] );
SetRegionFastHelpText( &( gUDBFasthelpRegions[iFirstDataRegion + ( cnt - sFirstLine )] ), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[iFirstDataRegion + ( cnt - sFirstLine )] );
}
++cnt;
}
if ( UsingFoodSystem() && Item[gpItemDescObject->usItem].foodtype > 0 )
{
if (!fDrawGenIndexes)
@@ -5740,6 +5755,17 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
}
}
///////////////////// FANTHEHAMMER
if ( gGameOptions.fNewTraitSystem && gSkillTraitValues.fCanFanTheHammer &&
( ( Item[gpItemDescObject->usItem].usItemClass & IC_BOBBY_GUN ) || ( fComparisonMode && ( Item[gpComparedItemDescObject->usItem].usItemClass & IC_BOBBY_GUN ) ) ) )
{
if ( cnt >= sFirstLine && cnt < sLastLine )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAdvancedIcon, 65, gItemDescAdvRegions[cnt - sFirstLine][0].sLeft + sOffsetX, gItemDescAdvRegions[cnt - sFirstLine][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
}
++cnt;
}
if ( UsingFoodSystem() )
{
if ( ( Item[gpItemDescObject->usItem].foodtype > 0 ) ||
@@ -14029,6 +14055,46 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
}
}
///////////////////// FANTHEHAMMMER
if ( gGameOptions.fNewTraitSystem && gSkillTraitValues.fCanFanTheHammer &&
( ( Item[gpItemDescObject->usItem].usItemClass & ( IC_GUN | IC_LAUNCHER ) ) || ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & ( IC_GUN | IC_LAUNCHER ) ) ) )
{
if ( !fDrawGenIndexes )
fDrawGenIndexes = ++cnt; //insert Indexes here?
if ( cnt >= sFirstLine && cnt < sLastLine )
{
// Set Y coordinates
sTop = gItemDescAdvRegions[cnt - sFirstLine][1].sTop;
sHeight = gItemDescAdvRegions[cnt - sFirstLine][1].sBottom - sTop;
BOOL a = Weapon[gpItemDescObject->usItem].fBurstOnlyByFanTheHammer;
BOOL b = ( fComparisonMode && Weapon[gpComparedItemDescObject->usItem].fBurstOnlyByFanTheHammer);
SetFontForeground( 5 );
sLeft = gItemDescAdvRegions[cnt - sFirstLine][1].sLeft;
sWidth = gItemDescAdvRegions[cnt - sFirstLine][1].sRight - sLeft;
if ( fComparisonMode )
{
SetFontForeground( a ? ITEMDESC_FONTPOSITIVE : ITEMDESC_FONTNEGATIVE );
swprintf( pStr, L"%s/%s", a ? "Y" : "N", b ? "Y" : "N" );
}
else
{
SetFontForeground( 5 );
swprintf( pStr, L"%s", a ? "Y" : "N" );
}
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY );
mprintf( usX, usY, pStr );
}
++cnt;
}
////////////////////// FOOD
if ( UsingFoodSystem() )
{
+31 -1
View File
@@ -442,7 +442,8 @@ weaponStartElementHandle(void *userData, const XML_Char *name, const XML_Char **
strcmp(name, "usOverheatingJamThreshold") == 0 || // Flugente
strcmp(name, "usOverheatingDamageThreshold") == 0 || // Flugente
strcmp(name, "usOverheatingSingleShotTemperature") == 0 || // Flugente
strcmp(name, "HeavyGun") == 0)) // SANDRO - cannot be shouldered while standing
strcmp(name, "HeavyGun") == 0 || // SANDRO - cannot be shouldered while standing
strcmp(name, "fBurstOnlyByFanTheHammer" ) == 0))
{
pData->curElement = WEAPON_ELEMENT_WEAPON_PROPERY;
@@ -727,6 +728,11 @@ weaponEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = WEAPON_ELEMENT_WEAPON;
pData->curWeapon.HeavyGun = (BOOLEAN) atof(pData->szCharData);
}
else if ( strcmp( name, "fBurstOnlyByFanTheHammer" ) == 0 )
{
pData->curElement = WEAPON_ELEMENT_WEAPON;
pData->curWeapon.fBurstOnlyByFanTheHammer = (BOOLEAN)atof( pData->szCharData );
}
pData->maxReadDepth--;
}
@@ -904,6 +910,7 @@ BOOLEAN WriteWeaponStats()
FilePrintf(hFile,"\t\t<usOverheatingDamageThreshold>%4.2f</usOverheatingDamageThreshold>\r\n", Weapon[cnt].usOverheatingDamageThreshold);
FilePrintf(hFile,"\t\t<usOverheatingSingleShotTemperature>%4.2f</usOverheatingSingleShotTemperature>\r\n", Weapon[cnt].usOverheatingSingleShotTemperature);
FilePrintf(hFile,"\t\t<HeavyGun>%d</HeavyGun>\r\n", Weapon[cnt].HeavyGun);
FilePrintf(hFile,"\t\t<fBurstOnlyByFanTheHammer>%d</fBurstOnlyByFanTheHammer>\r\n", Weapon[cnt].fBurstOnlyByFanTheHammer );
FilePrintf(hFile,"\t</WEAPON>\r\n");
@@ -8914,6 +8921,20 @@ BOOLEAN IsGunBurstCapable(OBJECTTYPE* pObject, BOOLEAN fNotify, SOLDIERTYPE* pSo
if ( GetShotsPerBurst(pObject) > 0 )
{
fCapable = TRUE;
// Flugente: if we only get burst capability by fanning the hammer, check whether we can use that in the first place
if ( gGameOptions.fNewTraitSystem && gSkillTraitValues.fCanFanTheHammer && Weapon[pObject->usItem].fBurstOnlyByFanTheHammer )
{
fCapable = FALSE;
if ( pSoldier &&
pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD &&
NUM_SKILL_TRAITS( pSoldier, GUNSLINGER_NT ) > 0 &&
!pSoldier->inv[SECONDHANDPOS].exists() )
{
fCapable = TRUE;
}
}
}
}
}
@@ -9565,6 +9586,15 @@ void ChangeScopeMode( SOLDIERTYPE * pSoldier, INT32 iTrgGridNo )
pSoldier->aiData.bShownAimTime = 0;
}
// Flugente: test whether the change to scope mode invalidates our firing mode
if ( Weapon[pSoldier->inv[HANDPOS].usItem].fBurstOnlyByFanTheHammer && pSoldier->bWeaponMode == WM_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_UB_BURST )
{
if ( !IsGunWeaponModeCapable( &pSoldier->inv[HANDPOS], static_cast<WeaponMode>( pSoldier->bWeaponMode ), pSoldier ) )
{
ChangeWeaponMode( pSoldier );
}
}
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
gfUIForceReExamineCursorData = TRUE;
}
+5 -1
View File
@@ -382,13 +382,17 @@ typedef struct
UINT8 ubHandling; // CHRISL HAM 4: This value replaces ubReadyTime for determining a weapons base handling characteristics.
// Flugente FTW 1
// Flugente
FLOAT usOverheatingJamThreshold; // if a gun's temperature is above this treshold, it is increasingly prone to jamming
FLOAT usOverheatingDamageThreshold; // if a gun is fired while its temperature is above this value, it degrades much faster
FLOAT usOverheatingSingleShotTemperature; // a single shot raises a gun's temperature by this amount
BOOLEAN HeavyGun; // SANDRO - a gun with this cannot be shouldered in standing position, part of shooting from hip feature
// Flugente: if the wielder possesses the 'GUNSLINGER_NT' trait, is using alternate hold scope mode, and has the second hand free, this gun can be used in burst mode
// this is intended for guns that normally don't possess burst mode, like revolvers
BOOLEAN fBurstOnlyByFanTheHammer;
} WEAPONTYPE;
typedef struct
{