Small changes and fixes for grenades and explosives (by Sevenfm)

1) Fixed small bug when MAPELEMENT_PLAYER_MINE_PRESENT was set after planting explosives with remote detonator.
2) Arming bomb with only remote defuse attached is not allowed. 
3) Showing item locator before "add blueflag" messagebox is disabled for our mines as it was annoying and you anyway know that it is here.
4) Total weight for throwing range is calculated for all items (previously it was calculated only for grenades).
5) Grenade-throwing formula and demolitions bonus applied only for hand-thrown grenades (check for TOSSCURS). Previously it was applied for launched grenades too.
6) Changed grenade throwing range formula from

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6606 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-11-15 19:51:12 +00:00
parent bb5b5e21d6
commit 57dd52a839
3 changed files with 44 additions and 18 deletions
+15 -9
View File
@@ -11095,6 +11095,7 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange");
INT32 iRange = 0;
UINT16 usSubItem = NOTHING;
UINT16 itemWeight;
if ( EXPLOSIVE_GUN( usItem ) )
{
@@ -11134,29 +11135,33 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O
}
else
{
// sevenfm: calculate total weight of object with all attachments
if(pObject!= NULL)
itemWeight = CalculateObjectWeight(pObject);
else
itemWeight=Item[usItem].ubWeight;
// if ( Item[ usItem ].fFlags & ITEM_UNAERODYNAMIC )
if ( Item[ usItem ].unaerodynamic )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange: not aerodynamic");
iRange = 1;
}
else if ( Item[ usItem ].usItemClass == IC_GRENADE )
{
// sevenfm: this formula should be used only for hand grenades and not launched grenades
else if ( Item[ usItem ].usItemClass == IC_GRENADE && Item[usItem].ubCursor == TOSSCURS)
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange: grenade");
// start with the range based on the soldier's strength and the item's weight
// 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;
// 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 ));
// sevenfm: changed weight ratio from 3 to 2.5, also new formula will give more steps of range
//iRange = 2 + ( iThrowingStrength / (3 + itemWeight / 3 ));
iRange = 2 + ( iThrowingStrength * 5 ) / ( 15 + itemWeight * 2 );
}
else
{ // not as aerodynamic!
// start with the range based on the soldier's strength and the item's weight
iRange = 2 + ( ( EffectiveStrength( pSoldier, FALSE ) / ( 5 + Item[usItem].ubWeight) ) );
iRange = 2 + ( ( EffectiveStrength( pSoldier, FALSE ) / ( 5 + itemWeight) ) );
}
// adjust for thrower's remaining breath (lose up to 1/2 of range)
@@ -11171,7 +11176,8 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O
// better max range due to expertise
iRange += ((iRange * gSkillTraitValues.ubTHBladesMaxRange ) / 100);
}
else if ( (Item[ usItem ].usItemClass == IC_GRENADE) && (HAS_SKILL_TRAIT( pSoldier, DEMOLITIONS_NT )) )
// sevenfm: add range only for hand grenades and not launched grenades
else if ( (Item[ usItem ].usItemClass == IC_GRENADE) && Item[usItem].ubCursor == TOSSCURS && (HAS_SKILL_TRAIT( pSoldier, DEMOLITIONS_NT )) )
{
// better max range due to expertise
iRange += ((iRange * gSkillTraitValues.ubDEMaxRangeToThrowGrenades) / 100);