- New Feature: Block iron sights (by Flugente)

o if a gun/attachment has the boolean tag <BlockIronSight> in Items.xml, a gun's iron sights wont be selectable while selecting scope modes.
o if using dual weapons, only iron sights can be used
o new attachmentclass: AC_IRONSIGHT (4194304) for attachable iron sights (display on gun is different from reflex sights, no other differences... yet)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5291 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-05-20 17:18:28 +00:00
parent eb2ca0ba70
commit 93ea315502
7 changed files with 145 additions and 40 deletions
+22 -1
View File
@@ -6350,7 +6350,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
attachmentList::iterator iter_end = (*&(pSoldier->inv[pSoldier->ubAttackingHand]))[0]->attachments.end();
for(attachmentList::iterator iter = (*&(pSoldier->inv[pSoldier->ubAttackingHand]))[0]->attachments.begin(); iter != iter_end; ++iter)
{
if(iter->exists() && !IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT ) && Item[iter->usItem].aimbonus >= gGameExternalOptions.sHighPowerScope && iRange > Item[iter->usItem].minrangeforaimbonus)
if(iter->exists() && !IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) && Item[iter->usItem].aimbonus >= gGameExternalOptions.sHighPowerScope && iRange > Item[iter->usItem].minrangeforaimbonus)
{
iPenalty = (Item[iter->usItem].aimbonus * (iRange - Item[iter->usItem].minrangeforaimbonus)) / 1000;
iPenalty = min(AIM_BONUS_PRONE, iPenalty);
@@ -10212,6 +10212,27 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv
pSoldier->bScopeMode = USE_BEST_SCOPE;
}
}
// Flugente: if we are using dual weapons, only allow iron sights (we can't look through two scopes simultaneously, can we?)
if ( uiInvPos == HANDPOS || uiInvPos == SECONDHANDPOS )
{
if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_WEAPON) && (Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass & IC_WEAPON) )
{
std::map<INT8, OBJECTTYPE*> ObjList;
GetScopeLists(&pSoldier->inv[ HANDPOS ], ObjList);
std::map<INT8, OBJECTTYPE*>::iterator itend = ObjList.end();
for (std::map<INT8, OBJECTTYPE*>::iterator it = ObjList.begin(); it != itend; ++it)
{
if ( (*it).second != NULL )
{
pSoldier->bScopeMode = (*it).first;
}
else
break;
}
}
}
}