diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 6ab27a1ef..522c01097 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -780,11 +780,11 @@ void InitLBECoords() { if(UsingEDBSystem() > 0) { - gLBEStats[0].sX = 65; gLBEStats[0].sY = 367; gLBEStats[0].sValDx = 0; //Thigh 1 - gLBEStats[1].sX = 101; gLBEStats[1].sY = 367; gLBEStats[1].sValDx = 0; //Thigh 2 - gLBEStats[2].sX = 65; gLBEStats[2].sY = 391; gLBEStats[2].sValDx = 0; //Thigh 3 - gLBEStats[3].sX = 101; gLBEStats[3].sY = 391; gLBEStats[3].sValDx = 0; //Thigh 4 - gLBEStats[4].sX = 77; gLBEStats[4].sY = 415; gLBEStats[4].sValDx = 0; //Thigh 5 + gLBEStats[0].sX = 65; gLBEStats[0].sY = 123; gLBEStats[0].sValDx = 0; //Thigh 1 + gLBEStats[1].sX = 101; gLBEStats[1].sY = 123; gLBEStats[1].sValDx = 0; //Thigh 2 + gLBEStats[2].sX = 65; gLBEStats[2].sY = 147; gLBEStats[2].sValDx = 0; //Thigh 3 + gLBEStats[3].sX = 101; gLBEStats[3].sY = 147; gLBEStats[3].sValDx = 0; //Thigh 4 + gLBEStats[4].sX = 137; gLBEStats[4].sY = 147; gLBEStats[4].sValDx = 0; //Thigh 5 gLBEStats[5].sX = 0; gLBEStats[5].sY = 0; gLBEStats[5].sValDx = 0; //Thigh 6 gLBEStats[6].sX = 0; gLBEStats[6].sY = 0; gLBEStats[6].sValDx = 0; //Thigh 7 gLBEStats[7].sX = 0; gLBEStats[7].sY = 0; gLBEStats[7].sValDx = 0; //Thigh 8 @@ -792,42 +792,42 @@ void InitLBECoords() gLBEStats[9].sX = 0; gLBEStats[9].sY = 0; gLBEStats[9].sValDx = 0; //Thigh 10 gLBEStats[10].sX = 0; gLBEStats[10].sY = 0; gLBEStats[10].sValDx = 0; //Thigh 11 gLBEStats[11].sX = 0; gLBEStats[11].sY = 0; gLBEStats[11].sValDx = 0; //Thigh 12 - gLBEStats[12].sX = 22; gLBEStats[12].sY = 417; gLBEStats[12].sValDx = 0; //Vest 1 - gLBEStats[13].sX = 58; gLBEStats[13].sY = 417; gLBEStats[13].sValDx = 0; //Vest 2 - gLBEStats[14].sX = 94; gLBEStats[14].sY = 417; gLBEStats[14].sValDx = 0; //Vest 3 - gLBEStats[15].sX = 130; gLBEStats[15].sY = 417; gLBEStats[15].sValDx = 0; //Vest 4 - gLBEStats[16].sX = 166; gLBEStats[16].sY = 417; gLBEStats[16].sValDx = 0; //Vest 5 - gLBEStats[17].sX = 22; gLBEStats[17].sY = 441; gLBEStats[17].sValDx = 0; //Vest 6 - gLBEStats[18].sX = 58; gLBEStats[18].sY = 441; gLBEStats[18].sValDx = 0; //Vest 7 - gLBEStats[19].sX = 94; gLBEStats[19].sY = 441; gLBEStats[19].sValDx = 0; //Vest 8 - gLBEStats[20].sX = 130; gLBEStats[20].sY = 441; gLBEStats[20].sValDx = 0; //Vest 9 - gLBEStats[21].sX = 166; gLBEStats[21].sY = 441; gLBEStats[21].sValDx = 0; //Vest 10 - gLBEStats[22].sX = 202; gLBEStats[22].sY = 417; gLBEStats[22].sValDx = 0; //Vest 11 - gLBEStats[23].sX = 202; gLBEStats[23].sY = 441; gLBEStats[23].sValDx = 0; //Vest 12 - gLBEStats[24].sX = 66; gLBEStats[24].sY = 341; gLBEStats[24].sValDx = 0; //CPack 1 - gLBEStats[25].sX = 102; gLBEStats[25].sY = 341; gLBEStats[25].sValDx = 0; //CPack 2 - gLBEStats[26].sX = 66; gLBEStats[26].sY = 365; gLBEStats[26].sValDx = 0; //CPack 3 - gLBEStats[27].sX = 102; gLBEStats[27].sY = 365; gLBEStats[27].sValDx = 0; //CPack 4 - gLBEStats[28].sX = 69; gLBEStats[28].sY = 389; gLBEStats[28].sValDx = 0; //CPack 5 - gLBEStats[29].sX = 69; gLBEStats[29].sY = 413; gLBEStats[29].sValDx = 0; //CPack 6 - gLBEStats[30].sX = 69; gLBEStats[30].sY = 437; gLBEStats[30].sValDx = 0; //CPack 7 + gLBEStats[12].sX = 12; gLBEStats[12].sY = 123; gLBEStats[12].sValDx = 0; //Vest 1 + gLBEStats[13].sX = 48; gLBEStats[13].sY = 123; gLBEStats[13].sValDx = 0; //Vest 2 + gLBEStats[14].sX = 84; gLBEStats[14].sY = 123; gLBEStats[14].sValDx = 0; //Vest 3 + gLBEStats[15].sX = 120; gLBEStats[15].sY = 123; gLBEStats[15].sValDx = 0; //Vest 4 + gLBEStats[16].sX = 156; gLBEStats[16].sY = 123; gLBEStats[16].sValDx = 0; //Vest 5 + gLBEStats[17].sX = 12; gLBEStats[17].sY = 147; gLBEStats[17].sValDx = 0; //Vest 6 + gLBEStats[18].sX = 48; gLBEStats[18].sY = 147; gLBEStats[18].sValDx = 0; //Vest 7 + gLBEStats[19].sX = 84; gLBEStats[19].sY = 147; gLBEStats[19].sValDx = 0; //Vest 8 + gLBEStats[20].sX = 120; gLBEStats[20].sY = 147; gLBEStats[20].sValDx = 0; //Vest 9 + gLBEStats[21].sX = 156; gLBEStats[21].sY = 147; gLBEStats[21].sValDx = 0; //Vest 10 + gLBEStats[22].sX = 192; gLBEStats[22].sY = 123; gLBEStats[22].sValDx = 0; //Vest 11 + gLBEStats[23].sX = 192; gLBEStats[23].sY = 147; gLBEStats[23].sValDx = 0; //Vest 12 + gLBEStats[24].sX = 32; gLBEStats[24].sY = 123; gLBEStats[24].sValDx = 0; //CPack 1 + gLBEStats[25].sX = 68; gLBEStats[25].sY = 123; gLBEStats[25].sValDx = 0; //CPack 2 + gLBEStats[26].sX = 32; gLBEStats[26].sY = 147; gLBEStats[26].sValDx = 0; //CPack 3 + gLBEStats[27].sX = 68; gLBEStats[27].sY = 147; gLBEStats[27].sValDx = 0; //CPack 4 + gLBEStats[28].sX = 104; gLBEStats[28].sY = 123; gLBEStats[28].sValDx = 0; //CPack 5 + gLBEStats[29].sX = 104; gLBEStats[29].sY = 147; gLBEStats[29].sValDx = 0; //CPack 6 + gLBEStats[30].sX = 171; gLBEStats[30].sY = 123; gLBEStats[30].sValDx = 0; //CPack 7 gLBEStats[31].sX = 0; gLBEStats[31].sY = 0; gLBEStats[31].sValDx = 0; //CPack 8 gLBEStats[32].sX = 0; gLBEStats[32].sY = 0; gLBEStats[32].sValDx = 0; //CPack 9 gLBEStats[33].sX = 0; gLBEStats[33].sY = 0; gLBEStats[33].sValDx = 0; //CPack 10 gLBEStats[34].sX = 0; gLBEStats[34].sY = 0; gLBEStats[34].sValDx = 0; //CPack 11 gLBEStats[35].sX = 0; gLBEStats[35].sY = 0; gLBEStats[35].sValDx = 0; //CPack 12 - gLBEStats[36].sX = 32; gLBEStats[36].sY = 347; gLBEStats[36].sValDx = 0; //BPack 1 - gLBEStats[37].sX = 32; gLBEStats[37].sY = 371; gLBEStats[37].sValDx = 0; //BPack 2 - gLBEStats[38].sX = 32; gLBEStats[38].sY = 395; gLBEStats[38].sValDx = 0; //BPack 3 - gLBEStats[39].sX = 32; gLBEStats[39].sY = 419; gLBEStats[39].sValDx = 0; //BPack 4 - gLBEStats[40].sX = 68; gLBEStats[40].sY = 347; gLBEStats[40].sValDx = 0; //BPack 5 - gLBEStats[41].sX = 68; gLBEStats[41].sY = 371; gLBEStats[41].sValDx = 0; //BPack 6 - gLBEStats[42].sX = 68; gLBEStats[42].sY = 395; gLBEStats[42].sValDx = 0; //BPack 7 - gLBEStats[43].sX = 68; gLBEStats[43].sY = 419; gLBEStats[43].sValDx = 0; //BPack 8 - gLBEStats[44].sX = 104; gLBEStats[44].sY = 347; gLBEStats[44].sValDx = 0; //BPack 9 - gLBEStats[45].sX = 104; gLBEStats[45].sY = 371; gLBEStats[45].sValDx = 0; //BPack 10 - gLBEStats[46].sX = 104; gLBEStats[46].sY = 395; gLBEStats[46].sValDx = 0; //BPack 11 - gLBEStats[47].sX = 104; gLBEStats[47].sY = 419; gLBEStats[47].sValDx = 0; //BPack 12 + gLBEStats[36].sX = 12; gLBEStats[36].sY = 123; gLBEStats[36].sValDx = 0; //BPack 1 + gLBEStats[37].sX = 12; gLBEStats[37].sY = 147; gLBEStats[37].sValDx = 0; //BPack 2 + gLBEStats[38].sX = 72; gLBEStats[38].sY = 123; gLBEStats[38].sValDx = 0; //BPack 3 + gLBEStats[39].sX = 72; gLBEStats[39].sY = 147; gLBEStats[39].sValDx = 0; //BPack 4 + gLBEStats[40].sX = 42; gLBEStats[40].sY = 123; gLBEStats[40].sValDx = 0; //BPack 5 + gLBEStats[41].sX = 42; gLBEStats[41].sY = 147; gLBEStats[41].sValDx = 0; //BPack 6 + gLBEStats[42].sX = 102; gLBEStats[42].sY = 123; gLBEStats[42].sValDx = 0; //BPack 7 + gLBEStats[43].sX = 102; gLBEStats[43].sY = 147; gLBEStats[43].sValDx = 0; //BPack 8 + gLBEStats[44].sX = 132; gLBEStats[44].sY = 123; gLBEStats[44].sValDx = 0; //BPack 9 + gLBEStats[45].sX = 132; gLBEStats[45].sY = 147; gLBEStats[45].sValDx = 0; //BPack 10 + gLBEStats[46].sX = 193; gLBEStats[46].sY = 123; gLBEStats[46].sValDx = 0; //BPack 11 + gLBEStats[47].sX = 193; gLBEStats[47].sY = 147; gLBEStats[47].sValDx = 0; //BPack 12 } else { diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 9c54af421..6f26d8faa 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -1042,7 +1042,8 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi BOOLEAN UseNASDesc(OBJECTTYPE *pObject){ if(pObject->exists() == FALSE) return FALSE; - if(guiCurrentScreen == MAP_SCREEN && Item[pObject->usItem].usItemClass == IC_LBEGEAR && UsingNewAttachmentSystem()==true && gGameSettings.fOptions[TOPTION_SHOW_LBE_CONTENT]) + // silversurfer: We allow it now but only in EDB. + if(guiCurrentScreen == MAP_SCREEN && !UsingEDBSystem() ) //Item[pObject->usItem].usItemClass == IC_LBEGEAR && UsingNewAttachmentSystem()==true && gGameSettings.fOptions[TOPTION_SHOW_LBE_CONTENT]) return FALSE; // the map screen can't support NAS and LBEGEAR. return (/*Item[pObject->usItem].usItemClass != IC_LBEGEAR && Item[pObject->usItem].usItemClass != IC_MONEY && */UsingNewAttachmentSystem()==true); } @@ -6314,8 +6315,54 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } + // silversurfer: if the attachment is an LBE item we need to make sure that nothing is "inside" otherwise the contents will be lost + if( Item[pAttachment->usItem].usItemClass == IC_LBEGEAR ) + { + std::vector pocketKey; + switch( LoadBearingEquipment[Item[gpItemDescObject->usItem].ubClassIndex].lbeClass ) + { + case THIGH_PACK: + GetLBESlots( LTHIGHPOCKPOS, pocketKey ); + break; + case VEST_PACK: + GetLBESlots( VESTPOCKPOS, pocketKey ); + break; + case COMBAT_PACK: + GetLBESlots( CPACKPOCKPOS, pocketKey ); + break; + case BACKPACK: + GetLBESlots( BPACKPOCKPOS, pocketKey ); + break; + // this should never happen + default: + return; + } + UINT8 slotCount = 0; + for (std::list::iterator iter = (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.begin(); iter != (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.end(); ++iter, ++slotCount) + { + // compare the adress + if( &(*iter) == pAttachment ) + { + std::vector usAttachmentSlotIndexVector = GetItemSlots(gpItemDescObject); + // if the attachments pocket is not empty then do not allow to remove this attachment + if( gpItemDescObject->IsActiveLBE(gubItemDescStatusIndex) ) // not worn by the soldier + { + LBENODE* pLBE = gpItemDescObject->GetLBEPointer(gubItemDescStatusIndex); + if( pLBE->inv[(AttachmentSlots[usAttachmentSlotIndexVector[slotCount]].ubPocketMapping -1)].exists() ) + return; + } + else // the soldier is wearing the LBE + { + if( gpItemDescSoldier->inv[pocketKey[(AttachmentSlots[usAttachmentSlotIndexVector[slotCount]].ubPocketMapping -1)]].exists() ) + return; + } + break; + } + } + } + // Get attachment if there is one - // The follwing function will handle if no attachment is here + // The following function will handle if no attachment is here if ( gpItemDescObject->RemoveAttachment( pAttachment, &gItemPointer, ubStatusIndex, gpItemDescSoldier ) ) { gpItemPointer = &gItemPointer; @@ -8101,7 +8148,13 @@ void RenderLBENODEItems( OBJECTTYPE *pObj, int subObject ) BltVideoObjectFromIndex( guiSAVEBUFFER, guiAttachmentSlot, LBEInvPocketXY[cnt].fBigPocket, sX-7, sY-1, VO_BLT_SRCTRANSPARENCY, NULL ); lbePocket = LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[icPocket[pocketKey[cnt]]]; if( lbePocket == 0 && LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketsAvailable & (UINT16)pow((double)2, icPocket[pocketKey[cnt]])) - lbePocket = GetPocketFromAttachment(&pSoldier->inv[icLBE[pocketKey[cnt]]], icPocket[pocketKey[cnt]]); + { + if( wornItem ) + lbePocket = GetPocketFromAttachment(&pSoldier->inv[icLBE[pocketKey[cnt]]], icPocket[pocketKey[cnt]], subObject); + else + lbePocket = GetPocketFromAttachment( pObj, icPocket[pocketKey[cnt]], subObject); + } + pObject = NULL; if(wornItem == true) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index a796ac78f..f2d4003b5 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -14443,14 +14443,15 @@ UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj, INT16 exceptSlot) return sum; } //DBrot: search the attachments for a pocket -INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap){ - std::vector usAttachmentSlotIndexVector = GetItemSlots(pObj); +INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap, int subObject) +{ + std::vector usAttachmentSlotIndexVector = GetItemSlots(pObj, subObject); OBJECTTYPE* pAttachment; for ( UINT16 slotCount = 0; slotCount < usAttachmentSlotIndexVector.size( ); ++slotCount ) { if(AttachmentSlots[usAttachmentSlotIndexVector[slotCount]].ubPocketMapping -1 == pMap) { - pAttachment = (*pObj)[0]->GetAttachmentAtIndex(slotCount); + pAttachment = (*pObj)[subObject]->GetAttachmentAtIndex(slotCount); if(pAttachment->exists() && Item[pAttachment->usItem].usItemClass == IC_LBEGEAR) { return(GetFirstPocketOnItem(pAttachment->usItem)); diff --git a/Tactical/Items.h b/Tactical/Items.h index ee4f370e0..bbf86ff69 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -513,7 +513,7 @@ FLOAT GetItemDirtIncreaseFactor( OBJECTTYPE * pObj, BOOLEAN fConsiderAmmo = TRUE //DBrot: get the volume of all attached pouches UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj, INT16 exceptSlot); -INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap); +INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap, int subObject = 0); UINT8 GetFirstPocketOnItem(UINT16 usIndex); INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo );