diff --git a/CREDITS.md b/CREDITS.md index 24de4f3861..46793266ce 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -515,6 +515,7 @@ This page lists all the individual contributions to the project by their author. - Add toggle of whether shield use ArmorMultiplier or not - Fix an Ares bug that led to erroneous interactions where the parasite would frequently reset to the victim's position under specific circumstances and that was highly prone to crashes - Fix the bug that if paradropping technos with `Crashable=yes` has been destroyed in air, they will falling down on ground but not dead + - 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 64e595351d..d79c789086 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -553,6 +553,7 @@ New: - [Implement `CurleyShuffle` for AircraftTypes](Fixed-or-Improved-Logics.md#implement-curleyshuffle-for-aircrafttypes) (ported from Vinifera by Noble_Fish) - Customize which parasite can remove by warhead (by NetsuNegi) - Add toggle of whether shield use ArmorMultiplier or not (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 842a5989cf..7d1a837b9d 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po +++ b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po @@ -1682,6 +1682,11 @@ msgid "" msgstr "" "修复了当 `Crashable=yes` 的科技类型在空降时被于半空中摧毁,它会落地但不会死亡的 Bug" +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 ed99d93005..4421822c3e 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po @@ -1754,6 +1754,14 @@ msgstr "自定义哪些寄生者可被弹头移除(by NetsuNegi)" msgid "Add toggle of whether shield use ArmorMultiplier or not (by NetsuNegi)" msgstr "添加了护盾是否使用护甲倍率的开关(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;