mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
When checking if a gun barrel extender should be damaged and fall off the game will not use item ID GUN_BARREL_EXTENDER anymore because that was tied to item 310.
Instead the game will now use the attachment class AC_EXTENDER. With this we can have more extenders that can be damaged and fall off and also other extenders that are not damaged by shooting. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6438 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1914,6 +1914,19 @@ OBJECTTYPE* FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass, UINT8
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
OBJECTTYPE* FindAttachmentByAttachmentClass( OBJECTTYPE * pObj, UINT32 uiAttachmentClass, UINT8 subObject )
|
||||
{
|
||||
if (pObj->exists() == true) {
|
||||
for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].attachmentclass == uiAttachmentClass && iter->exists())
|
||||
{
|
||||
return &(*iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
INT8 FindLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon )
|
||||
{
|
||||
INT8 bLoop;
|
||||
|
||||
@@ -191,6 +191,7 @@ void SwapOutHandItem( SOLDIERTYPE * pSoldier );
|
||||
void SwapHandItems( SOLDIERTYPE * pSoldier );
|
||||
|
||||
OBJECTTYPE* FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass, UINT8 subObject = 0 );
|
||||
OBJECTTYPE* FindAttachmentByAttachmentClass( OBJECTTYPE * pObj, UINT32 uiAttachmentClass, UINT8 subObject = 0 );
|
||||
void WaterDamage( SOLDIERTYPE *pSoldier );
|
||||
|
||||
INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower = 0, INT8 bUpper = NUM_INV_SLOTS );
|
||||
|
||||
@@ -1938,7 +1938,10 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
|
||||
if ( Item[ usUBItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
// lalien: search for barrel extender not for any item with range bonus. (else barrel extender will fall off even when none is attached)
|
||||
OBJECTTYPE* pAttachment = FindAttachment( pObjHand, GUN_BARREL_EXTENDER );
|
||||
// silversurfer: Instead of searching for one single item we can also search for attachment class "AC_EXTENDER".
|
||||
// With this a barrel extender doesn't need to have item ID 310 anymore.
|
||||
//OBJECTTYPE* pAttachment = FindAttachment( pObjHand, GUN_BARREL_EXTENDER );
|
||||
OBJECTTYPE* pAttachment = FindAttachmentByAttachmentClass( pObjHand, AC_EXTENDER );
|
||||
|
||||
if ( pAttachment )
|
||||
{
|
||||
@@ -2531,7 +2534,10 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
|
||||
if ( Item[ usUBItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
// lalien: search for barrel extender not for any item with range bonus. (else barrel extender will fall off even when none is attached)
|
||||
OBJECTTYPE* pAttachment = FindAttachment( pObjUsed, GUN_BARREL_EXTENDER );
|
||||
// silversurfer: Instead of searching for one single item we can also search for attachment class "AC_EXTENDER".
|
||||
// With this a barrel extender doesn't need to have item ID 310 anymore.
|
||||
//OBJECTTYPE* pAttachment = FindAttachment( pObjUsed, GUN_BARREL_EXTENDER );
|
||||
OBJECTTYPE* pAttachment = FindAttachmentByAttachmentClass( pObjUsed, AC_EXTENDER );
|
||||
|
||||
if ( pAttachment->exists() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user