Added new merge type "USE_ITEM_NEW" -> MergeType: 13 (by Sevenfm)

1.) USE_ITEM_NEW
- It creates new items with firstResultingItemIndex and secondResultingItemIndex (if defined) and deducts 1 point from firstItemIndex's status (for each new item).
- When firstItemIndex's status reaches 0, the item is destroyed.
- With this type of merge, you can use knife on tripwire roll, for example, to get 2 new tripwire items. So you can think of tripwire roll as container for 100 tripwires.
 
  <MERGE>
     <firstItemIndex>299</firstItemIndex>
     <secondItemIndex>1640</secondItemIndex>
     <firstResultingItemIndex>1524</firstResultingItemIndex>
     <secondResultingItemIndex>1524</secondResultingItemIndex>
     <mergeType>13</mergeType>
     <APCost>20</APCost>
  </MERGE>

2) USE_ITEM merge creates secondResultingItemIndex item if defined.
- With this secondResultingItemIndex defined, you can use knife on T-Shirt to get 2 rags.

  <MERGE>
     <firstItemIndex>299</firstItemIndex>
     <secondItemIndex>195</secondItemIndex>
     <firstResultingItemIndex>1022</firstResultingItemIndex>
     <secondResultingItemIndex>1022</secondResultingItemIndex>
     <mergeType>6</mergeType>
     <APCost>20</APCost>
   </MERGE>

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6681 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-12-05 08:05:27 +00:00
parent 39f32c2e71
commit 60d9fae2b0
2 changed files with 38 additions and 0 deletions
+1
View File
@@ -1780,6 +1780,7 @@ typedef enum
MECHANICAL_MERGE_EASY,
MECHANICAL_MERGE_HARD,
TRIPWIRE_ROLL,
USE_ITEM_NEW,
} MergeType;
extern UINT16 Merge[MAXITEMS+1][6];
+37
View File
@@ -5020,6 +5020,35 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac
switch( ubType )
{
case USE_ITEM_NEW:
if( (*this)[subObject]->data.objectStatus >0 && usResult != NOTHING)
{
CreateItem( usResult, 100, &gTempObject );
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
(*this)[subObject]->data.objectStatus--;
}
if( (*this)[subObject]->data.objectStatus >0 && usResult2 != NOTHING )
{
CreateItem( usResult2, 100, &gTempObject );
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
(*this)[subObject]->data.objectStatus--;
}
if( (*this)[subObject]->data.objectStatus == 0 )
{
this->RemoveObjectsFromStack(1);
if ( pSoldier && pSoldier->bTeam == gbPlayerNum )
{
pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 );
}
} else
{
if (pSoldier && pSoldier->bTeam == gbPlayerNum)
pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 );
}
ApplyEquipmentBonuses(pSoldier);
return TRUE;
case USE_ITEM:
case USE_ITEM_HARD:
// the merge will combine the two items
@@ -5062,6 +5091,14 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac
// HEADROCK HAM 5: Added argument for statusindex.
ReInitMergedItem(pSoldier, this, usOldItem, 0);
// sevenfm: add usResult2 item if defined
if( usResult2 != NOTHING )
{
CreateItem( usResult2, 100, &gTempObject );
if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) )
AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, 0, 0, -1 );
}
//AutoPlaceObject( pAttachment );
//ADB ubWeight has been removed, see comments in OBJECTTYPE
//this->ubWeight = CalculateObjectWeight( this );