From 46b34e55d140e87cb0da9cc27d4c835222f9bf5a Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sat, 31 Jan 2015 14:36:36 +0000 Subject: [PATCH] - new option for automatic IMP item distribution: uiIndex 52 "Sidearm" in IMPItemChoices.xml is used to give the IMP a standard sidearm based on random selection. It is encouraged to remove marksmanship based gun choices and instead add special weaponry for traits. - The following changes are supposed to remove useless items from vendors and other lists: Function ItemIsLegal now filters out food items if the food system is off. The same applies to cleaning kits if the dirt system is off. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7722 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/IMP Confirm.cpp | 7 +++++-- Tactical/Item Types.h | 3 +++ Tactical/Items.cpp | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 3c89e9dd..a10088ed 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -623,6 +623,8 @@ void GiveItemsToPC( UINT8 ubProfileId ) GiveIMPItems(pProfile, 100, IMP_DEFAULT); GiveIMPRandomItems(pProfile, IMP_RANDOMDEFAULT); + // silversurfer: added sidearm selection + GiveIMPRandomItems(pProfile, IMP_SIDEARM); GiveIMPItems (pProfile,pProfile->bWisdom,IMP_WISDOM); GiveIMPItems (pProfile,pProfile->bMarksmanship,IMP_MARKSMANSHIP); @@ -1686,7 +1688,8 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) for ( UINT8 cnt=0; cnt < ubNumChoices; ++cnt ) { usItem = gIMPItemChoices[ typeIndex ].bItemNo[ cnt ]; - if ( ItemIsLegal(usItem) ) + // allow guns no matter if Tons of Guns was selected so the merc doesn't have to start without a weapon + if ( ItemIsLegal(usItem) || Item[usItem].usItemClass == IC_GUN ) ++ubValidChoices; } @@ -1710,7 +1713,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) iChoice = Random( ubNumChoices ); usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; // is this legal and we don't have it already? - if (ItemIsLegal(usItem) && !ubItemsGiven[iChoice] ) + if ( (ItemIsLegal(usItem) || Item[usItem].usItemClass == IC_GUN) && !ubItemsGiven[iChoice] ) ubItemsGiven[iChoice] = TRUE; else usItem=0; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 1c597923..705d3e2e 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1881,6 +1881,9 @@ enum // Flugente: added radio operator IMP_RADIO_OPERATOR, + // silversurfer: added sidearm for standard weapons. Special weapons should come from traits. + IMP_SIDEARM, + MAX_IMP_ITEM_TYPES }; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 87be5f6c..77458488 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1266,6 +1266,18 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; + // silversurfer: no food items if the food system is off + if ( !gGameOptions.fFoodSystem && Item[ usItemIndex ].foodtype > 0 ) + { + // Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. + if ( Food[Item[usItemIndex].foodtype].bFoodPoints > 0 ) + return FALSE; + } + + // silversurfer: we don't need cleaning kits if the dirt system is off + if ( !gGameExternalOptions.fDirtSystem && HasItemFlag(usItemIndex, CLEANING_KIT) ) + return FALSE; + //if the user has selected the reduced gun list if( !gGameOptions.fGunNut ) {