Feature improvement: allow accessing other merc inventories when ACCESS_OTHER_MERC_INVENTORIES is TRUE. Even works with dying mercs.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6033 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-04-28 22:59:09 +00:00
parent 7f467f4f80
commit 3b0d8613af
5 changed files with 79 additions and 61 deletions
+2
View File
@@ -1310,6 +1310,8 @@ void LoadGameExternalOptions()
// enable schedules and decision making for any named npc regardless of their team
gGameExternalOptions.fAllNamedNpcsDecideAction = iniReader.ReadBoolean("Tactical Gameplay Settings", "ALL_NAMED_NPCS_DECIDE_ACTION", FALSE);
gGameExternalOptions.fAccessOtherMercInventories = iniReader.ReadBoolean("Tactical Gameplay Settings","ACCESS_OTHER_MERC_INVENTORIES", TRUE);
//################# Tactical Cover System Settings ##################
// CPT: Cover System Settings
+3
View File
@@ -489,6 +489,9 @@ typedef struct
UINT16 usMilitiaAmmo_OptimalMagCount;
BOOLEAN fMilitiaUseSectorClassSpecificTaboos;
// Flugente - allow accessing other mercs inventory via 'stealing'
BOOLEAN fAccessOtherMercInventories;
// WDS - Improve Tony's and Devin's inventory like BR's
BOOLEAN tonyUsesBRSetting;
BOOLEAN devinUsesBRSetting;
+64 -58
View File
@@ -6293,69 +6293,75 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
}
else
{
// Check, if we can steal the item
// CHRISL: Added new case definitions for new inventory pockets
switch (i)
// Flugente: if we are on the same team, allow guaranteed full access
if ( gGameExternalOptions.fAccessOtherMercInventories && pOpponent->bTeam == pSoldier->bTeam )
fStealItem = TRUE;
else
{
case HANDPOS:
case GUNSLINGPOCKPOS:
// Check, if we can steal the item
// CHRISL: Added new case definitions for new inventory pockets
switch (i)
{
// Flugente: if item has a weapon sling attached, it can't be stolen
if ( HasAttachmentOfClass(pObject, AC_SLING) )
fStealItem = FALSE;
else
fStealItem = TRUE;
case HANDPOS:
case GUNSLINGPOCKPOS:
{
// Flugente: if item has a weapon sling attached, it can't be stolen
if ( HasAttachmentOfClass(pObject, AC_SLING) )
fStealItem = FALSE;
else
fStealItem = TRUE;
break;
}
case SECONDHANDPOS:
case KNIFEPOCKPOS:
case BIGPOCK1POS:
case BIGPOCK2POS:
case BIGPOCK3POS:
case BIGPOCK4POS:
case BIGPOCK5POS:
case BIGPOCK6POS:
case BIGPOCK7POS:
case MEDPOCK1POS:
case MEDPOCK2POS:
case MEDPOCK3POS:
case MEDPOCK4POS:
case SMALLPOCK1POS:
case SMALLPOCK2POS:
case SMALLPOCK3POS:
case SMALLPOCK4POS:
case SMALLPOCK5POS:
case SMALLPOCK6POS:
case SMALLPOCK7POS:
case SMALLPOCK8POS:
case SMALLPOCK9POS:
case SMALLPOCK10POS:
case SMALLPOCK11POS:
case SMALLPOCK12POS:
case SMALLPOCK13POS:
case SMALLPOCK14POS:
case SMALLPOCK15POS:
case SMALLPOCK16POS:
case SMALLPOCK17POS:
case SMALLPOCK18POS:
case SMALLPOCK19POS:
case SMALLPOCK20POS:
case SMALLPOCK21POS:
case SMALLPOCK22POS:
case SMALLPOCK23POS:
case SMALLPOCK24POS:
case SMALLPOCK25POS:
case SMALLPOCK26POS:
case SMALLPOCK27POS:
case SMALLPOCK28POS:
case SMALLPOCK29POS:
case SMALLPOCK30POS:
fStealItem = TRUE;
break;
default:
fStealItem = FALSE;
break;
}
case SECONDHANDPOS:
case KNIFEPOCKPOS:
case BIGPOCK1POS:
case BIGPOCK2POS:
case BIGPOCK3POS:
case BIGPOCK4POS:
case BIGPOCK5POS:
case BIGPOCK6POS:
case BIGPOCK7POS:
case MEDPOCK1POS:
case MEDPOCK2POS:
case MEDPOCK3POS:
case MEDPOCK4POS:
case SMALLPOCK1POS:
case SMALLPOCK2POS:
case SMALLPOCK3POS:
case SMALLPOCK4POS:
case SMALLPOCK5POS:
case SMALLPOCK6POS:
case SMALLPOCK7POS:
case SMALLPOCK8POS:
case SMALLPOCK9POS:
case SMALLPOCK10POS:
case SMALLPOCK11POS:
case SMALLPOCK12POS:
case SMALLPOCK13POS:
case SMALLPOCK14POS:
case SMALLPOCK15POS:
case SMALLPOCK16POS:
case SMALLPOCK17POS:
case SMALLPOCK18POS:
case SMALLPOCK19POS:
case SMALLPOCK20POS:
case SMALLPOCK21POS:
case SMALLPOCK22POS:
case SMALLPOCK23POS:
case SMALLPOCK24POS:
case SMALLPOCK25POS:
case SMALLPOCK26POS:
case SMALLPOCK27POS:
case SMALLPOCK28POS:
case SMALLPOCK29POS:
case SMALLPOCK30POS:
fStealItem = TRUE;
break;
default:
fStealItem = FALSE;
break;
}
}
+2 -1
View File
@@ -5675,7 +5675,8 @@ void HandleHandCursorClick( INT32 usMapPos, UINT32 *puiNewEvent )
// Check if we are on a merc... if so.. steal!
if ( gfUIFullTargetFound )
{
if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) )
// Flugente: allow stealing if the other guy is an enemy, OR if we are on the same team
if ( (( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC )) || (gGameExternalOptions.fAccessOtherMercInventories && guiUIFullTargetFlags & OWNED_MERC) )
{
sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
if ( sActionGridNo == -1 )
+8 -2
View File
@@ -3088,7 +3088,12 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea
if (fStealing)
{
// Calculate the possible chance to steal!
if ( AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) || CREATURE_OR_BLOODCAT( pTargetSoldier ) || TANK( pTargetSoldier ) || (SOLDIER_CLASS_MILITIA(pTargetSoldier->ubSoldierClass) && (gGameExternalOptions.ubMilitiaDropEquipment != 2)) ) // added militia here - SANDRO
// Flugente: if we are on the same team, allow guaranteed full access
if ( gGameExternalOptions.fAccessOtherMercInventories && pTargetSoldier->bTeam == pSoldier->bTeam )
{
iHitChance = 100;
}
else if ( AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) || CREATURE_OR_BLOODCAT( pTargetSoldier ) || TANK( pTargetSoldier ) || (SOLDIER_CLASS_MILITIA(pTargetSoldier->ubSoldierClass) && (gGameExternalOptions.ubMilitiaDropEquipment != 2)) ) // added militia here - SANDRO
{
iHitChance = 0;
}
@@ -3182,7 +3187,8 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea
// WDS 07/19/2008 - Random number use fix
// Do we have the chance to steal more than 1 item?
// SANDRO - taking items from collapsed soldiers is treated differently
if (( fSoldierCollapsed || (!gGameExternalOptions.fEnhancedCloseCombatSystem && iDiceRoll < (iHitChance * 2 / 3))) && pSoldier->bTeam == gbPlayerNum )
// Flugente: if we are on the same team, allow guaranteed full access
if ( (gGameExternalOptions.fAccessOtherMercInventories && pTargetSoldier->bTeam == pSoldier->bTeam ) || ( fSoldierCollapsed || (!gGameExternalOptions.fEnhancedCloseCombatSystem && iDiceRoll < (iHitChance * 2 / 3))) && pSoldier->bTeam == gbPlayerNum )
{
// first, charge extra Aps, because it's difficlut to pickup from other soldier
if (gGameExternalOptions.fEnhancedCloseCombatSystem)