mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Enhancements of the MOLLE Feature (by DepressivesBrot):
- Added: Separate message for 'no space' (used 'already there' as a placeholder before) - Fixed: Exchanging attachments when we are near capacity for the carrier - Fixed: The LBE shown in the description box now changes as well and as soon as you add/remove an attachment - Changed: The attachment now transfers the first non-zero pocket to the carrier instead of simply the first - Added: Tooltips now show the currently used and the available space of a carrier. - Added: A modifier for the explosive damage in confined spaces (by DepressivesBrot). Implemented on a per-item basis using the new float tag <bIndoorModifier> in Explosives.xml (0.5 means 150% damage, 1.0 means 200% etc.) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5552 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+35
-19
@@ -2261,6 +2261,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
|
||||
INT32 iLoop2 = 0;
|
||||
INT16 sTimesToRun = 0;
|
||||
UINT8 curSlot = 0;
|
||||
UINT8 ubVolumeTaken;
|
||||
BOOLEAN foundValidAttachment = FALSE;
|
||||
|
||||
if (pObj->exists() == false) {
|
||||
@@ -2293,12 +2294,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
|
||||
fSameItem = TRUE;
|
||||
break;
|
||||
}
|
||||
if (Item[pObj->usItem].usItemClass == IC_LBEGEAR && Item[usAttachment].usItemClass == IC_LBEGEAR){
|
||||
if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeAvailableVolume < (GetVolumeAlreadyTaken(pObj) + LBEPocketType[LoadBearingEquipment[Item[usAttachment].ubClassIndex].lbePocketIndex[0]].pVolume)){
|
||||
fNoSpace = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IncompatibleAttachments[i][0] == NONE )
|
||||
break;
|
||||
if ( IncompatibleAttachments[i][0] == usAttachment && FindAttachment (pObj,IncompatibleAttachments[i][1],subObject) != 0 )
|
||||
@@ -2309,6 +2305,12 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Item[pObj->usItem].usItemClass == IC_LBEGEAR && Item[usAttachment].usItemClass == IC_LBEGEAR){
|
||||
ubVolumeTaken = GetVolumeAlreadyTaken(pObj, slotCount);
|
||||
if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeAvailableVolume < (ubVolumeTaken + LBEPocketType[GetFirstPocketOnItem(usAttachment)].pVolume)){
|
||||
fNoSpace = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//Do we want to check all attachment slots or just the one in slotcount?
|
||||
if(slotCount == -1){
|
||||
@@ -2353,7 +2355,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
|
||||
//CHRISL: This should allow attachment swapping even if our attachments can't normally be on the weapon at the same time.
|
||||
if(slotCount != -1 && pAttachment->exists() && usSimilarItem == pAttachment->usItem && FindAttachmentSlot(pObj, pAttachment->usItem, subObject) == slotCount)
|
||||
fSimilarItems = FALSE;
|
||||
|
||||
|
||||
//If we have an item to return the existing attachment to.
|
||||
if(ppAttachInSlot && pAttachment->exists())
|
||||
*ppAttachInSlot = pAttachment;
|
||||
@@ -2383,8 +2385,8 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
|
||||
return( FALSE );
|
||||
}
|
||||
else if (fNoSpace)
|
||||
{ //DBrot: TODO - temporary string
|
||||
if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_ATTACHMENT_ALREADY ] );
|
||||
{
|
||||
if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_NO_SPACE_FOR_POCKET ] );
|
||||
return( FALSE );
|
||||
}
|
||||
else if ( !foundValidAttachment && fDisplayMessage && !ValidMerge( usAttachment, pObj->usItem ) )
|
||||
@@ -13809,16 +13811,20 @@ BOOLEAN HasAttachmentOfClass( OBJECTTYPE * pObj, UINT32 aFlag )
|
||||
return( FALSE );
|
||||
}
|
||||
//DBrot: calculate the volume already taken up by other pouches attached to this carrier
|
||||
UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj){
|
||||
UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj, INT16 exceptSlot){
|
||||
UINT8 sum=0;
|
||||
if ( pObj->exists() )
|
||||
{
|
||||
// check all attachments
|
||||
attachmentList::iterator iterend = (*pObj)[0]->attachments.end();
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter)
|
||||
{
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass == IC_LBEGEAR){
|
||||
sum += LBEPocketType[LoadBearingEquipment[Item[iter->usItem].ubClassIndex].lbePocketIndex[0]].pVolume;
|
||||
std::vector<UINT16> usAttachmentSlotIndexVector = GetItemSlots(pObj);
|
||||
OBJECTTYPE* pAttachment;
|
||||
UINT16 slotCount;
|
||||
for (slotCount = 0; slotCount < usAttachmentSlotIndexVector.size(); slotCount++ ){
|
||||
if( slotCount == exceptSlot)
|
||||
continue;
|
||||
|
||||
pAttachment = (*pObj)[0]->GetAttachmentAtIndex(slotCount);
|
||||
if(pAttachment->exists() && Item[pAttachment->usItem].usItemClass == IC_LBEGEAR){
|
||||
sum += LBEPocketType[GetFirstPocketOnItem(pAttachment->usItem)].pVolume;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13827,19 +13833,29 @@ UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj){
|
||||
//DBrot: search the attachments for a pocket
|
||||
INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap){
|
||||
std::vector<UINT16> usAttachmentSlotIndexVector = GetItemSlots(pObj);
|
||||
OBJECTTYPE* pAttachment; // = (*pObject)[ubStatusIndex]->GetAttachmentAtIndex(slotCount);
|
||||
OBJECTTYPE* pAttachment;
|
||||
UINT16 slotCount;
|
||||
for (slotCount = 0; slotCount < usAttachmentSlotIndexVector.size(); slotCount++ ){
|
||||
if(AttachmentSlots[usAttachmentSlotIndexVector[slotCount]].ubPocketMapping -1 == pMap){
|
||||
pAttachment = (*pObj)[0]->GetAttachmentAtIndex(slotCount);
|
||||
if(pAttachment->exists() && Item[pAttachment->usItem].usItemClass == IC_LBEGEAR){
|
||||
return(LoadBearingEquipment[Item[pAttachment->usItem].ubClassIndex].lbePocketIndex[0]);
|
||||
return(GetFirstPocketOnItem(pAttachment->usItem));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT8 GetFirstPocketOnItem(UINT16 usIndex){
|
||||
UINT8 pPocket = 0;
|
||||
for(UINT8 i = 0; i < LoadBearingEquipment[Item[usIndex].ubClassIndex].lbePocketIndex.size(); i++){
|
||||
pPocket = LoadBearingEquipment[Item[usIndex].ubClassIndex].lbePocketIndex[i];
|
||||
if(pPocket){
|
||||
return pPocket;
|
||||
}
|
||||
}
|
||||
return pPocket;
|
||||
}
|
||||
|
||||
extern void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user