From e2f8e42f5983adf540fd3a4196c22c816dfb09b6 Mon Sep 17 00:00:00 2001 From: CrimRecya <335958461@qq.com> Date: Sat, 11 Oct 2025 15:35:31 +0800 Subject: [PATCH] Core --- CREDITS.md | 1 + Phobos.vcxproj | 1 + docs/Fixed-or-Improved-Logics.md | 11 +++++++++++ docs/Whats-New.md | 1 + src/Ext/Rules/Body.cpp | 5 ++++- src/Ext/Rules/Body.h | 6 +++++- src/Misc/Hooks.RadarEvent.cpp | 27 +++++++++++++++++++++++++++ 7 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/Misc/Hooks.RadarEvent.cpp diff --git a/CREDITS.md b/CREDITS.md index a89619a151..8b8556f88f 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -550,6 +550,7 @@ This page lists all the individual contributions to the project by their author. - Fix an issue that units' `LaserTrails` will always lags behind by one frame - Fix an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos - Allow the aircraft to enter area guard mission and not crash immediately without any airport + - Ignore center to minor radar event position - **Ollerus**: - Build limit group enhancement - Customizable rocker amplitude diff --git a/Phobos.vcxproj b/Phobos.vcxproj index c8a07539c3..7dfe82ddbd 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -194,6 +194,7 @@ + diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 07396800dd..691a5687cf 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -2376,3 +2376,14 @@ DropPod.Weapon.HitLandOnly= ; boolean, default to no ```{note} `[General] -> DropPodTrailer` is [Ares feature](https://ares-developers.github.io/Ares-docs/new/droppod.html). ``` + +## Radar event + +In vanilla game, any type of radar event will establish a new event position which can be centered when the hotkey is pressed. +Now, by setting `IgnoreCenterMinorRadarEvent` to true, it is possible to skip setting some active and minor event positions (unit produced, unit repaired, building infiltrated, building captured, bridge repaired and garrison abandoned), while passive events are not affected (base attacked, ally base attacked, harvester attacked, superweapon detected, superweapon activated, unit lost, enemy sensed .etc). + +In `rulesmd.ini`: +```ini +[General] +IgnoreCenterMinorRadarEvent=false ; boolean +``` diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 104bb1ede6..4afecf806f 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -452,6 +452,7 @@ New: - [Unlimbo Detonate warhead](New-or-Enhanced-Logics.md#unlimbo-detonate-warhead) (by FlyStar) - Attack and damage technos underground (by TaranDahl) - Fast access structure (by FlyStar) +- Ignore center to minor radar event position (by CrimRecya) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 048086a786..7a270bc53f 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -315,11 +315,13 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->PlayerAttackMoveTargetingDelay.Read(exINI, GameStrings::General, "PlayerAttackMoveTargetingDelay"); this->DistributeTargetingFrame.Read(exINI, GameStrings::General, "DistributeTargetingFrame"); this->DistributeTargetingFrame_AIOnly.Read(exINI, GameStrings::General, "DistributeTargetingFrame.AIOnly"); - + this->InfantryAutoDeploy.Read(exINI, GameStrings::General, "InfantryAutoDeploy"); this->AdjacentWallDamage.Read(exINI, GameStrings::CombatDamage, "AdjacentWallDamage"); + this->IgnoreCenterMinorRadarEvent.Read(exINI, GameStrings::General, "IgnoreCenterMinorRadarEvent"); + // Section AITargetTypes int itemsCount = pINI->GetKeyCount("AITargetTypes"); for (int i = 0; i < itemsCount; ++i) @@ -589,6 +591,7 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->Parasite_GrappleAnim) .Process(this->InfantryAutoDeploy) .Process(this->AdjacentWallDamage) + .Process(this->IgnoreCenterMinorRadarEvent) ; } diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index e082c5d42f..936f37362e 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -270,7 +270,9 @@ class RulesExt Valueable InfantryAutoDeploy; Valueable AdjacentWallDamage; - + + Valueable IgnoreCenterMinorRadarEvent; + ExtData(RulesClass* OwnerObject) : Extension(OwnerObject) , Storage_TiberiumIndex { -1 } , HarvesterDumpAmount { 0.0f } @@ -480,6 +482,8 @@ class RulesExt , Parasite_GrappleAnim {} , InfantryAutoDeploy { false } , AdjacentWallDamage { 200 } + + , IgnoreCenterMinorRadarEvent { false } { } virtual ~ExtData() = default; diff --git a/src/Misc/Hooks.RadarEvent.cpp b/src/Misc/Hooks.RadarEvent.cpp new file mode 100644 index 0000000000..2802565dd7 --- /dev/null +++ b/src/Misc/Hooks.RadarEvent.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +DEFINE_HOOK(0x65FC6E, RadarEventClass_CTOR_SkipSetRadarEventCell, 0x6) +{ + if (!RulesExt::Global()->IgnoreCenterMinorRadarEvent) + return 0; + + GET(RadarEventClass*, pThis, ESI); + + switch (pThis->Type) + { + case RadarEventType::UnitProduced: + case RadarEventType::UnitRepaired: + case RadarEventType::BuildingInfiltrated: + case RadarEventType::BuildingCaptured: + case RadarEventType::BridgeRepaired: + case RadarEventType::GarrisonAbandoned: + break; + default: + return 0; + } + + R->ECX(Make_Global(0xB04DB8)); // RadarEventClass::Array.Count + return 0x65FC9E; +}