From 1a3b7065d822f9608c1babd51876627706fcc1c0 Mon Sep 17 00:00:00 2001 From: Otamaa Date: Mon, 8 Nov 2021 23:42:43 +0700 Subject: [PATCH 1/5] Init Feature --- Phobos.vcxproj | 5 ++ src/Ext/VoxelAnim/Body.cpp | 115 +++++++++++++++++++++++++++++++++ src/Ext/VoxelAnim/Body.h | 54 ++++++++++++++++ src/Ext/VoxelAnim/Hooks.cpp | 33 ++++++++++ src/Ext/VoxelAnimType/Body.cpp | 111 +++++++++++++++++++++++++++++++ src/Ext/VoxelAnimType/Body.h | 54 ++++++++++++++++ src/Phobos.Ext.cpp | 4 ++ 7 files changed, 376 insertions(+) create mode 100644 src/Ext/VoxelAnim/Body.cpp create mode 100644 src/Ext/VoxelAnim/Body.h create mode 100644 src/Ext/VoxelAnim/Hooks.cpp create mode 100644 src/Ext/VoxelAnimType/Body.cpp create mode 100644 src/Ext/VoxelAnimType/Body.h diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 206bb87e0e..9406db0e6e 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -33,6 +33,9 @@ + + + @@ -117,6 +120,8 @@ + + diff --git a/src/Ext/VoxelAnim/Body.cpp b/src/Ext/VoxelAnim/Body.cpp new file mode 100644 index 0000000000..252b1e0948 --- /dev/null +++ b/src/Ext/VoxelAnim/Body.cpp @@ -0,0 +1,115 @@ +#include "Body.h" +#include +#include + +template<> const DWORD Extension::Canary = 0xAAAAAACC; +VoxelAnimExt::ExtContainer VoxelAnimExt::ExtMap; + +void VoxelAnimExt::InitializeLaserTrails(VoxelAnimClass* pThis) +{ + auto pExt = VoxelAnimExt::ExtMap.Find(pThis); + + if (pExt->LaserTrails.size()) + return; + + if (auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type)) + { + for (auto const& idxTrail : pTypeExt->LaserTrail_Types) + { + if (auto const pLaserType = LaserTrailTypeClass::Array[idxTrail].get()) + { + pExt->LaserTrails.push_back(std::make_unique(pLaserType, pThis->OwnerHouse)); + } + } + } +} + +void VoxelAnimExt::ExtData::Initialize() {} + +// ============================= +// load / save +template +void VoxelAnimExt::ExtData::Serialize(T& Stm) +{ + Stm + .Process(LaserTrails) + ; +} + +void VoxelAnimExt::ExtData::LoadFromStream(PhobosStreamReader& Stm) +{ + Extension::LoadFromStream(Stm); + this->Serialize(Stm); +} + +void VoxelAnimExt::ExtData::SaveToStream(PhobosStreamWriter& Stm) +{ + Extension::SaveToStream(Stm); + this->Serialize(Stm); +} + +void VoxelAnimExt::ExtContainer::InvalidatePointer(void* ptr, bool bRemoved) {} + +bool VoxelAnimExt::LoadGlobals(PhobosStreamReader& Stm) +{ + return Stm + .Success(); +} + +bool VoxelAnimExt::SaveGlobals(PhobosStreamWriter& Stm) +{ + return Stm + .Success(); +} + +// ============================= +// container + +VoxelAnimExt::ExtContainer::ExtContainer() : Container("VoxelAnimClass") {} +VoxelAnimExt::ExtContainer::~ExtContainer() = default; + +// ============================= +// container hooks + +//DEFINE_HOOK(0x749951, VoxelAnimClass_CTOR, 0xC) +DEFINE_HOOK(0x74942E, VoxelAnimClass_CTOR, 0xC) +{ + GET(VoxelAnimClass*, pItem, ESI); + + VoxelAnimExt::ExtMap.FindOrAllocate(pItem); + VoxelAnimExt::InitializeLaserTrails(pItem); + + return 0; +} + +DEFINE_HOOK(0x7499F1, VoxelAnimClass_DTOR, 0x5) +{ + GET(VoxelAnimClass*, pItem, ECX); + + VoxelAnimExt::ExtMap.Remove(pItem); + + return 0; +} + +DEFINE_HOOK_AGAIN(0x74A970, VoxelAnimClass_SaveLoad_Prefix, 0x5) +DEFINE_HOOK(0x74AA10, VoxelAnimClass_SaveLoad_Prefix, 0x8) +{ + GET_STACK(VoxelAnimClass*, pItem, 0x4); + GET_STACK(IStream*, pStm, 0x8); + + VoxelAnimExt::ExtMap.PrepareStream(pItem, pStm); + + return 0; +} + +DEFINE_HOOK(0x74A9FB, VoxelAnimClass_Load_Suffix, 0x5) +{ + VoxelAnimExt::ExtMap.LoadStatic(); + return 0; +} + +DEFINE_HOOK(0x74AA24, VoxelAnimClass_Save_Suffix, 0x5) +{ + VoxelAnimExt::ExtMap.SaveStatic(); + return 0; +} \ No newline at end of file diff --git a/src/Ext/VoxelAnim/Body.h b/src/Ext/VoxelAnim/Body.h new file mode 100644 index 0000000000..0563f25163 --- /dev/null +++ b/src/Ext/VoxelAnim/Body.h @@ -0,0 +1,54 @@ +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +class VoxelAnimExt +{ +public: + using base_type = VoxelAnimClass; + + class ExtData final : public Extension + { + public: + + ValueableVector> LaserTrails; + + ExtData(VoxelAnimClass* OwnerObject) : Extension(OwnerObject) + , LaserTrails() + { } + + virtual ~ExtData() = default; + virtual size_t Size() const { return sizeof(*this); }; + virtual void InvalidatePointer(void *ptr, bool bRemoved) override {} + virtual void LoadFromStream(PhobosStreamReader& Stm)override; + virtual void SaveToStream(PhobosStreamWriter& Stm)override; + virtual void Initialize() override; + + private: + template + void Serialize(T& Stm); + }; + + class ExtContainer final : public Container + { + public: + ExtContainer(); + ~ExtContainer(); + virtual void InvalidatePointer(void* ptr, bool bRemoved) override; + }; + + static ExtContainer ExtMap; + static void InitializeLaserTrails(VoxelAnimClass* pThis); + static bool LoadGlobals(PhobosStreamReader& Stm); + static bool SaveGlobals(PhobosStreamWriter& Stm); +}; diff --git a/src/Ext/VoxelAnim/Hooks.cpp b/src/Ext/VoxelAnim/Hooks.cpp new file mode 100644 index 0000000000..cc5c5f0662 --- /dev/null +++ b/src/Ext/VoxelAnim/Hooks.cpp @@ -0,0 +1,33 @@ +#include "Body.h" + +#include + +DEFINE_HOOK(0x74A70E, VoxelAnimClass_AI_Additional, 0xC) +{ + GET(VoxelAnimClass* const, pThis, EBX); + + if (auto pType = pThis->Type) + { + if (auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pType)) + { + if (auto pExt = VoxelAnimExt::ExtMap.Find(pThis)) + { + if (!pExt->LaserTrails.empty()) + { + CoordStruct location = pThis->GetCoords(); + CoordStruct drawnCoords = location; + for (auto const& trail : pExt->LaserTrails) + { + if (!trail->LastLocation.isset()) + trail->LastLocation = location; + + trail->Visible = pThis->IsVisible; + trail->Update(drawnCoords); + } + } + } + } + } + + return 0; +} \ No newline at end of file diff --git a/src/Ext/VoxelAnimType/Body.cpp b/src/Ext/VoxelAnimType/Body.cpp new file mode 100644 index 0000000000..270ac12c40 --- /dev/null +++ b/src/Ext/VoxelAnimType/Body.cpp @@ -0,0 +1,111 @@ +#include "Body.h" + + +template<> const DWORD Extension::Canary = 0xAAAEEEEE; +VoxelAnimTypeExt::ExtContainer VoxelAnimTypeExt::ExtMap; +void VoxelAnimTypeExt::ExtData::Initialize() {} + +void VoxelAnimTypeExt::ExtData::LoadFromINIFile(CCINIClass* pINI) +{ + const char* pID = this->OwnerObject()->ID; + INI_EX exINI(pINI); + + this->LaserTrail_Types.Read(exINI, pID, "LaserTrail.Types"); +} + +// ============================= +// load / save +template +void VoxelAnimTypeExt::ExtData::Serialize(T& Stm) +{ + Stm + .Process(LaserTrail_Types) + ; +} + +void VoxelAnimTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm) +{ + Extension::LoadFromStream(Stm); + this->Serialize(Stm); +} + +void VoxelAnimTypeExt::ExtData::SaveToStream(PhobosStreamWriter& Stm) +{ + Extension::SaveToStream(Stm); + this->Serialize(Stm); +} + +void VoxelAnimTypeExt::ExtContainer::InvalidatePointer(void* ptr, bool bRemoved) {} + +bool VoxelAnimTypeExt::LoadGlobals(PhobosStreamReader& Stm) +{ + return Stm + .Success(); +} + +bool VoxelAnimTypeExt::SaveGlobals(PhobosStreamWriter& Stm) +{ + return Stm + .Success(); +} + +// ============================= +// container + +VoxelAnimTypeExt::ExtContainer::ExtContainer() : Container("VoxelVoxelAnimTypeClass") {} +VoxelAnimTypeExt::ExtContainer::~ExtContainer() = default; + +// ============================= +// container hooks + +DEFINE_HOOK(0x74AEB0, VoxelAnimTypeClass_CTOR, 0xB) +{ + GET(VoxelAnimTypeClass*, pItem, ESI); + + VoxelAnimTypeExt::ExtMap.FindOrAllocate(pItem); + return 0; +} + +DEFINE_HOOK(0x74BA31, VoxelAnimTypeClass_DTOR, 0x5) +{ + GET(VoxelAnimTypeClass*, pItem, ECX); + + VoxelAnimTypeExt::ExtMap.Remove(pItem); + return 0; +} + +DEFINE_HOOK_AGAIN(0x74B810, VoxelAnimTypeClass_SaveLoad_Prefix, 0x5) +DEFINE_HOOK(0x74B8D0, VoxelAnimTypeClass_SaveLoad_Prefix, 0x8) +{ + GET_STACK(VoxelAnimTypeClass*, pItem, 0x4); + GET_STACK(IStream*, pStm, 0x8); + + VoxelAnimTypeExt::ExtMap.PrepareStream(pItem, pStm); + + return 0; +} + +DEFINE_HOOK(0x74B8C2, VoxelAnimTypeClass_Load_Suffix, 0x5) +{ + VoxelAnimTypeExt::ExtMap.LoadStatic(); + return 0; +} + +DEFINE_HOOK(0x74B8EA, VoxelAnimTypeClass_Save_Suffix, 0x5) +{ + VoxelAnimTypeExt::ExtMap.SaveStatic(); + return 0; +} + +DEFINE_HOOK_AGAIN(0x74B607, VoxelAnimTypeClass_LoadFromINI, 0x5) +DEFINE_HOOK_AGAIN(0x74B561, VoxelAnimTypeClass_LoadFromINI, 0x5) +DEFINE_HOOK_AGAIN(0x74B54A, VoxelAnimTypeClass_LoadFromINI, 0x5) +DEFINE_HOOK_AGAIN(0x74B51B, VoxelAnimTypeClass_LoadFromINI, 0x5) +DEFINE_HOOK(0x74B4F0, VoxelAnimTypeClass_LoadFromINI, 0x5) +{ + GET(VoxelAnimTypeClass*, pItem, ESI); + GET_STACK(CCINIClass*, pINI, 0x4); + + VoxelAnimTypeExt::ExtMap.LoadFromINI(pItem, pINI); + return 0; +} \ No newline at end of file diff --git a/src/Ext/VoxelAnimType/Body.h b/src/Ext/VoxelAnimType/Body.h new file mode 100644 index 0000000000..aca5a2aac4 --- /dev/null +++ b/src/Ext/VoxelAnimType/Body.h @@ -0,0 +1,54 @@ +#pragma once +#include + +#include +#include +#include +#include +#include +#include + +#include + +class VoxelAnimTypeExt +{ +public: + using base_type = VoxelAnimTypeClass; + + class ExtData final : public Extension + { + public: + + ValueableIdxVector LaserTrail_Types; + + ExtData(VoxelAnimTypeClass* OwnerObject) : Extension(OwnerObject) + , LaserTrail_Types() + { } + + virtual ~ExtData() = default; + virtual size_t Size() const { return sizeof(*this); } + virtual void LoadFromINIFile(CCINIClass* pINI) override; + + virtual void InvalidatePointer(void *ptr, bool bRemoved) override {} + virtual void Initialize() override; + virtual void LoadFromStream(PhobosStreamReader& Stm)override; + virtual void SaveToStream(PhobosStreamWriter& Stm)override; + + private: + template + void Serialize(T& Stm); + }; + + class ExtContainer final : public Container + { + public: + ExtContainer(); + ~ExtContainer(); + virtual void InvalidatePointer(void* ptr, bool bRemoved) override; + }; + + static ExtContainer ExtMap; + + static bool LoadGlobals(PhobosStreamReader& Stm); + static bool SaveGlobals(PhobosStreamWriter& Stm); +}; \ No newline at end of file diff --git a/src/Phobos.Ext.cpp b/src/Phobos.Ext.cpp index cc40046684..b88d0dbabf 100644 --- a/src/Phobos.Ext.cpp +++ b/src/Phobos.Ext.cpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -240,6 +242,8 @@ auto MassActions = MassAction < TechnoExt, TechnoTypeExt, TerrainTypeExt, + VoxelAnimExt, + VoxelAnimExt, WarheadTypeExt, WeaponTypeExt, // New classes From ae7e47ffaa67c14d3da5c9e7d04e53750b3a27ed Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sat, 13 Nov 2021 21:31:30 +0700 Subject: [PATCH 2/5] Bugfix & style fix --- src/Ext/VoxelAnim/Body.cpp | 16 +++++++--------- src/Ext/VoxelAnim/Hooks.cpp | 28 ++++++++++++---------------- src/Phobos.Ext.cpp | 2 +- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/Ext/VoxelAnim/Body.cpp b/src/Ext/VoxelAnim/Body.cpp index 252b1e0948..518f6f3165 100644 --- a/src/Ext/VoxelAnim/Body.cpp +++ b/src/Ext/VoxelAnim/Body.cpp @@ -7,19 +7,17 @@ VoxelAnimExt::ExtContainer VoxelAnimExt::ExtMap; void VoxelAnimExt::InitializeLaserTrails(VoxelAnimClass* pThis) { - auto pExt = VoxelAnimExt::ExtMap.Find(pThis); + auto pThisExt = VoxelAnimExt::ExtMap.Find(pThis); + auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type); - if (pExt->LaserTrails.size()) + if (pThisExt->LaserTrails.size()) return; - - if (auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type)) + + for (auto const& idxTrail : pTypeExt->LaserTrail_Types) { - for (auto const& idxTrail : pTypeExt->LaserTrail_Types) + if (auto const pLaserType = LaserTrailTypeClass::Array[idxTrail].get()) { - if (auto const pLaserType = LaserTrailTypeClass::Array[idxTrail].get()) - { - pExt->LaserTrails.push_back(std::make_unique(pLaserType, pThis->OwnerHouse)); - } + pThisExt->LaserTrails.push_back(std::make_unique(pLaserType, pThis->OwnerHouse)); } } } diff --git a/src/Ext/VoxelAnim/Hooks.cpp b/src/Ext/VoxelAnim/Hooks.cpp index cc5c5f0662..86a287f83e 100644 --- a/src/Ext/VoxelAnim/Hooks.cpp +++ b/src/Ext/VoxelAnim/Hooks.cpp @@ -6,25 +6,21 @@ DEFINE_HOOK(0x74A70E, VoxelAnimClass_AI_Additional, 0xC) { GET(VoxelAnimClass* const, pThis, EBX); - if (auto pType = pThis->Type) + //auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type); + auto pThisExt = VoxelAnimExt::ExtMap.Find(pThis); + + if (!pThisExt->LaserTrails.empty()) { - if (auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pType)) + CoordStruct location = pThis->GetCoords(); + CoordStruct drawnCoords = location; + + for (auto const& trail : pThisExt->LaserTrails) { - if (auto pExt = VoxelAnimExt::ExtMap.Find(pThis)) + if (!trail->LastLocation.isset()) { - if (!pExt->LaserTrails.empty()) - { - CoordStruct location = pThis->GetCoords(); - CoordStruct drawnCoords = location; - for (auto const& trail : pExt->LaserTrails) - { - if (!trail->LastLocation.isset()) - trail->LastLocation = location; - - trail->Visible = pThis->IsVisible; - trail->Update(drawnCoords); - } - } + trail->LastLocation = location; + trail->Visible = pThis->IsVisible; + trail->Update(drawnCoords); } } } diff --git a/src/Phobos.Ext.cpp b/src/Phobos.Ext.cpp index b88d0dbabf..3906dc33b8 100644 --- a/src/Phobos.Ext.cpp +++ b/src/Phobos.Ext.cpp @@ -243,7 +243,7 @@ auto MassActions = MassAction < TechnoTypeExt, TerrainTypeExt, VoxelAnimExt, - VoxelAnimExt, + VoxelAnimTypeExt, WarheadTypeExt, WeaponTypeExt, // New classes From cedb2628034ebf91e684164782b507d3e52ca7d0 Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sun, 30 Jan 2022 10:18:41 +0700 Subject: [PATCH 3/5] bugFix , wrong code placement - causing LaserTrail not updated & drawn properlu --- Phobos.vcxproj | 10 +++++----- src/Ext/VoxelAnim/Hooks.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 9406db0e6e..39706373fa 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -33,9 +33,6 @@ - - - @@ -79,6 +76,9 @@ + + + @@ -120,8 +120,6 @@ - - @@ -146,6 +144,8 @@ + + diff --git a/src/Ext/VoxelAnim/Hooks.cpp b/src/Ext/VoxelAnim/Hooks.cpp index 86a287f83e..f9cd7baf61 100644 --- a/src/Ext/VoxelAnim/Hooks.cpp +++ b/src/Ext/VoxelAnim/Hooks.cpp @@ -16,12 +16,12 @@ DEFINE_HOOK(0x74A70E, VoxelAnimClass_AI_Additional, 0xC) for (auto const& trail : pThisExt->LaserTrails) { - if (!trail->LastLocation.isset()) - { + if (!trail->LastLocation.isset()) trail->LastLocation = location; - trail->Visible = pThis->IsVisible; - trail->Update(drawnCoords); - } + + trail->Visible = pThis->IsVisible; + trail->Update(drawnCoords); + } } From 0199e24184c8d5fb0682ac62c7f027c8966002bd Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sat, 12 Feb 2022 22:09:57 +0700 Subject: [PATCH 4/5] Doc --- README.md | 2 +- docs/New-or-Enhanced-Logics.md | 10 ++++++++-- docs/Whats-New.md | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7e5ae8b2a8..84b96cd577 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ Credits - **wiktorderelf** - overhauled Unicode font - **Uranusian (Thrifinesma)** - Mind Control enhancement, custom warhead splash list, harvesters counter, promoted spawns, shields, death after dead fix, customizeable missing cameo, cameo sorting priority, placement mode responding of tab hotkeys fix, producing progress, custom ore gathering anim, NoManualMove, weapon target house filtering, DeathWeapon fix, re-enable obsolete `JumpjetControls`, AITrigger Building Upgrades recognition, Wall-Gate links, deployed infantry using both weapons, overhauled Unicode font, docs maintenance, CN docs translation - **secsome (SEC-SOME)** - debug info dump hotkey, refactoring & porting of Ares helper code, introducing more Ares-derived stuff, disguise removal warhead, Mind Control removal warhead, Mind Control enhancement, shields, AnimList.PickRandom, MoveToCell fix, unlimited waypoints, Build At trigger action buildup anim fix, Undeploy building into a unit plays `EVA_NewRallyPointEstablished` fix, custom ore gathering anim, TemporaryClass related crash, Retry dialog on mission failure, Default disguise for individual InfantryTypes, PowerPlant Enhancer, SaveGame Trigger Action, QuickSave command, Numeric variables, Custom gravity for projectiles, Retint map actions bugfix, Sharpnel enhancement -- **Otamaa (Fahroni, BoredEXE)** - help with CellSpread, ported and fixed custom RadType code, togglable ElectricBolt bolts, customizable Chrono Locomotor properties per TechnoClass, DebrisMaximums fixes, Anim-to-Unit, NotHuman anim sequences improvements, Customizable OpenTopped Properties, hooks for ScriptType Actions 92 & 93, ore stage threshold for `HideIfNoOre`, occupied building `MuzzleFlashX` bugfix,`EnemyUIName=` for other TechnoTypes, TerrainType `DestroyAnim` & `DestroySound` +- **Otamaa (Fahroni, BoredEXE)** - help with CellSpread, ported and fixed custom RadType code, togglable ElectricBolt bolts, customizable Chrono Locomotor properties per TechnoClass, DebrisMaximums fixes, Anim-to-Unit, NotHuman anim sequences improvements, Customizable OpenTopped Properties, hooks for ScriptType Actions 92 & 93, ore stage threshold for `HideIfNoOre`, occupied building `MuzzleFlashX` bugfix,`EnemyUIName=` for other TechnoTypes, TerrainType `DestroyAnim` & `DestroySound`, Laser trails for VoxelAnims - **E1 Elite** - TileSet 255 and above bridge repair fix - **FS-21** - Dump Object Info enhancements, Powered.KillSpawns, Spawner.LimitRange, ScriptType Actions 71 to 113, MC deployer fixes, help with docs, Automatic Passenger Deletion, Fire SW At Location Trigger Action, Fire SW At Waypoint Trigger Action, Kill Object Automatically, Customize resource storage, Override Uncloaked Underwater attack behavior, AI Aircraft docks fix, Shared Ammo - **AutoGavy** - interceptor logic, Warhead critical hit logic, Customize resource storage diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 892788e2d9..24cfc92280 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -112,8 +112,8 @@ Shield.InheritStateOnReplace=false ; boolean ![Laser Trails](_static/images/lasertrails.gif) *Laser trails used in [Rise of the East](https://www.moddb.com/mods/riseoftheeast)* -- Technos and projectiles can now have colorful trails of different transparency, thickness and color, which are drawn via laser drawing code. -- Technos and projectiles can have multiple laser trails. For technos each trail can have custom laser trail type and FLH offset relative to turret and body. +- Technos , Projectiles , and VoxelAnims can now have colorful trails of different transparency, thickness and color, which are drawn via laser drawing code. +- Technos , Projectiles , and VoxelAnims can have multiple laser trails. For technos each trail can have custom laser trail type and FLH offset relative to turret and body. ```{warning} Laser trails are very resource intensive! Due to the game not utilizing GPU having a lot of trails can quickly drop the FPS on even good machines. To reduce that effect: @@ -146,6 +146,12 @@ LaserTrailN.IsOnTurret=no ; boolean, whether the trail origin is turret ; where N = 0, 1, 2, ... ``` +in `rulesmd.ini`: +```ini +[SOMEVOXELANIM] ; VoxelAnim +LaserTrail.Types=SOMETRAIL ; list of LaserTrailTypes +``` + ### Custom Radiation Types ![image](_static/images/radtype-01.png) diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 48014d56fa..042df5b856 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -277,6 +277,7 @@ New: - `ForceWeapon.Naval.Decloacked` for overriding uncloaked underwater attack behavior (by FS-21) - Shared Ammo for transports to passengers (by FS-21) - Additional critical hit logic customizations (by Starkku) +- Laser trails for VoxelAnims (by Otamaa) Vanilla fixes: - Fixed laser drawing code to allow for thicker lasers in house color draw mode (by Kerbiter, ChrisLv_CN) From 85212be03d3c4ff7a5c77b448f3eb92e706b47e4 Mon Sep 17 00:00:00 2001 From: Starkku Date: Fri, 4 Mar 2022 16:20:41 +0200 Subject: [PATCH 5/5] Style fixes. --- docs/New-or-Enhanced-Logics.md | 4 ++-- src/Ext/VoxelAnim/Body.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 24cfc92280..ebb0d63870 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -112,8 +112,8 @@ Shield.InheritStateOnReplace=false ; boolean ![Laser Trails](_static/images/lasertrails.gif) *Laser trails used in [Rise of the East](https://www.moddb.com/mods/riseoftheeast)* -- Technos , Projectiles , and VoxelAnims can now have colorful trails of different transparency, thickness and color, which are drawn via laser drawing code. -- Technos , Projectiles , and VoxelAnims can have multiple laser trails. For technos each trail can have custom laser trail type and FLH offset relative to turret and body. +- Technos, Projectiles, and VoxelAnims can now have colorful trails of different transparency, thickness and color, which are drawn via laser drawing code. +- Technos, Projectiles, and VoxelAnims can have multiple laser trails. For technos each trail can have custom laser trail type and FLH offset relative to turret and body. ```{warning} Laser trails are very resource intensive! Due to the game not utilizing GPU having a lot of trails can quickly drop the FPS on even good machines. To reduce that effect: diff --git a/src/Ext/VoxelAnim/Body.cpp b/src/Ext/VoxelAnim/Body.cpp index 518f6f3165..a46a9ab18b 100644 --- a/src/Ext/VoxelAnim/Body.cpp +++ b/src/Ext/VoxelAnim/Body.cpp @@ -17,7 +17,8 @@ void VoxelAnimExt::InitializeLaserTrails(VoxelAnimClass* pThis) { if (auto const pLaserType = LaserTrailTypeClass::Array[idxTrail].get()) { - pThisExt->LaserTrails.push_back(std::make_unique(pLaserType, pThis->OwnerHouse)); + pThisExt->LaserTrails.push_back(std::make_unique + (pLaserType, pThis->OwnerHouse)); } } }