diff --git a/CREDITS.md b/CREDITS.md index 299629df77..9b4105fd33 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -520,6 +520,7 @@ This page lists all the individual contributions to the project by their author. - Fix the EIP#007120F7 caused when the `Strength` value is lower than `RepairStep` - Allow the use of more precise calculation of repair costs - Fix the initial direction of building placed by Ares's UnitDelivery superweapon + - Customize default mirage disguises per vehicletypes - **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 cd0b6e4ac1..5a360e70d7 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -2267,6 +2267,16 @@ 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. ``` +### Default mirage disguise for individual VehicleTypes + +- Vehicle can now have its `DefaultMirageDisguises` overridden per-type. + +In `rulesmd.ini`: +```ini +[SOMEVEHICLE] ; VehicleType +DefaultMirageDisguises= ; List of TerrainTypes +``` + ### Independent SHP Vehicle Turret Files - SHP turret vehicles support the use of `*tur.shp` files. diff --git a/docs/Whats-New.md b/docs/Whats-New.md index a50d3f32e8..077ec39649 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -558,6 +558,7 @@ New: - Customize which parasite can remove by warhead (by NetsuNegi) - Add toggle of whether shield use ArmorMultiplier or not (by NetsuNegi) - Allow the [use of more precise calculation of repair costs](Fixed-or-Improved-Logics.md#use-more-precise-calculation-of-repair-costs) (by NetsuNegi) +- [Customize default mirage disguises per vehicletypes](New-or-Enhanced-Logics.md#default-mirage-disguise-for-individual-vehicletypes) (by NetsuNegi) 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/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po index 375725e28d..6e3ca5d7a0 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po +++ b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po @@ -1705,6 +1705,11 @@ msgid "" msgstr "" "修复了 Ares 的单位投放超级武器投放的建筑物的初始朝向" +msgid "" +"Customize default mirage disguises per vehicletypes" +msgstr "" +"为每个载具类型单独定义默认的幻影伪装类型" + msgid "**Apollo** - Translucent SHP drawing patches" msgstr "**Apollo** - 半透明 SHP 绘制补丁" diff --git a/docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po b/docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po index 810911a9f9..2abe67d848 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po +++ b/docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po @@ -4922,6 +4922,12 @@ msgid "" " same image type (SHP/VXL) for vanilla/damaged states." msgstr "注意这些被使用的载具必须在 `[VehicleTypes]` 下注册并且在常规/伤残状态下使用相同的图像类型(Shape/Voxel)。" +msgid "Default mirage disguise for individual VehicleTypes" +msgstr "载具类型默认幻影伪装" + +msgid "Vehicle can now have its `DefaultMirageDisguises` overridden per-type." +msgstr "现在可以单独为每个载具类型设置其 `DefaultMirageDisguises`。" + msgid "Independent SHP Vehicle Turret Files" msgstr "独立的 Shape 载具炮塔文件" diff --git a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po index 72303f68b7..be6e85ae83 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po @@ -1778,6 +1778,14 @@ msgid "" msgstr "" "修复了由于 `Strength` 值低于 `RepairStep` 时引发的 [EIP#007120F7](https://modenc.renegadeprojects.com/Internal_Error#eip_007120F7)(by NetsuNegi)" +msgid "" +"[Customize default mirage disguises per vehicletypes](New-or-Enhanced-" +"Logics.md#default-mirage-disguise-for-individual-vehicletypes) (by " +"NetsuNegi)" +msgstr "" +"[为每个载具类型单独定义默认的幻影伪装类型](New-or-Enhanced-Logics.md#" +"default-mirage-disguise-for-individual-vehicletypes)(by NetsuNegi)" + msgid "Vanilla fixes:" msgstr "原版问题修复:" diff --git a/src/Ext/Techno/Hooks.Misc.cpp b/src/Ext/Techno/Hooks.Misc.cpp index c924f694ff..6e40ab44db 100644 --- a/src/Ext/Techno/Hooks.Misc.cpp +++ b/src/Ext/Techno/Hooks.Misc.cpp @@ -507,6 +507,21 @@ DEFINE_HOOK(0x522790, InfantryClass_ClearDisguise_DefaultDisguise, 0x6) return 0; } +DEFINE_HOOK(0x746A30, UnitClass_UpdateDisguise_DefaultMirageDisguises, 0x5) +{ + enum { Apply = 0x746A6C }; + + GET(UnitClass*, pThis, ESI); + const auto& disguises = TechnoTypeExt::ExtMap.Find(pThis->Type)->DefaultMirageDisguises.GetElements(RulesClass::Instance->DefaultMirageDisguises); + TerrainTypeClass* pDisguiseAs = nullptr; + + if (const int size = static_cast(disguises.size())) + pDisguiseAs = disguises[ScenarioClass::Instance->Random.RandomRanged(0, size - 1)]; + + R->EAX(pDisguiseAs); + return Apply; +} + DEFINE_HOOK(0x74691D, UnitClass_UpdateDisguise_EMP, 0x6) { GET(UnitClass*, pThis, ESI); diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index 5081f73487..a239526268 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -845,6 +845,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->NotHuman_RandomDeathSequence.Read(exINI, pSection, "NotHuman.RandomDeathSequence"); this->DefaultDisguise.Read(exINI, pSection, "DefaultDisguise"); + this->DefaultMirageDisguises.Read(exINI, pSection, "DefaultMirageDisguises"); this->UseDisguiseMovementSpeed.Read(exINI, pSection, "UseDisguiseMovementSpeed"); this->OpenTopped_RangeBonus.Read(exINI, pSection, "OpenTopped.RangeBonus"); @@ -1566,6 +1567,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->DestroyAnim_Random) .Process(this->NotHuman_RandomDeathSequence) .Process(this->DefaultDisguise) + .Process(this->DefaultMirageDisguises) .Process(this->UseDisguiseMovementSpeed) .Process(this->WeaponBurstFLHs) .Process(this->EliteWeaponBurstFLHs) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index f5b512f4a3..e0cb824ef8 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -156,6 +156,7 @@ class TechnoTypeExt Valueable NotHuman_RandomDeathSequence; Valueable DefaultDisguise; + NullableVector DefaultMirageDisguises; Valueable UseDisguiseMovementSpeed; Nullable OpenTopped_RangeBonus;