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:
Flugente
2012-09-04 19:27:01 +00:00
parent 02c53cdf16
commit d0e27b0229
17 changed files with 84 additions and 24 deletions
+8 -1
View File
@@ -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 ];
-1
View File
@@ -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
};
+35 -19
View File
@@ -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);
///////////////////////////////////////////////////////////////////////////////////////////////////
+2 -1
View File
@@ -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 );
+1
View File
@@ -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
+9 -1
View File
@@ -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<ubFragRange>%d</ubFragRange>\r\n", Explosive[cnt].fExplodeOnImpact );
FilePrintf(hFile,"\t\t<ubHorizontalDegree>%d</ubHorizontalDegree>\r\n", Explosive[cnt].ubHorizontalDegree );
FilePrintf(hFile,"\t\t<ubVerticalDegree>%d</ubVerticalDegree>\r\n", Explosive[cnt].ubVerticalDegree );
FilePrintf(hFile,"\t\t<bIndoorModifier>%d</bIndoorModifier>\r\n", Explosive[cnt].bIndoorModifier );
FilePrintf(hFile,"\t</EXPLOSIVE>\r\n");
}
+9 -1
View File
@@ -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 ) ;
+2
View File
@@ -540,6 +540,8 @@ enum
STR_CANNOT_ATTACH_SLOT,
STR_CANNOT_ATTACH_ANY_SLOT,
STR_NO_SPACE_FOR_POCKET,
TEXT_NUM_STR_MESSAGE,
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};
+2
View File
@@ -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
};