when using alternate weapon holding under NCTH, still apply projection factor from non-scope/sight attachments

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6079 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-05-15 23:04:09 +00:00
parent cefa9cfcc1
commit 1b00117b7e
+11 -7
View File
@@ -12732,12 +12732,12 @@ FLOAT GetProjectionFactor( OBJECTTYPE * pObj )
// Flugente: projection factor while using scope modes excludes those factors coming from not-used scopes and sights
FLOAT GetScopeModeProjectionFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj )
{
if ( !gGameExternalOptions.fScopeModes || !pSoldier || pSoldier->bTeam != gbPlayerNum || !pObj || !pObj->exists() || Item[pObj->usItem].usItemClass != IC_GUN )
return GetProjectionFactor(pObj);
if ( !UsingNewCTHSystem() || pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD )
if ( !UsingNewCTHSystem() || !pObj || !pObj->exists() || Item[pObj->usItem].usItemClass != IC_GUN )
return 1.0;
if ( !gGameExternalOptions.fScopeModes || !pSoldier || pSoldier->bTeam != gbPlayerNum )
return GetProjectionFactor(pObj);
// Flugente: check for scope mode
std::map<INT8, OBJECTTYPE*> ObjList;
GetScopeLists(pObj, ObjList);
@@ -12750,9 +12750,13 @@ FLOAT GetScopeModeProjectionFactor( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj )
{
if (iter->exists())
{
// if attachment is scope/sight and not used, ignore it!
if ( IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) && iter->usItem != ObjList[pSoldier->bScopeMode]->usItem )
continue;
// if attachment is scope/sight...
if ( IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT) )
{
// ignore sight if not using it
if ( pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || iter->usItem != ObjList[pSoldier->bScopeMode]->usItem )
continue;
}
BestFactor = __max(BestFactor, Item[iter->usItem].projectionfactor);
}