diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 3111ebdd..70eaf454 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -5077,6 +5077,8 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) else AddItemToPool( gsTempGridNo, &gTempObject, VISIBLE, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); } + // sevenfm: we now know there is something nasty here + gpWorldLevelData[ gsTempGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT; } } } diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 617bcf08..e6899445 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -2006,6 +2006,8 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEA OBJECTTYPE* pObject = &(pSoldier->inv[HANDPOS]); // Do we have a launcable? pObj = &(pSoldier->inv[HANDPOS]); + //sevenfm this should be checked only for guns because we can throw items with attached explosives + if(Item[pObj->usItem].usItemClass & IC_WEAPON ) for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { if ( Item[ iter->usItem ].usItemClass & IC_EXPLOSV && iter->exists()) { diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 06cbdd48..7b16dad8 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -11090,7 +11090,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv } -INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed ) +INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, OBJECTTYPE* pObject) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange"); INT32 iRange = 0; @@ -11147,7 +11147,11 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed ) // Altered by Digicrab on 14 March, 2004 // Reversed a Ja2Gold change that made grenades of weight 3 or more have the same throw distance as those of weight 3. INT32 iThrowingStrength = ( EffectiveStrength( pSoldier, FALSE ) * 2 + 100 ) / 3; - iRange = 2 + ( iThrowingStrength / (3 + (Item[usItem].ubWeight) / 3 )); + // sevenfm: calculate total weight of object with all attachments + if(pObject!= NULL) + iRange = 2 + ( iThrowingStrength / (3 + (CalculateObjectWeight(pObject)) / 3 )); + else + iRange = 2 + ( iThrowingStrength / (3 + (Item[usItem].ubWeight) / 3 )); } else { // not as aerodynamic! @@ -11401,7 +11405,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi } else { - iMaxRange = CalcMaxTossRange( pSoldier, usHandItem , TRUE ) * CELL_X_SIZE; + iMaxRange = CalcMaxTossRange( pSoldier, usHandItem , TRUE , &pSoldier->inv[HANDPOS]) * CELL_X_SIZE; //NumMessage("MAX RANGE = ",maxRange); diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 52308a6a..d8d4aa0c 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -490,7 +490,7 @@ extern BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ); extern FLOAT GetGunOverheatDamagePercentage( FLOAT usTemperature, UINT16 usIndx ); // Flugente: Get percentage: temperature/damagethreshold extern FLOAT GetGunOverheatJamPercentage( FLOAT usTemperature, UINT16 usIndx ); // Flugente: Get percentage: temperature/jamthreshold -extern INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed ); +extern INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, OBJECTTYPE* pObject =NULL ); extern UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ); extern void ChangeWeaponMode( SOLDIERTYPE * pSoldier ); diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index b5c764ce..b7ff2b7d 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -5464,22 +5464,23 @@ void HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 } } - if( !binderFound ) - return; - // search for attached explosives for (iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) { if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) ) { - if(Item[iter->usItem].directional && ubDirection == DIRECTION_IRRELEVANT) - direction=Random(8); - else - direction=ubDirection; - if( Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) + // no need for binder if both item and attachment are tripwire-activated + if( ( Item[pObj->usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) || + ( binderFound && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) ) + { + if(Item[iter->usItem].directional && ubDirection == DIRECTION_IRRELEVANT) + direction=Random(8); + else + direction=ubDirection; IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, Item[iter->usItem].uiIndex, bLevel, direction , NULL ); + } } - if ( gGameExternalOptions.bAllowSpecialExplosiveAttachments && iter->exists() && Item[iter->usItem].usItemClass & IC_MISC ) + if ( binderFound && gGameExternalOptions.bAllowSpecialExplosiveAttachments && iter->exists() && Item[iter->usItem].usItemClass & IC_MISC ) { if(Item[iter->usItem].gascan) IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 532026da..83864581 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2194,7 +2194,7 @@ FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees , OBJECTTY dDegrees = (FLOAT)( PI/4 ); - uiMaxRange = CalcMaxTossRange( pSoldier, pItem->usItem, fArmed ); + uiMaxRange = CalcMaxTossRange( pSoldier, pItem->usItem, fArmed, pItem ); dMagForce = CalculateForceFromRange( pItem->usItem, (INT16) uiMaxRange, dDegrees );