Added helper functions to easier determine gun stats

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9158 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2021-08-27 20:48:19 +00:00
parent 99142603cb
commit a93e9b4a9c
4 changed files with 75 additions and 25 deletions
+30
View File
@@ -15832,3 +15832,33 @@ BOOLEAN CanDelayGrenadeExplosion( UINT16 usItem )
return TRUE;
}
FLOAT GetBestScopeMagFactorForGun(UINT16 ausItemGun)
{
FLOAT bestscopemagfactor = 1.0f;
for ( UINT16 usItem = 1; usItem < gMAXITEMS_READ; ++usItem )
{
if ( ValidAttachment( usItem, ausItemGun ) )
{
if ( bestscopemagfactor < Item[usItem].scopemagfactor )
bestscopemagfactor = Item[usItem].scopemagfactor;
}
}
return bestscopemagfactor;
}
bool HasScopeMagFactorForGun( UINT16 ausItemGun, FLOAT aFactor )
{
for ( UINT16 usItem = 1; usItem < gMAXITEMS_READ; ++usItem )
{
if ( ValidAttachment( usItem, ausItemGun ) )
{
if ( std::fabs( Item[usItem].scopemagfactor - aFactor ) < 0.1 )
return true;
}
}
return false;
}