From 085afa7483db6f379fe41dfbe085dd797768734a Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Wed, 9 Apr 2025 17:25:02 +0800 Subject: [PATCH 01/10] Fix the bug that `EnterGrinderSound` on technotype does not used --- CREDITS.md | 2 +- docs/Fixed-or-Improved-Logics.md | 2 +- docs/Whats-New.md | 2 +- src/Misc/Hooks.BugFixes.cpp | 23 +++++++++++++++++++---- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 91d8614057..ee53b1a5ca 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -366,7 +366,7 @@ This page lists all the individual contributions to the project by their author. - Allow voxel projectiles to use `AnimPalette` and `FirersPalette` - Customize damaged speed ratio of drive/ship loco - Customize overpower logic - - Fix the bug that `EnterBioReactorSound` and `LeaveBioReactorSound` on technotype does not used + - Fix the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used - Fix the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead - **Apollo** - Translucent SHP drawing patches - **ststl**: diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index e0360b2de8..d111d17575 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -207,7 +207,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed the bug that healing weapons could not automatically acquire aerial targets. - Allow voxel projectiles to use `AnimPalette` and `FirersPalette`. - Fixed an issue where AI would select unreachable buildings and get stuck when looking for buildings like tank bunkers, bio reactors, etc. -- Fix the bug that `EnterBioReactorSound` and `LeaveBioReactorSound` on technotype does not used. +- Fix the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used. - Fix the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 69d656a048..5bc1444752 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -356,7 +356,7 @@ New: - [Customize damaged speed ratio of drive/ship loco](Fixed-or-Improved-Logics.md#damaged-speed-customization) (by NetsuNegi) - [Customize overpower logic](Fixed-or-Improved-Logics.md#customize-overpower-logic) (by NetsuNegi) - Promotion animation deglobalization (by Ollerus) -- Fix the bug that `EnterBioReactorSound` and `LeaveBioReactorSound` on technotype does not used (by NetsuNegi) +- Fix the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used (by NetsuNegi) - Fix the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead (by NetsuNegi) Vanilla fixes: diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index b803590b06..c83e116682 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -1764,12 +1764,27 @@ DEFINE_HOOK(0x4DFB28, FootClass_FindGrinder_CheckValid, 0x8) #pragma endregion +DEFINE_HOOK_AGAIN(0x73A1D3, FootClass_UpdatePosition_EnterGrinderSound, 0x6)// UnitClass +DEFINE_HOOK(0x5198C3, FootClass_UpdatePosition_EnterGrinderSound, 0x6)// InfantryClass +{ + GET(BuildingClass*, pGrinder, EBX); + const int enterSound = pGrinder->Type->EnterGrinderSound; + + if (enterSound >= 0) + { + R->ECX(enterSound); + return R->Origin() + 0x6; + } + + return 0; +} + DEFINE_HOOK(0x51A304, InfantryClass_UpdatePosition_EnterBioReactorSound, 0x6) { enum { SkipGameCode = 0x51A30A }; - GET(BuildingClass*, pThis, EDI); - const int enterSound = pThis->Type->EnterBioReactorSound; + GET(BuildingClass*, pReactor, EDI); + const int enterSound = pReactor->Type->EnterBioReactorSound; if (enterSound >= 0) { @@ -1784,8 +1799,8 @@ DEFINE_HOOK(0x44DBCF, BuildingClass_Mission_Unload_LeaveBioReactorSound, 0x6) { enum { SkipGameCode = 0x44DBD5 }; - GET(BuildingClass*, pThis, EBP); - const int leaveSound = pThis->Type->LeaveBioReactorSound; + GET(BuildingClass*, pReactor, EBP); + const int leaveSound = pReactor->Type->LeaveBioReactorSound; if (leaveSound >= 0) { From 380fb290c25f3418bb6ef61c8d4beff1cb890f9d Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 13:44:24 +0800 Subject: [PATCH 02/10] initial --- CREDITS.md | 1 + docs/New-or-Enhanced-Logics.md | 32 +++++++++++++++++++ docs/Whats-New.md | 1 + src/Ext/Bullet/Body.cpp | 2 ++ src/Ext/Bullet/Body.h | 5 +++ src/Ext/Bullet/Hooks.cpp | 3 ++ .../Bullet/Trajectories/PhobosTrajectory.cpp | 12 +++++++ src/Ext/Rules/Body.cpp | 13 ++++++++ src/Ext/Rules/Body.h | 15 +++++++++ src/Ext/Techno/Hooks.ReceiveDamage.cpp | 15 +++++++++ src/Ext/TechnoType/Body.cpp | 14 ++++++++ src/Ext/TechnoType/Body.h | 7 ++++ src/Ext/WarheadType/Body.cpp | 7 ++++ src/Ext/WarheadType/Body.h | 5 +++ src/Ext/WarheadType/Hooks.cpp | 2 ++ 15 files changed, 134 insertions(+) diff --git a/CREDITS.md b/CREDITS.md index ee53b1a5ca..ec5a71b156 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -368,6 +368,7 @@ This page lists all the individual contributions to the project by their author. - Customize overpower logic - Fix the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used - Fix the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead + - Directional armor - **Apollo** - Translucent SHP drawing patches - **ststl**: - Customizable `ShowTimer` priority of superweapons diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 53305db677..7d2cfe5a29 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1732,6 +1732,38 @@ WaterImage.ConditionRed= ; VehicleType entry Note that the VehicleTypes had to be defined under [VehicleTypes] and use same image type (SHP/VXL) for vanilla/damaged states. ``` +### Directional armor + +- The damage suffered by the vehicle can now be affected by the hit direction. +- The front and rear judgment ranges are always symmetrical. A front angle of 0.5 indicates that the front direction is the axis, and the 45 degree angle range on both sides belongs to the front judgment range. +A front angle of 1.0 indicates that the 90 degree angle range on both sides belongs to the front judgment range; +- The lateral range refers to the remaining angle range after excluding the front and back sides. +- The warhead needs to have 'Directional=true' to enable this effect. +- `Directional. Multiplier is an additional multiplier used to control the intensity of the effect. + +In `rulesmd.ini` +```ini +[CombatDamage] +DirectionalArmor=false ; boolean +DirectionalArmor.FrontMultiplier=1.0 ; float +DirectionalArmor.SideMultiplier=1.0 ; float +DirectionalArmor.BackMultiplier=1.0 ; float +DirectionalArmor.FrontField=0.5 ; float +DirectionalArmor.BackField=0.5 ; float + +[SOMEVEHICLE] ; VehicleType +DirectionalArmor= ; boolean +DirectionalArmor.FrontMultiplier= ; float +DirectionalArmor.SideMultiplier= ; float +DirectionalArmor.BackMultiplier= ; float +DirectionalArmor.FrontField= ; float +DirectionalArmor.BackField= ; float + +[SOMEWARHEAD] +Directional=false ; boolean +Directional.Multiplier=1.0 ; float +``` + ## Warheads ```{hint} diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 5bc1444752..163106289c 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -358,6 +358,7 @@ New: - Promotion animation deglobalization (by Ollerus) - Fix the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used (by NetsuNegi) - Fix the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead (by NetsuNegi) +- Directional armor (by NetsuNegi) Vanilla fixes: - Prevent the units with locomotors that cause problems from entering the tank bunker (by TaranDahl) diff --git a/src/Ext/Bullet/Body.cpp b/src/Ext/Bullet/Body.cpp index ad7154382a..e5f55ca1f1 100644 --- a/src/Ext/Bullet/Body.cpp +++ b/src/Ext/Bullet/Body.cpp @@ -378,6 +378,8 @@ void BulletExt::ExtData::Serialize(T& Stm) .Process(this->LaserTrails) .Process(this->SnappedToTarget) .Process(this->DamageNumberOffset) + .Process(this->ShouldDirectional) + .Process(this->BulletDirection) .Process(this->Trajectory) // Keep this shit at last ; diff --git a/src/Ext/Bullet/Body.h b/src/Ext/Bullet/Body.h index 2bc3d6c33d..041b7a90d4 100644 --- a/src/Ext/Bullet/Body.h +++ b/src/Ext/Bullet/Body.h @@ -29,6 +29,9 @@ class BulletExt bool SnappedToTarget; // Used for custom trajectory projectile target snap checks int DamageNumberOffset; + bool ShouldDirectional; + int BulletDirection; + TrajectoryPointer Trajectory; ExtData(BulletClass* OwnerObject) : Extension(OwnerObject) @@ -42,6 +45,8 @@ class BulletExt , Trajectory { nullptr } , SnappedToTarget { false } , DamageNumberOffset { INT32_MIN } + , ShouldDirectional { false } + , BulletDirection { -1 } { } virtual ~ExtData() = default; diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index b26b465155..d446e9df71 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -40,6 +40,9 @@ DEFINE_HOOK(0x4666F7, BulletClass_AI, 0x6) BulletAITemp::ExtData = pBulletExt; BulletAITemp::TypeExtData = pBulletExt->TypeExtData; + if (pBulletExt->ShouldDirectional) + pBulletExt->BulletDirection = DirStruct((-1) * Math::atan2(pThis->Velocity.Y, pThis->Velocity.X)).GetValue<16>(); + if (pBulletExt->InterceptedStatus == InterceptedStatus::Intercepted) { if (pBulletExt->DetonateOnInterception) diff --git a/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp b/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp index cd405e5825..e02983a363 100644 --- a/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp +++ b/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -573,5 +574,16 @@ DEFINE_HOOK(0x468B72, BulletClass_Unlimbo_Trajectories, 0x5) pExt->Trajectory->OnUnlimbo(pThis, pCoord, pVelocity); } + if (pThis->Owner && !pThis->Type->Vertical && pThis->SourceCoords != pThis->TargetCoords && pThis->WH) + { + const auto pWHExt = WarheadTypeExt::ExtMap.Find(pThis->WH); + + if (pWHExt->Directional) + { + pExt->ShouldDirectional = true; + pExt->BulletDirection = DirStruct(Math::atan2(static_cast(pThis->SourceCoords.Y - pThis->TargetCoords.Y), static_cast(pThis->TargetCoords.X - pThis->SourceCoords.X))).GetValue<16>(); + } + } + return 0; } diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 3178c0ab06..c0d12cd1aa 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -204,6 +204,13 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->DamageAlliesMultiplier.Read(exINI, GameStrings::CombatDamage, "DamageAlliesMultiplier"); this->DamageEnemiesMultiplier.Read(exINI, GameStrings::CombatDamage, "DamageEnemiesMultiplier"); + this->DirectionalArmor.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor"); + this->DirectionalArmor_FrontMultiplier.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor.FrontMultiplier"); + this->DirectionalArmor_SideMultiplier.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor.SideMultiplier"); + this->DirectionalArmor_BackMultiplier.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor.BackMultiplier"); + this->DirectionalArmor_FrontField.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor.FrontField"); + this->DirectionalArmor_BackField.Read(exINI, GameStrings::CombatDamage, "DirectionalArmor.BackField"); + this->AircraftLevelLightMultiplier.Read(exINI, GameStrings::AudioVisual, "AircraftLevelLightMultiplier"); this->JumpjetLevelLightMultiplier.Read(exINI, GameStrings::AudioVisual, "JumpjetLevelLightMultiplier"); @@ -429,6 +436,12 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->DamageOwnerMultiplier) .Process(this->DamageAlliesMultiplier) .Process(this->DamageEnemiesMultiplier) + .Process(this->DirectionalArmor) + .Process(this->DirectionalArmor_FrontMultiplier) + .Process(this->DirectionalArmor_SideMultiplier) + .Process(this->DirectionalArmor_BackMultiplier) + .Process(this->DirectionalArmor_FrontField) + .Process(this->DirectionalArmor_BackField) .Process(this->AircraftLevelLightMultiplier) .Process(this->JumpjetLevelLightMultiplier) .Process(this->VoxelLightSource) diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index b4a5d764c2..7adf8de812 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -162,6 +162,13 @@ class RulesExt Valueable DamageAlliesMultiplier; Valueable DamageEnemiesMultiplier; + Valueable DirectionalArmor; + Valueable DirectionalArmor_FrontMultiplier; + Valueable DirectionalArmor_SideMultiplier; + Valueable DirectionalArmor_BackMultiplier; + Valueable DirectionalArmor_FrontField; + Valueable DirectionalArmor_BackField; + Valueable AircraftLevelLightMultiplier; Valueable JumpjetLevelLightMultiplier; @@ -325,6 +332,14 @@ class RulesExt , DamageOwnerMultiplier { 1.0 } , DamageAlliesMultiplier { 1.0 } , DamageEnemiesMultiplier { 1.0 } + + , DirectionalArmor { false } + , DirectionalArmor_FrontMultiplier { 1.0 } + , DirectionalArmor_SideMultiplier { 1.0 } + , DirectionalArmor_BackMultiplier { 1.0 } + , DirectionalArmor_FrontField { 0.5 } + , DirectionalArmor_BackField { 0.5 } + , AircraftLevelLightMultiplier { 1.0 } , JumpjetLevelLightMultiplier { 0.0 } , VoxelLightSource { } diff --git a/src/Ext/Techno/Hooks.ReceiveDamage.cpp b/src/Ext/Techno/Hooks.ReceiveDamage.cpp index bbdb14dd42..7189cd137b 100644 --- a/src/Ext/Techno/Hooks.ReceiveDamage.cpp +++ b/src/Ext/Techno/Hooks.ReceiveDamage.cpp @@ -40,6 +40,21 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6) else multiplier = pWHExt->DamageOwnerMultiplier.Get(pRules->DamageOwnerMultiplier); + if (pTypeExt->DirectionalArmor.Get(RulesExt::Global()->DirectionalArmor) && pThis->WhatAmI() == AbstractType::Unit && pWHExt->HitDirection >= 0 && args->DistanceToEpicenter <= 64) + { + const int tarFacing = pThis->PrimaryFacing.Current().GetValue<16>(); + const int angle = abs(pWHExt->HitDirection - tarFacing); + const int frontField = static_cast(16384 * pTypeExt->DirectionalArmor_FrontField.Get(RulesExt::Global()->DirectionalArmor_FrontField)); + const int backField = static_cast(16384 * pTypeExt->DirectionalArmor_BackField.Get(RulesExt::Global()->DirectionalArmor_BackField)); + + if (angle >= 32768 - frontField && angle <= 32768 + frontField) + multiplier *= pTypeExt->DirectionalArmor_FrontMultiplier.Get(RulesExt::Global()->DirectionalArmor_FrontMultiplier) * pWHExt->Directional_Multiplier; + else if ((angle < backField && angle >= 0) || (angle > 49152 + backField && angle <= 65536)) + multiplier *= pTypeExt->DirectionalArmor_BackMultiplier.Get(RulesExt::Global()->DirectionalArmor_BackMultiplier) * pWHExt->Directional_Multiplier; + else + multiplier *= pTypeExt->DirectionalArmor_SideMultiplier.Get(RulesExt::Global()->DirectionalArmor_SideMultiplier) * pWHExt->Directional_Multiplier; + } + if (multiplier != 1.0) { const auto sgnDamage = *args->Damage > 0 ? 1 : -1; diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index 7886a6e243..066bd5c487 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -485,6 +485,13 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->KeepTargetOnMove.Read(exINI, pSection, "KeepTargetOnMove"); this->KeepTargetOnMove_ExtraDistance.Read(exINI, pSection, "KeepTargetOnMove.ExtraDistance"); + this->DirectionalArmor.Read(exINI, pSection, "DirectionalArmor"); + this->DirectionalArmor_FrontMultiplier.Read(exINI, pSection, "DirectionalArmor.FrontMultiplier"); + this->DirectionalArmor_SideMultiplier.Read(exINI, pSection, "DirectionalArmor.SideMultiplier"); + this->DirectionalArmor_BackMultiplier.Read(exINI, pSection, "DirectionalArmor.BackMultiplier"); + this->DirectionalArmor_FrontField.Read(exINI, pSection, "DirectionalArmor.FrontField"); + this->DirectionalArmor_BackField.Read(exINI, pSection, "DirectionalArmor.BackField"); + this->Power.Read(exINI, pSection, "Power"); this->Image_ConditionYellow.Read(exINI, pSection, "Image.ConditionYellow"); @@ -917,6 +924,13 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->KeepTargetOnMove) .Process(this->KeepTargetOnMove_ExtraDistance) + .Process(this->DirectionalArmor) + .Process(this->DirectionalArmor_FrontMultiplier) + .Process(this->DirectionalArmor_SideMultiplier) + .Process(this->DirectionalArmor_BackMultiplier) + .Process(this->DirectionalArmor_FrontField) + .Process(this->DirectionalArmor_BackField) + .Process(this->Power) .Process(this->Image_ConditionYellow) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index 12f4ba32da..702c035811 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -260,6 +260,13 @@ class TechnoTypeExt Valueable KeepTargetOnMove; Valueable KeepTargetOnMove_ExtraDistance; + Nullable DirectionalArmor {}; + Nullable DirectionalArmor_FrontMultiplier {}; + Nullable DirectionalArmor_SideMultiplier {}; + Nullable DirectionalArmor_BackMultiplier {}; + Nullable DirectionalArmor_FrontField {}; + Nullable DirectionalArmor_BackField {}; + Valueable Power; Nullable Image_ConditionYellow; diff --git a/src/Ext/WarheadType/Body.cpp b/src/Ext/WarheadType/Body.cpp index 51cef74b6e..a23caad338 100644 --- a/src/Ext/WarheadType/Body.cpp +++ b/src/Ext/WarheadType/Body.cpp @@ -235,6 +235,9 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Shield_Respawn_Types.Read(exINI, pSection, "Shield.Respawn.Types"); this->Shield_SelfHealing_Types.Read(exINI, pSection, "Shield.SelfHealing.Types"); + this->Directional.Read(exINI, pSection, "Directional"); + this->Directional_Multiplier.Read(exINI, pSection, "Directional.Multiplier"); + this->NotHuman_DeathSequence.Read(exINI, pSection, "NotHuman.DeathSequence"); this->LaunchSW.Read(exINI, pSection, "LaunchSW"); this->LaunchSW_RealLaunch.Read(exINI, pSection, "LaunchSW.RealLaunch"); @@ -472,6 +475,9 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm) .Process(this->Shield_Respawn_Types) .Process(this->Shield_SelfHealing_Types) + .Process(this->Directional) + .Process(this->Directional_Multiplier) + .Process(this->SpawnsCrate_Types) .Process(this->SpawnsCrate_Weights) @@ -543,6 +549,7 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm) .Process(this->PossibleCellSpreadDetonate) .Process(this->Reflected) .Process(this->DamageAreaTarget) + .Process(this->HitDirection) ; } diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index ed570b8b55..f4afecc609 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -113,6 +113,9 @@ class WarheadTypeExt NullableVector Shield_Respawn_Types; NullableVector Shield_SelfHealing_Types; + Valueable Directional { false }; + Valueable Directional_Multiplier { 1.0 }; + Valueable NotHuman_DeathSequence; ValueableIdxVector LaunchSW; Valueable LaunchSW_RealLaunch; @@ -187,6 +190,7 @@ class WarheadTypeExt int RemainingAnimCreationInterval; bool PossibleCellSpreadDetonate; TechnoClass* DamageAreaTarget; + int HitDirection; private: Valueable Shield_Respawn_Rate_InMinutes; @@ -353,6 +357,7 @@ class WarheadTypeExt , RemainingAnimCreationInterval { 0 } , PossibleCellSpreadDetonate { false } , DamageAreaTarget {} + , HitDirection { -1 } , KillWeapon {} , KillWeapon_OnFirer {} diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index 6f0bd4241f..acdf9bee92 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -21,6 +21,8 @@ DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6) auto const pOwner = pBullet->Owner; auto const pHouse = pOwner ? pOwner->Owner : nullptr; auto const pDecidedHouse = pHouse ? pHouse : pBulletExt->FirerHouse; + + pWHExt->HitDirection = pBulletExt->BulletDirection; pWHExt->Detonate(pOwner, pDecidedHouse, pBulletExt, *pCoords); pWHExt->InDamageArea = false; From 08f530dc4c8a42ae057c08f58a6031e404a9a4c3 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 13:48:56 +0800 Subject: [PATCH 03/10] docs align --- docs/New-or-Enhanced-Logics.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 7d2cfe5a29..1438eb6e74 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1747,21 +1747,21 @@ In `rulesmd.ini` DirectionalArmor=false ; boolean DirectionalArmor.FrontMultiplier=1.0 ; float DirectionalArmor.SideMultiplier=1.0 ; float -DirectionalArmor.BackMultiplier=1.0 ; float -DirectionalArmor.FrontField=0.5 ; float +DirectionalArmor.BackMultiplier=1.0 ; float +DirectionalArmor.FrontField=0.5 ; float DirectionalArmor.BackField=0.5 ; float -[SOMEVEHICLE] ; VehicleType -DirectionalArmor= ; boolean -DirectionalArmor.FrontMultiplier= ; float -DirectionalArmor.SideMultiplier= ; float -DirectionalArmor.BackMultiplier= ; float -DirectionalArmor.FrontField= ; float -DirectionalArmor.BackField= ; float +[SOMEVEHICLE] ; VehicleType +DirectionalArmor= ; boolean +DirectionalArmor.FrontMultiplier= ; float +DirectionalArmor.SideMultiplier= ; float +DirectionalArmor.BackMultiplier= ; float +DirectionalArmor.FrontField= ; float +DirectionalArmor.BackField= ; float [SOMEWARHEAD] -Directional=false ; boolean -Directional.Multiplier=1.0 ; float +Directional=false ; boolean +Directional.Multiplier=1.0 ; float ``` ## Warheads From dbfcf95a2ff5d2c6072c58ddb7dffe008b3d6f97 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 13:54:36 +0800 Subject: [PATCH 04/10] fix docs --- docs/New-or-Enhanced-Logics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index e42b7aa8a0..45dc2c2532 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1748,8 +1748,8 @@ Note that the VehicleTypes had to be defined under [VehicleTypes] and use same i - The front and rear judgment ranges are always symmetrical. A front angle of 0.5 indicates that the front direction is the axis, and the 45 degree angle range on both sides belongs to the front judgment range. A front angle of 1.0 indicates that the 90 degree angle range on both sides belongs to the front judgment range; - The lateral range refers to the remaining angle range after excluding the front and back sides. -- The warhead needs to have 'Directional=true' to enable this effect. -- `Directional. Multiplier is an additional multiplier used to control the intensity of the effect. +- The warhead needs to have `Directional=true` to enable this effect. +- `Directional.Multiplier` is an additional multiplier used to control the intensity of the effect. In `rulesmd.ini` ```ini From 8c616db7b213e7e37c6bf8f40ff540475b7e632e Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 22:00:15 +0800 Subject: [PATCH 05/10] update --- src/Ext/TechnoType/Body.h | 19 +++++++++++++------ src/Ext/WarheadType/Body.h | 7 +++++-- src/Ext/WarheadType/Hooks.cpp | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index d2cbd1500e..241abe61b2 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -266,12 +266,12 @@ class TechnoTypeExt Valueable KeepTargetOnMove; Valueable KeepTargetOnMove_ExtraDistance; - Nullable DirectionalArmor {}; - Nullable DirectionalArmor_FrontMultiplier {}; - Nullable DirectionalArmor_SideMultiplier {}; - Nullable DirectionalArmor_BackMultiplier {}; - Nullable DirectionalArmor_FrontField {}; - Nullable DirectionalArmor_BackField {}; + Nullable DirectionalArmor; + Nullable DirectionalArmor_FrontMultiplier; + Nullable DirectionalArmor_SideMultiplier; + Nullable DirectionalArmor_BackMultiplier; + Nullable DirectionalArmor_FrontField; + Nullable DirectionalArmor_BackField; Valueable Power; @@ -561,6 +561,13 @@ class TechnoTypeExt , KeepTargetOnMove { false } , KeepTargetOnMove_ExtraDistance { Leptons(0) } + , DirectionalArmor {} + , DirectionalArmor_FrontMultiplier {} + , DirectionalArmor_SideMultiplier {} + , DirectionalArmor_BackMultiplier {} + , DirectionalArmor_FrontField {} + , DirectionalArmor_BackField {} + , Power { } , Image_ConditionYellow { } diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index 47d5cd3ee5..4d3ad3309c 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -113,8 +113,8 @@ class WarheadTypeExt NullableVector Shield_Respawn_Types; NullableVector Shield_SelfHealing_Types; - Valueable Directional { false }; - Valueable Directional_Multiplier { 1.0 }; + Valueable Directional; + Valueable Directional_Multiplier; Valueable NotHuman_DeathSequence; ValueableIdxVector LaunchSW; @@ -287,6 +287,9 @@ class WarheadTypeExt , Shield_Respawn_Types {} , Shield_SelfHealing_Types {} + , Directional { false} + , Directional_Multiplier { 1.0 } + , SpawnsCrate_Types {} , SpawnsCrate_Weights {} diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index acdf9bee92..b62530afed 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -41,6 +41,7 @@ DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6) GET_BASE(HouseClass*, pHouse, 0x14); auto const pDecidedHouse = !pHouse && pOwner ? pOwner->Owner : pHouse; + pWHExt->HitDirection = -1; pWHExt->Detonate(pOwner, pDecidedHouse, nullptr, *pCoords); } From 98762c87e0c8302854e9517704227553bfd8bca7 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 22:13:49 +0800 Subject: [PATCH 06/10] update HitDirection's reset --- src/Ext/WarheadType/Hooks.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index b62530afed..c4772ce6ad 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -29,6 +29,15 @@ DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6) return 0; } +DEFINE_HOOK(0x469AA4, BulletClass_Detonate_ResetHitDirection, 0x5) +{ + GET(BulletClass* const, pBullet, ESI); + + WarheadTypeExt::ExtMap.Find(pBullet->WH)->HitDirection = -1; + + return 0; +} + DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6) { GET_BASE(const WarheadTypeClass*, pWH, 0x0C); @@ -41,7 +50,6 @@ DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6) GET_BASE(HouseClass*, pHouse, 0x14); auto const pDecidedHouse = !pHouse && pOwner ? pOwner->Owner : pHouse; - pWHExt->HitDirection = -1; pWHExt->Detonate(pOwner, pDecidedHouse, nullptr, *pCoords); } From 7f96b913749bc85801a967448eea9f63c3067b09 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Fri, 11 Apr 2025 22:36:39 +0800 Subject: [PATCH 07/10] this should be better --- src/Ext/WarheadType/Hooks.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index c4772ce6ad..52551506d2 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -22,20 +22,30 @@ DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6) auto const pHouse = pOwner ? pOwner->Owner : nullptr; auto const pDecidedHouse = pHouse ? pHouse : pBulletExt->FirerHouse; - pWHExt->HitDirection = pBulletExt->BulletDirection; pWHExt->Detonate(pOwner, pDecidedHouse, pBulletExt, *pCoords); pWHExt->InDamageArea = false; return 0; } -DEFINE_HOOK(0x469AA4, BulletClass_Detonate_ResetHitDirection, 0x5) +DEFINE_HOOK(0x469A69, BulletClass_Detonate_DamageArea, 0x6) { - GET(BulletClass* const, pBullet, ESI); + enum { SkipGameCode = 0x469A88 }; - WarheadTypeExt::ExtMap.Find(pBullet->WH)->HitDirection = -1; + GET(BulletClass*, pBullet, ESI); + GET(TechnoClass*, pSourceTechno, EAX); + GET(int, damage, EDX); + GET_BASE(CoordStruct*, coords, 0x8); + const auto pBulletExt = BulletExt::ExtMap.Find(pBullet); + const auto pSourceHouse = pSourceTechno ? pSourceTechno->Owner : pBulletExt->FirerHouse; + const auto pWH = pBullet->WH; + const auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH); - return 0; + pWHExt->HitDirection = pBulletExt->BulletDirection; + R->EAX(MapClass::Instance.DamageArea(*coords, damage, pSourceTechno, pWH, true, pSourceHouse)); + pWHExt->HitDirection = -1; + + return SkipGameCode; } DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6) From be487d3f67c000f1396d4a329cfc5fb1e5f2c192 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Sat, 12 Apr 2025 09:31:08 +0800 Subject: [PATCH 08/10] optimize --- src/Ext/Bullet/Body.cpp | 2 -- src/Ext/Bullet/Body.h | 5 ---- src/Ext/Bullet/Hooks.cpp | 3 --- .../Bullet/Trajectories/PhobosTrajectory.cpp | 11 -------- src/Ext/WarheadType/Hooks.cpp | 27 ++++++++++++++++++- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/Ext/Bullet/Body.cpp b/src/Ext/Bullet/Body.cpp index e5f55ca1f1..ad7154382a 100644 --- a/src/Ext/Bullet/Body.cpp +++ b/src/Ext/Bullet/Body.cpp @@ -378,8 +378,6 @@ void BulletExt::ExtData::Serialize(T& Stm) .Process(this->LaserTrails) .Process(this->SnappedToTarget) .Process(this->DamageNumberOffset) - .Process(this->ShouldDirectional) - .Process(this->BulletDirection) .Process(this->Trajectory) // Keep this shit at last ; diff --git a/src/Ext/Bullet/Body.h b/src/Ext/Bullet/Body.h index 041b7a90d4..2bc3d6c33d 100644 --- a/src/Ext/Bullet/Body.h +++ b/src/Ext/Bullet/Body.h @@ -29,9 +29,6 @@ class BulletExt bool SnappedToTarget; // Used for custom trajectory projectile target snap checks int DamageNumberOffset; - bool ShouldDirectional; - int BulletDirection; - TrajectoryPointer Trajectory; ExtData(BulletClass* OwnerObject) : Extension(OwnerObject) @@ -45,8 +42,6 @@ class BulletExt , Trajectory { nullptr } , SnappedToTarget { false } , DamageNumberOffset { INT32_MIN } - , ShouldDirectional { false } - , BulletDirection { -1 } { } virtual ~ExtData() = default; diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index d446e9df71..b26b465155 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -40,9 +40,6 @@ DEFINE_HOOK(0x4666F7, BulletClass_AI, 0x6) BulletAITemp::ExtData = pBulletExt; BulletAITemp::TypeExtData = pBulletExt->TypeExtData; - if (pBulletExt->ShouldDirectional) - pBulletExt->BulletDirection = DirStruct((-1) * Math::atan2(pThis->Velocity.Y, pThis->Velocity.X)).GetValue<16>(); - if (pBulletExt->InterceptedStatus == InterceptedStatus::Intercepted) { if (pBulletExt->DetonateOnInterception) diff --git a/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp b/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp index e02983a363..7dc16a7ee9 100644 --- a/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp +++ b/src/Ext/Bullet/Trajectories/PhobosTrajectory.cpp @@ -574,16 +574,5 @@ DEFINE_HOOK(0x468B72, BulletClass_Unlimbo_Trajectories, 0x5) pExt->Trajectory->OnUnlimbo(pThis, pCoord, pVelocity); } - if (pThis->Owner && !pThis->Type->Vertical && pThis->SourceCoords != pThis->TargetCoords && pThis->WH) - { - const auto pWHExt = WarheadTypeExt::ExtMap.Find(pThis->WH); - - if (pWHExt->Directional) - { - pExt->ShouldDirectional = true; - pExt->BulletDirection = DirStruct(Math::atan2(static_cast(pThis->SourceCoords.Y - pThis->TargetCoords.Y), static_cast(pThis->TargetCoords.X - pThis->SourceCoords.X))).GetValue<16>(); - } - } - return 0; } diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index 52551506d2..8aa387829a 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -41,7 +41,32 @@ DEFINE_HOOK(0x469A69, BulletClass_Detonate_DamageArea, 0x6) const auto pWH = pBullet->WH; const auto pWHExt = WarheadTypeExt::ExtMap.Find(pWH); - pWHExt->HitDirection = pBulletExt->BulletDirection; + do + { + if (pWHExt->Directional) + { + if (pBullet->Type->Inviso) + { + if (pBullet->SourceCoords.X != pBullet->TargetCoords.X || pBullet->SourceCoords.Y != pBullet->TargetCoords.Y) + { + pWHExt->HitDirection = DirStruct(Math::atan2(static_cast(pBullet->SourceCoords.Y - pBullet->TargetCoords.Y), static_cast(pBullet->TargetCoords.X - pBullet->SourceCoords.X))).GetValue<16>(); + break; + } + } + else + { + if (pBullet->Velocity.X != 0.0 || pBullet->Velocity.Y != 0.0) + { + pWHExt->HitDirection = DirStruct((-1) * Math::atan2(pBullet->Velocity.Y, pBullet->Velocity.X)).GetValue<16>(); + break; + } + } + } + + pWHExt->HitDirection = -1; + } + while (false); + R->EAX(MapClass::Instance.DamageArea(*coords, damage, pSourceTechno, pWH, true, pSourceHouse)); pWHExt->HitDirection = -1; From 39a54c77c704486b8ea9d8f0e2504a99ff3581c1 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Mon, 14 Apr 2025 19:50:30 +0800 Subject: [PATCH 09/10] changes --- src/Ext/Rules/Body.h | 10 +++++----- src/Ext/TechnoType/Body.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index 7adf8de812..9c1dd9bc99 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -163,11 +163,11 @@ class RulesExt Valueable DamageEnemiesMultiplier; Valueable DirectionalArmor; - Valueable DirectionalArmor_FrontMultiplier; - Valueable DirectionalArmor_SideMultiplier; - Valueable DirectionalArmor_BackMultiplier; - Valueable DirectionalArmor_FrontField; - Valueable DirectionalArmor_BackField; + Valueable DirectionalArmor_FrontMultiplier; + Valueable DirectionalArmor_SideMultiplier; + Valueable DirectionalArmor_BackMultiplier; + Valueable DirectionalArmor_FrontField; + Valueable DirectionalArmor_BackField; Valueable AircraftLevelLightMultiplier; Valueable JumpjetLevelLightMultiplier; diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index c3c3eb9159..7edd04a46a 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -274,11 +274,11 @@ class TechnoTypeExt Valueable KeepTargetOnMove_ExtraDistance; Nullable DirectionalArmor; - Nullable DirectionalArmor_FrontMultiplier; - Nullable DirectionalArmor_SideMultiplier; - Nullable DirectionalArmor_BackMultiplier; - Nullable DirectionalArmor_FrontField; - Nullable DirectionalArmor_BackField; + Nullable DirectionalArmor_FrontMultiplier; + Nullable DirectionalArmor_SideMultiplier; + Nullable DirectionalArmor_BackMultiplier; + Nullable DirectionalArmor_FrontField; + Nullable DirectionalArmor_BackField; Valueable Power; From 6e916e49f070f0c1d931a8634425c67a5997833a Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Mon, 21 Apr 2025 16:42:21 +0800 Subject: [PATCH 10/10] update --- src/Ext/Techno/Hooks.ReceiveDamage.cpp | 4 ++-- src/Ext/WarheadType/Body.cpp | 1 - src/Ext/WarheadType/Body.h | 4 ++-- src/Ext/WarheadType/Hooks.cpp | 9 +++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Ext/Techno/Hooks.ReceiveDamage.cpp b/src/Ext/Techno/Hooks.ReceiveDamage.cpp index 977807f7f8..a661191dbf 100644 --- a/src/Ext/Techno/Hooks.ReceiveDamage.cpp +++ b/src/Ext/Techno/Hooks.ReceiveDamage.cpp @@ -40,10 +40,10 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6) else multiplier = pWHExt->DamageOwnerMultiplier.Get(pRules->DamageOwnerMultiplier); - if (pTypeExt->DirectionalArmor.Get(RulesExt::Global()->DirectionalArmor) && pThis->WhatAmI() == AbstractType::Unit && pWHExt->HitDirection >= 0 && args->DistanceToEpicenter <= 64) + if (pTypeExt->DirectionalArmor.Get(RulesExt::Global()->DirectionalArmor) && pThis->WhatAmI() == AbstractType::Unit && WarheadTypeExt::HitDirection >= 0 && args->DistanceToEpicenter <= 64) { const int tarFacing = pThis->PrimaryFacing.Current().GetValue<16>(); - const int angle = abs(pWHExt->HitDirection - tarFacing); + const int angle = abs(WarheadTypeExt::HitDirection - tarFacing); const int frontField = static_cast(16384 * pTypeExt->DirectionalArmor_FrontField.Get(RulesExt::Global()->DirectionalArmor_FrontField)); const int backField = static_cast(16384 * pTypeExt->DirectionalArmor_BackField.Get(RulesExt::Global()->DirectionalArmor_BackField)); diff --git a/src/Ext/WarheadType/Body.cpp b/src/Ext/WarheadType/Body.cpp index 1e666d5a84..4469dd9076 100644 --- a/src/Ext/WarheadType/Body.cpp +++ b/src/Ext/WarheadType/Body.cpp @@ -555,7 +555,6 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm) .Process(this->PossibleCellSpreadDetonate) .Process(this->Reflected) .Process(this->DamageAreaTarget) - .Process(this->HitDirection) ; } diff --git a/src/Ext/WarheadType/Body.h b/src/Ext/WarheadType/Body.h index 0cd88c2d05..97acb72535 100644 --- a/src/Ext/WarheadType/Body.h +++ b/src/Ext/WarheadType/Body.h @@ -193,7 +193,6 @@ class WarheadTypeExt int RemainingAnimCreationInterval; bool PossibleCellSpreadDetonate; TechnoClass* DamageAreaTarget; - int HitDirection; private: Valueable Shield_Respawn_Rate_InMinutes; @@ -364,7 +363,6 @@ class WarheadTypeExt , RemainingAnimCreationInterval { 0 } , PossibleCellSpreadDetonate { false } , DamageAreaTarget {} - , HitDirection { -1 } , KillWeapon {} , KillWeapon_OnFirer {} @@ -417,6 +415,8 @@ class WarheadTypeExt }; static ExtContainer ExtMap; + static int HitDirection; + static bool LoadGlobals(PhobosStreamReader& Stm); static bool SaveGlobals(PhobosStreamWriter& Stm); diff --git a/src/Ext/WarheadType/Hooks.cpp b/src/Ext/WarheadType/Hooks.cpp index 8aa387829a..a6c9e178e0 100644 --- a/src/Ext/WarheadType/Hooks.cpp +++ b/src/Ext/WarheadType/Hooks.cpp @@ -10,6 +10,7 @@ #include #pragma region Detonation +int WarheadTypeExt::HitDirection = -1; DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6) { @@ -49,7 +50,7 @@ DEFINE_HOOK(0x469A69, BulletClass_Detonate_DamageArea, 0x6) { if (pBullet->SourceCoords.X != pBullet->TargetCoords.X || pBullet->SourceCoords.Y != pBullet->TargetCoords.Y) { - pWHExt->HitDirection = DirStruct(Math::atan2(static_cast(pBullet->SourceCoords.Y - pBullet->TargetCoords.Y), static_cast(pBullet->TargetCoords.X - pBullet->SourceCoords.X))).GetValue<16>(); + WarheadTypeExt::HitDirection = DirStruct(Math::atan2(static_cast(pBullet->SourceCoords.Y - pBullet->TargetCoords.Y), static_cast(pBullet->TargetCoords.X - pBullet->SourceCoords.X))).GetValue<16>(); break; } } @@ -57,18 +58,18 @@ DEFINE_HOOK(0x469A69, BulletClass_Detonate_DamageArea, 0x6) { if (pBullet->Velocity.X != 0.0 || pBullet->Velocity.Y != 0.0) { - pWHExt->HitDirection = DirStruct((-1) * Math::atan2(pBullet->Velocity.Y, pBullet->Velocity.X)).GetValue<16>(); + WarheadTypeExt::HitDirection = DirStruct((-1) * Math::atan2(pBullet->Velocity.Y, pBullet->Velocity.X)).GetValue<16>(); break; } } } - pWHExt->HitDirection = -1; + WarheadTypeExt::HitDirection = -1; } while (false); R->EAX(MapClass::Instance.DamageArea(*coords, damage, pSourceTechno, pWH, true, pSourceHouse)); - pWHExt->HitDirection = -1; + WarheadTypeExt::HitDirection = -1; return SkipGameCode; }