mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Enhancement: It is now possible to display attachments and contents of LBE at the same time when game option "Show LBE Content" is active.
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=340063&#msg_340063 Fixes for MOLLE display and handling: - MOLLE didn't display attached pockets and their contents when the item was in sector inventory - MOLLE pockets could be detached although there were still items inside the pocket. This led to items in invalid pockets (MOLLE on soldier) or items vanishing completely (MOLLE in sector inventory). Now it is not possible anymore to detach filled MOLLE pockets. You will have to empty them first. - MOLLE in a stack displayed the wrong contents as long as their index was not 0. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7783 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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<INT8> 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<OBJECTTYPE>::iterator iter = (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.begin(); iter != (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.end(); ++iter, ++slotCount)
|
||||
{
|
||||
// compare the adress
|
||||
if( &(*iter) == pAttachment )
|
||||
{
|
||||
std::vector<UINT16> 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)
|
||||
|
||||
Reference in New Issue
Block a user