diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 373078aa..ada740c6 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -7553,6 +7553,9 @@ void RenderLBENODEItems( OBJECTTYPE *pObj, int subObject ) if(sX != 0 && sY != 0) 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]]); + pObject = NULL; if(wornItem == true) { @@ -12022,7 +12025,11 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname ); wcscat( pStr, pStr2 ); } - + if ( Item[usItem].usItemClass == IC_LBEGEAR){ + CHAR16 plbeStr[20]; + swprintf( plbeStr, L"\n%s %d/%d", gWeaponStatsDesc[19], GetVolumeAlreadyTaken(pObject, -1), LoadBearingEquipment[Item[usItem].ubClassIndex].lbeAvailableVolume); + wcscat( pStr, plbeStr ); + } // Add attachment string.... CHAR16 attachString[ 300 ]; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 49ed25d5..b9e3ac1c 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1110,7 +1110,6 @@ typedef enum eLBE_CLASS // Designation of lbeClass BACKPACK, LBE_POCKET, OTHER_POCKET, - MOD_POCKET //DBrot: added mod_pocket to identify modular pouches }; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 0ccc8fc1..6276f0f8 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -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 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 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); /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Tactical/Items.h b/Tactical/Items.h index 5c6cb3a2..d9d3e435 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -492,8 +492,9 @@ typedef struct FLOAT GetItemDirtIncreaseFactor( OBJECTTYPE * pObj, BOOLEAN fConsiderAmmo = TRUE ); //DBrot: get the volume of all attached pouches -UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj); +UINT8 GetVolumeAlreadyTaken(OBJECTTYPE * pObj, INT16 exceptSlot); INT16 GetPocketFromAttachment(OBJECTTYPE * pObj, UINT8 pMap); +UINT8 GetFirstPocketOnItem(UINT16 usIndex); INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo ); diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 7f8f79ff..9302fa18 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -435,6 +435,7 @@ typedef struct UINT16 ubFragRange; UINT16 ubHorizontalDegree; // Flugente: size of the horizontal arc into which fragments will be shot UINT16 ubVerticalDegree; // Flugente: size of the vertical arc into which fragments will be shot + FLOAT bIndoorModifier; //DBrot: confined areas enhance effect } EXPLOSIVETYPE; //GLOBALS diff --git a/Tactical/XML_Explosive.cpp b/Tactical/XML_Explosive.cpp index f4b1876a..1c1167e8 100644 --- a/Tactical/XML_Explosive.cpp +++ b/Tactical/XML_Explosive.cpp @@ -64,7 +64,8 @@ explosiveStartElementHandle(void *userData, const XML_Char *name, const XML_Char strcmp(name, "ubFragDamage") == 0 || strcmp(name, "ubFragRange") == 0 || strcmp(name, "ubHorizontalDegree") == 0 || - strcmp(name, "ubVerticalDegree") == 0 )) + strcmp(name, "ubVerticalDegree") == 0 || + strcmp(name, "bIndoorModifier") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -210,6 +211,12 @@ explosiveEndElementHandle(void *userData, const XML_Char *name) pData->curExplosive.ubVerticalDegree = (UINT16) atol(pData->szCharData); } + else if(strcmp(name, "bIndoorModifier") == 0) + { + pData->curElement = ELEMENT; + pData->curExplosive.bIndoorModifier = (FLOAT) atof(pData->szCharData); + } + pData->maxReadDepth--; } @@ -320,6 +327,7 @@ BOOLEAN WriteExplosiveStats() FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].fExplodeOnImpact ); FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubHorizontalDegree ); FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubVerticalDegree ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].bIndoorModifier ); FilePrintf(hFile,"\t\r\n"); } diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 75212008..b3f25f9c 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -2189,13 +2189,21 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte // HEADROCK HAM 3.6: Can now use negative modifier. INT16 newDamage = (INT16)GetModifiedExplosiveDamage( pExplosive->ubDamage ); //INT16 newDamage = pExplosive->ubDamage + (INT16)(( pExplosive->ubDamage * gGameExternalOptions.ubExplosivesDamageMultiplier) / 100); //lal - + + //DBrot: apply a modifier to confined explosions + if(InARoom(sBombGridNo, NULL)){ + newDamage += (INT16)newDamage * pExplosive->bIndoorModifier; + } sWoundAmt = newDamage + (INT16) ( (newDamage * uiRoll) / 100 ); // Calculate breath amount ( if stun damage applicable ) INT16 newBreath = (INT16)GetModifiedExplosiveDamage( pExplosive->ubStunDamage ); //INT16 newBreath = pExplosive->ubStunDamage + (INT16)(( pExplosive->ubStunDamage * gGameExternalOptions.ubExplosivesDamageMultiplier) / 100); //lal + if(InARoom(sBombGridNo, NULL)){ + newBreath += (INT16)newBreath * pExplosive->bIndoorModifier; + } + sBreathAmt = ( newBreath * 100 ) + (INT16) ( ( ( newBreath / 2 ) * 100 * uiRoll ) / 100 ) ; diff --git a/Utils/Text.h b/Utils/Text.h index 1b888214..92ee9bd9 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -540,6 +540,8 @@ enum STR_CANNOT_ATTACH_SLOT, STR_CANNOT_ATTACH_ANY_SLOT, + STR_NO_SPACE_FOR_POCKET, + TEXT_NUM_STR_MESSAGE, }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 7e55ef97..16283e8b 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -1565,6 +1565,7 @@ CHAR16 Message[][STRING_LENGTH] = L"你不能将其附加在当前功能槽.", L"%s 不适合打开的任何功能槽.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2472,6 +2473,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"剩余弹药:", //16 L"默认:", //17 //WarmSteel - So we can also display default attachments L"污垢:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 5cb18636..8744182f 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -1561,6 +1561,7 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2469,6 +2470,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = // TODO.Translate L"Default:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index b31586d9..fd1d6dae 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -1565,6 +1565,7 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", }; @@ -2472,6 +2473,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"Remaining ammo:", //16 L"Default:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente + L"Space:", // 19 //space left on Molle items }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index adcf2cd4..06e19bdf 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -1564,6 +1564,7 @@ CHAR16 Message[][STRING_LENGTH] = L"Vous ne pouvez pas attacher %s à cette emplacement.", L"%s n'ira dans aucun emplacement de libre.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2471,6 +2472,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"Munit. rest. :", //16 L"Par défaut :", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 34a199eb..9ee821e6 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1580,6 +1580,7 @@ CHAR16 Message[][STRING_LENGTH] = L"%s's Schneetarnung wurde herunter gewaschen.", L"Sie können %s nicht an dieser Einbaustelle anbringen.", L"%s passt in keine freie Einbaustelle.", + L"Für diese Tasche ist nicht mehr genug Platz.", }; CHAR16 pTownNames[MAX_TOWNS][MAX_TOWN_NAME_LENGHT] = @@ -2477,6 +2478,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"Standard:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index c4636696..12674c20 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -1557,6 +1557,7 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2464,6 +2465,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = // TODO.Translate L"Default:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index cfce0074..a0bdba88 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -1572,6 +1572,7 @@ CHAR16 Message[][STRING_LENGTH] = L"Niemożesz przydzielić %s do tego slotu.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2479,6 +2480,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"DomyŚlne:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index c644fd35..0b483037 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -1565,6 +1565,7 @@ CHAR16 Message[][STRING_LENGTH] = L"Нельзя установить навеску %s на это место.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2472,6 +2473,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = L"Предустановка:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente // TODO.Translate + L"Space:", // 19 //space left on Molle items //TODO.Translate }; diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 9f4cfa24..f723b1a4 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -1565,6 +1565,7 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", + L"There's not enough space for this pocket.", //TODO:Translate }; @@ -2473,6 +2474,7 @@ CHAR16 gWeaponStatsDesc[][ 19 ] = // TODO.Translate L"Default:", //17 //WarmSteel - So we can also display default attachments L"Dirt:", // 18 //added by Flugente + L"Space:", // 19 //space left on Molle items //TODO.Translate };