From ff2aa4f8e16ecbf0bcfc31aeb45d6aa52f392c45 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Sat, 17 Feb 2007 06:13:52 +0000 Subject: [PATCH] -increased inventory capacity for IMP items doled out in ImpItemChoices.xml -changed ammo given to IMPs so they have at least two clips for their main gun git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@718 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/IMP Confirm.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index ac21fe3d0..64124fa87 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -128,7 +128,7 @@ void DestroyConfirmButtons( void ); void GiveItemsToPC( UINT8 ubProfileId ); void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany); void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany); -INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem); +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany); // callbacks void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ); @@ -597,7 +597,7 @@ void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 { INT32 iSlot; - iSlot = FirstFreeBigEnoughPocket(pProfile, usItem); + iSlot = FirstFreeBigEnoughPocket(pProfile, usItem, ubHowMany); if (iSlot == -1) { @@ -618,11 +618,29 @@ void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT1 } -INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem) +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany) { UINT32 uiPos; + if (ubHowMany == 1) + { + // check body spots + if ( pProfile->inv[HELMETPOS] == NONE && Item[usItem].usItemClass == IC_ARMOUR && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_HELMET ) + return HELMETPOS; + if ( pProfile->inv[VESTPOS] == NONE && Item[usItem].usItemClass == IC_ARMOUR && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST ) + return VESTPOS; + if ( pProfile->inv[LEGPOS] == NONE && Item[usItem].usItemClass == IC_ARMOUR && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS ) + return LEGPOS; + if ( pProfile->inv[HEAD1POS] == NONE && Item[usItem].usItemClass == IC_FACE && CompatibleFaceItem(usItem,pProfile->inv[HEAD2POS]) ) + return HEAD1POS; + if ( pProfile->inv[HEAD2POS] == NONE && Item[usItem].usItemClass == IC_FACE && CompatibleFaceItem(usItem,pProfile->inv[HEAD1POS]) ) + return HEAD2POS; + if ( pProfile->inv[HANDPOS] == NONE ) + return HANDPOS; + if ( pProfile->inv[SECONDHANDPOS] == NONE ) + return SECONDHANDPOS; + } // if it fits into a small pocket if (Item[usItem].ubPerPocket != 0) { @@ -645,7 +663,6 @@ INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem) } } - return(-1); } @@ -867,7 +884,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(1))); } // give launchables for launchers @@ -875,7 +892,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) { usItem = PickARandomLaunchable(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(2+Random(2))); } } @@ -912,7 +929,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(2+Random(2))); } // give launchables for launchers @@ -920,7 +937,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd { usItem = PickARandomLaunchable(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(2+Random(2))); } } iChoice--;