mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
-Fix for throwing explosives with attachments (by Sevenfm)
Weight is now considered correctly. -Civilians now take care not to step on player placed tripwire. (by Sevenfm) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6585 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user