diff --git a/Phobos.vcxproj b/Phobos.vcxproj
index 206bb87e0e..39706373fa 100644
--- a/Phobos.vcxproj
+++ b/Phobos.vcxproj
@@ -76,6 +76,9 @@
+
+
+
@@ -141,6 +144,8 @@
+
+
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..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 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

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)
diff --git a/src/Ext/VoxelAnim/Body.cpp b/src/Ext/VoxelAnim/Body.cpp
new file mode 100644
index 0000000000..a46a9ab18b
--- /dev/null
+++ b/src/Ext/VoxelAnim/Body.cpp
@@ -0,0 +1,114 @@
+#include "Body.h"
+#include
+#include
+
+template<> const DWORD Extension::Canary = 0xAAAAAACC;
+VoxelAnimExt::ExtContainer VoxelAnimExt::ExtMap;
+
+void VoxelAnimExt::InitializeLaserTrails(VoxelAnimClass* pThis)
+{
+ auto pThisExt = VoxelAnimExt::ExtMap.Find(pThis);
+ auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type);
+
+ if (pThisExt->LaserTrails.size())
+ return;
+
+ for (auto const& idxTrail : pTypeExt->LaserTrail_Types)
+ {
+ if (auto const pLaserType = LaserTrailTypeClass::Array[idxTrail].get())
+ {
+ pThisExt->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..f9cd7baf61
--- /dev/null
+++ b/src/Ext/VoxelAnim/Hooks.cpp
@@ -0,0 +1,29 @@
+#include "Body.h"
+
+#include
+
+DEFINE_HOOK(0x74A70E, VoxelAnimClass_AI_Additional, 0xC)
+{
+ GET(VoxelAnimClass* const, pThis, EBX);
+
+ //auto pTypeExt = VoxelAnimTypeExt::ExtMap.Find(pThis->Type);
+ auto pThisExt = VoxelAnimExt::ExtMap.Find(pThis);
+
+ if (!pThisExt->LaserTrails.empty())
+ {
+ CoordStruct location = pThis->GetCoords();
+ CoordStruct drawnCoords = location;
+
+ for (auto const& trail : pThisExt->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..3906dc33b8 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,
+ VoxelAnimTypeExt,
WarheadTypeExt,
WeaponTypeExt,
// New classes