From de6c84d4a914e8aee5dfc04372c3f0f8a50ea078 Mon Sep 17 00:00:00 2001 From: Wanne Date: Fri, 6 Jul 2012 13:43:34 +0000 Subject: [PATCH] - Made the "Rifle sling" feature optional, so we can decide if we like to build an executable with/without the feature o See: builddefines.h: #define ENABLE_RIFLE_SLING o Note: This feature is NOT the strategy performance killer git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5360 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle Items.cpp | 2 ++ Tactical/Interface Panels.cpp | 2 ++ Tactical/Soldier Control.cpp | 4 ++++ builddefines.h | 7 +++++++ 4 files changed, 15 insertions(+) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 6e978120..bcdccb60 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -5768,6 +5768,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet { case HANDPOS: case GUNSLINGPOCKPOS: +#ifdef ENABLE_RIFLE_SLING { // Flugente: if item has a weapon sling attached, it can't be stolen if ( HasAttachmentOfClass(pObject, AC_SLING) ) @@ -5777,6 +5778,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet break; } +#endif case SECONDHANDPOS: case KNIFEPOCKPOS: case BIGPOCK1POS: diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index a9fee2d2..adb3c465 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3594,6 +3594,7 @@ UINT32 GetInvMovementCost(OBJECTTYPE* pObj, UINT32 old_pos, UINT32 new_pos) cost += uiAPCostToSlot[dst_type]; cost += weight_modifier; +#ifdef ENABLE_RIFLE_SLING // Flugente if we move an item from our hands to the sling, and item has a weapon sling, don't charge any APs if ( 1 == src_type && 7 == dst_type ) { @@ -3602,6 +3603,7 @@ UINT32 GetInvMovementCost(OBJECTTYPE* pObj, UINT32 old_pos, UINT32 new_pos) // we simply let go of the item, we can do that because the sling will catch it cost = 0; } +#endif if (cost > APBPConstants[AP_INV_MAX_COST]) cost = APBPConstants[AP_INV_MAX_COST]; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index fc7d53fd..089ac1bb 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9477,6 +9477,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sPo // OK, drop item in main hand... if ( this->inv[ HANDPOS ].exists() == true ) { +#ifdef ENABLE_RIFLE_SLING // Flugente: If item has an attached rifle sling, place it the sling position instead int bSlot = GUNSLINGPOCKPOS; if ( HasAttachmentOfClass(&(this->inv[ HANDPOS ]), AC_SLING) && TryToPlaceInSlot(this, &(this->inv[ HANDPOS ]), FALSE, bSlot, GUNSLINGPOCKPOS) ) @@ -9484,6 +9485,9 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sPo ; } else if ( !( this->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) +#else + if ( !( this->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) +#endif { // ATE: if our guy, make visible.... if ( this->bTeam == gbPlayerNum ) diff --git a/builddefines.h b/builddefines.h index 6ee51cc2..a83ce123 100644 --- a/builddefines.h +++ b/builddefines.h @@ -3,6 +3,13 @@ #include "Language Defines.h" +// ----------------------------- +// ***************************** +// WANNE: Enable this define to use the rifle sling feature (Feature was added in Revision: 5207) +#define ENABLE_RIFLE_SLING +// ----------------------------- +// ***************************** + // ----------------------------- // ***************************** // WANNE: Enable this define to show explosives display (Feature was added in Revision: 5210)