@@ -260,8 +260,8 @@ DEFINE_HOOK(0x469C46, BulletClass_Logics_DamageAnimSelected, 0x8)
260
260
if (pAnimType)
261
261
{
262
262
auto const pWHExt = WarheadTypeExt::ExtMap.Find (pThis->WH );
263
- int cellHeight = MapClass::Instance.GetCellFloorHeight (*coords);
264
- auto newCrds = pWHExt->PlayAnimAboveSurface ? CoordStruct{ coords->X , coords->Y , Math::max (cellHeight, coords->Z ) } : *coords;
263
+ const int cellHeight = MapClass::Instance.GetCellFloorHeight (*coords);
264
+ auto const newCrds = pWHExt->PlayAnimAboveSurface ? CoordStruct{ coords->X , coords->Y , Math::max (cellHeight, coords->Z ) } : *coords;
265
265
266
266
if (cellHeight > newCrds.Z && !pWHExt->PlayAnimUnderground )
267
267
{
@@ -795,31 +795,32 @@ DEFINE_HOOK(0x469453, BulletClass_Logics_TemporalUnderGround, 0x6)
795
795
796
796
GET (FootClass*, pTarget, EAX);
797
797
798
- Layer layer = pTarget->InWhichLayer ();
799
-
800
- if (layer != Layer::None)
798
+ if (pTarget->InWhichLayer () != Layer::None)
801
799
return OK;
802
800
803
801
return NotOK;
804
802
}
805
803
806
804
DEFINE_HOOK (0x4899DA , MapClass_DamageArea_DamageUnderGround, 0x7 )
807
805
{
808
- GET_STACK (bool , isNullified, STACK_OFFSET (0xE0 , -0xC9 ));
806
+ GET_STACK (const bool , isNullified, STACK_OFFSET (0xE0 , -0xC9 ));
809
807
GET_STACK (int , damage, STACK_OFFSET (0xE0 , -0xBC ));
810
808
GET_STACK (CoordStruct*, pCrd, STACK_OFFSET (0xE0 , -0xB8 ));
811
809
GET_BASE (WarheadTypeClass*, pWH, 0xC );
812
810
GET_BASE (TechnoClass*, pSrcTechno, 0x8 );
813
811
GET_BASE (HouseClass*, pSrcHouse, 0x14 );
814
812
GET_STACK (bool , hitted, STACK_OFFSET (0xE0 , -0xC1 )); // bHitted = true
815
813
814
+ if (isNullified)
815
+ return 0 ;
816
+
816
817
auto const pWHExt = WarheadTypeExt::ExtMap.Find (pWH);
817
818
818
- if (isNullified || !pWHExt || !pWHExt->AffectsUnderground )
819
+ if (!pWHExt || !pWHExt->AffectsUnderground )
819
820
return 0 ;
820
821
821
822
// bool cylinder = pWHExt->CellSpread_Cylinder;
822
- float spread = pWH->CellSpread ;
823
+ const float spread = pWH->CellSpread ;
823
824
824
825
for (auto const & pTechno : ScenarioExt::Global ()->UndergroundTracker )
825
826
{
@@ -829,14 +830,14 @@ DEFINE_HOOK(0x4899DA, MapClass_DamageArea_DamageUnderGround, 0x7)
829
830
&& !pTechno->InLimbo )
830
831
{
831
832
double dist = 0.0 ;
832
- auto technoCoords = pTechno->GetCoords ();
833
+ auto const technoCoords = pTechno->GetCoords ();
833
834
834
835
// if (cylinder)
835
836
// dist = CoordStruct{ technoCoords.X - pCrd->X, technoCoords.Y - pCrd->Y, 0 }.Magnitude();
836
837
// else
837
838
dist = technoCoords.DistanceFrom (*pCrd);
838
839
839
- if (dist <= spread * 256 )
840
+ if (dist <= spread * Unsorted::LeptonsPerCell )
840
841
{
841
842
pTechno->ReceiveDamage (&damage, (int )dist, pWH, pSrcTechno, false , false , pSrcHouse);
842
843
hitted = true ;
@@ -848,6 +849,4 @@ DEFINE_HOOK(0x4899DA, MapClass_DamageArea_DamageUnderGround, 0x7)
848
849
return 0 ;
849
850
}
850
851
851
-
852
-
853
- #pragma endregion
852
+ #pragma endregion
0 commit comments