diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 7c739be973..272ba2a6bc 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -168,6 +168,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Planning paths are now shown for all units under player control or when `[GlobalControls]->DebugPlanningPaths=yes` in singleplayer game modes. - Fixed `Temporal=true` Warheads potentially crashing game if used to attack `Slaved=true` infantry. - Fixed some locomotors (Tunnel, Walk, Mech) getting stuck when moving too fast. +- Animations with `MakeInfantry` and `UseNormalLight=false` that are drawn in unit palette will now have cell lighting changes applied on them (by Starkku) ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 1d609a08ff..c1a03f146c 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -524,6 +524,7 @@ Vanilla fixes: - Subterranean units are no longer allowed to perform deploy functions like firing weapons or `IsSimpleDeployer` while burrowed or burrowing, they will instead emerge first like they do for transport unloading (by Starkku) - Fixed `Temporal=true` Warheads potentially crashing game if used to attack `Slaved=true` infantry (by Starkku) - Fixed some locomotors (Tunnel, Walk, Mech) getting stuck when moving too fast (by NetsuNegi) +- Animations with `MakeInfantry` and `UseNormalLight=false` that are drawn in unit palette will now have cell lighting changes applied on them (by Starkku) Phobos fixes: - Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy) diff --git a/src/Ext/Anim/Hooks.cpp b/src/Ext/Anim/Hooks.cpp index 1c7ecd4dd3..20beb312b2 100644 --- a/src/Ext/Anim/Hooks.cpp +++ b/src/Ext/Anim/Hooks.cpp @@ -312,6 +312,23 @@ DEFINE_HOOK(0x423365, AnimClass_DrawIt_ExtraShadow, 0x8) return SkipExtraShadow; } +// Apply cell lighting on UseNormalLight=no MakeInfantry anims. +DEFINE_HOOK(0x4232BF, AnimClass_DrawIt_MakeInfantry, 0x6) +{ + enum { SkipGameCode = 0x4232C5 }; + + GET(AnimClass*, pThis, ESI); + + if (pThis->Type->MakeInfantry != -1) + { + auto const pCell = pThis->GetCell(); + R->EAX(pCell->Intensity_Normal); + return SkipGameCode; + } + + return 0; +} + #pragma region AltPalette // Fix AltPalette anims not using owner color scheme.