From f51442d03da1df85f25b431b1cba9a887790b5f6 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Wed, 12 Feb 2020 17:40:05 +0000 Subject: [PATCH] Only check for fExplodeOnImpact in OBJECT_DETONATE_ON_IMPACT if item has IC_EXPLOSV class. This fixes situation when random items are thrown incorrectly. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8749 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TileEngine/physics.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 840b28f5..1c9fab33 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -66,8 +66,7 @@ class SOLDIERTYPE; #define GET_OBJECT_LEVEL( z ) ( (INT8)( ( z + 10 ) / HEIGHT_UNITS ) ) //#define OBJECT_DETONATE_ON_IMPACT( object ) ( ( object->Obj.usItem == MORTAR_SHELL ) ) // && ( object->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) // HEADROCK HAM 5: Enabled "Explode on Impact" flag for explosive items -#define OBJECT_DETONATE_ON_IMPACT( object ) ( ( Item[object->Obj.usItem].usItemClass == IC_BOMB ) || ( Explosive[Item[object->Obj.usItem].ubClassIndex ].fExplodeOnImpact ) ) // && ( object->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) - +#define OBJECT_DETONATE_ON_IMPACT( object ) ((Item[object->Obj.usItem].usItemClass == IC_BOMB) || ((Item[object->Obj.usItem].usItemClass & IC_EXPLOSV) && Explosive[Item[object->Obj.usItem].ubClassIndex].fExplodeOnImpact)) #define MAX_INTEGRATIONS 8 @@ -2168,7 +2167,7 @@ FLOAT CalculateForceFromRange(UINT16 usItem, INT16 sRange, FLOAT dDegrees ) // Buggler: impact explosives requiring larger force to reach desired range due to no bounce // Please change the if conditions too when definition of OBJECT_DETONATE_ON_IMPACT( object ) changes - if ( ( Item[ usItem ].usItemClass == IC_BOMB ) || ( Explosive[ Item[ usItem ].ubClassIndex ].fExplodeOnImpact ) ) // && ( object->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) + if ((Item[usItem].usItemClass == IC_BOMB) || ((Item[usItem].usItemClass & IC_EXPLOSV) && Explosive[Item[usItem].ubClassIndex].fExplodeOnImpact)) // Use a mortar shell objecttype to simulate impact explosives CreateItem( MORTAR_SHELL, 100, &gTempObject ); else