From 1ce4936d363ebd24f7bfdd1fdcd3afcd0318c73a Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sat, 27 Jan 2024 00:34:06 +0100 Subject: [PATCH 1/8] it's something --- Phobos.vcxproj | 1 + src/Misc/Hooks.MapTint.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/Misc/Hooks.MapTint.cpp diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 4f29bf9076..ab69c36a20 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -170,6 +170,7 @@ + diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp new file mode 100644 index 0000000000..465b3a1c2f --- /dev/null +++ b/src/Misc/Hooks.MapTint.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include +#include + +DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) +{ + auto tint = ScenarioClass::Instance->NormalLighting.Tint; + ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); + return 0; +} + +DEFINE_HOOK(0x48CDF0, MainGame_SetInitialTinr_KindaCheating, 6) +{ + auto tint = ScenarioClass::Instance->NormalLighting.Tint; + ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); + return 0; +} + +/* +// useless? +DEFINE_HOOK(0x53988E, IonStormClass_InitClear, 5) +{ + auto tint = ScenarioClass::Instance->NormalLighting.Tint; + ScenarioClass::RecalcLighting(1000, 0, 0, true); // debug value, all red + return 0; +} +*/ From 9a68880c9bed755f9cebeb0dcf1dd39e5fc92315 Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sun, 11 Feb 2024 00:16:05 +0100 Subject: [PATCH 2/8] Add docs, INI toggle --- CREDITS.md | 1 + docs/Fixed-or-Improved-Logics.md | 1 + docs/Whats-New.md | 1 + src/Misc/Hooks.MapTint.cpp | 19 +++++++------------ src/Phobos.INI.cpp | 2 ++ src/Phobos.h | 1 + 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 254ab589b4..8370b90e16 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -236,6 +236,7 @@ This page lists all the individual contributions to the project by their author. - Show designator & inhibitor range - Dump variables to file on scenario end / hotkey - "House owns TechnoType" and "House doesn't own TechnoType" trigger events + - Fixed units and buildings not being affected by map lighting color tint - Help with docs - **ChrisLv_CN** (work relicensed under [following permission](https://github.com/Phobos-developers/Phobos/blob/develop/images/ChrisLv-relicense.png)): - General assistance diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 4907a7ac2a..3b82e2beb1 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -146,6 +146,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes. - Fixed railgun and fire particles being cut off by elevation changes. - Fixed teleport units' (for example CLEG) frozen-still timer being cleared after load game. +- Fixed units and buildings not being affected by map lighting color tint (must be enabled with `FixLightingTint=true` under `[General]` in `rulesmd.ini`). ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index d7691b8e29..c8afefd95f 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -408,6 +408,7 @@ Vanilla fixes: - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes (by Starkku) - Fixed railgun and fire particles being cut off by elevation changes (by Starkku) - Fixed teleport units' frozen-still timer being reset after load game (by Trsdy) +- Fixed units and buildings not being affected by map lighting color tint (by Morton) Phobos fixes: - Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy) diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index 465b3a1c2f..e3d859bfaa 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,24 +5,20 @@ DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) { - auto tint = ScenarioClass::Instance->NormalLighting.Tint; - ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); - return 0; -} + if (!Phobos::Config::FixLightingTint) + return 0; -DEFINE_HOOK(0x48CDF0, MainGame_SetInitialTinr_KindaCheating, 6) -{ auto tint = ScenarioClass::Instance->NormalLighting.Tint; ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); return 0; } -/* -// useless? -DEFINE_HOOK(0x53988E, IonStormClass_InitClear, 5) +DEFINE_HOOK(0x683E7F, Start_Scenario_SetInitialTint, 7) { + if (!Phobos::Config::FixLightingTint) + return 0; + auto tint = ScenarioClass::Instance->NormalLighting.Tint; - ScenarioClass::RecalcLighting(1000, 0, 0, true); // debug value, all red + ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); return 0; } -*/ diff --git a/src/Phobos.INI.cpp b/src/Phobos.INI.cpp index 8cc2c89387..b13a8fa3f0 100644 --- a/src/Phobos.INI.cpp +++ b/src/Phobos.INI.cpp @@ -40,6 +40,7 @@ int Phobos::Config::CampaignDefaultGameSpeed = 2; bool Phobos::Config::SkirmishUnlimitedColors = false; bool Phobos::Config::ShowDesignatorRange = false; bool Phobos::Config::SaveVariablesOnScenarioEnd = false; +bool Phobos::Config::FixLightingTint = true; bool Phobos::Misc::CustomGS = false; int Phobos::Misc::CustomGS_ChangeInterval[7] = { -1, -1, -1, -1, -1, -1, -1 }; @@ -120,6 +121,7 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5) CCINIClass* pINI_RULESMD = CCINIClass::LoadINIFile(GameStrings::RULESMD_INI); Phobos::Config::ArtImageSwap = pINI_RULESMD->ReadBool(GameStrings::General, "ArtImageSwap", false); + Phobos::Config::FixLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixLightingTint", false); // Custom game speeds, 6 - i so that GS6 is index 0, just like in the engine Phobos::Config::CampaignDefaultGameSpeed = 6 - CCINIClass::INI_RA2MD->ReadInteger("Phobos", "CampaignDefaultGameSpeed", 4); diff --git a/src/Phobos.h b/src/Phobos.h index 737559c348..dc4020b221 100644 --- a/src/Phobos.h +++ b/src/Phobos.h @@ -76,6 +76,7 @@ class Phobos static bool SkirmishUnlimitedColors; static bool ShowDesignatorRange; static bool SaveVariablesOnScenarioEnd; + static bool FixLightingTint; }; class Misc From 4ed8d30d175bc3a6ede53424621888f97e1b38ed Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sun, 11 Feb 2024 02:27:59 +0100 Subject: [PATCH 3/8] Add coal as a tiberium --- CREDITS.md | 2 +- docs/Fixed-or-Improved-Logics.md | 2 +- docs/Whats-New.md | 2 +- src/Misc/Hooks.MapTint.cpp | 57 ++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 8370b90e16..d1594e02f3 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -236,7 +236,7 @@ This page lists all the individual contributions to the project by their author. - Show designator & inhibitor range - Dump variables to file on scenario end / hotkey - "House owns TechnoType" and "House doesn't own TechnoType" trigger events - - Fixed units and buildings not being affected by map lighting color tint + - Fixed units, buildings and tiberiums not being affected by map lighting color tint - Help with docs - **ChrisLv_CN** (work relicensed under [following permission](https://github.com/Phobos-developers/Phobos/blob/develop/images/ChrisLv-relicense.png)): - General assistance diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 3b82e2beb1..9a82a536f2 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -146,7 +146,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes. - Fixed railgun and fire particles being cut off by elevation changes. - Fixed teleport units' (for example CLEG) frozen-still timer being cleared after load game. -- Fixed units and buildings not being affected by map lighting color tint (must be enabled with `FixLightingTint=true` under `[General]` in `rulesmd.ini`). +- Fixed units, buildings and tibeirums not being affected by map lighting color tint (must be enabled with `FixLightingTint=true` under `[General]` in `rulesmd.ini`). ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index c8afefd95f..29cf85e49b 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -408,7 +408,7 @@ Vanilla fixes: - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes (by Starkku) - Fixed railgun and fire particles being cut off by elevation changes (by Starkku) - Fixed teleport units' frozen-still timer being reset after load game (by Trsdy) -- Fixed units and buildings not being affected by map lighting color tint (by Morton) +- Fixed units, buildings and tiberiums not being affected by map lighting color tint (by Morton) Phobos fixes: - Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy) diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index e3d859bfaa..1320bd040a 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -3,6 +3,11 @@ #include #include +namespace MapTintFix +{ + std::unique_ptr TiberiumLightDrawer; +} + DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) { if (!Phobos::Config::FixLightingTint) @@ -22,3 +27,55 @@ DEFINE_HOOK(0x683E7F, Start_Scenario_SetInitialTint, 7) ScenarioClass::RecalcLighting(tint.Red * 10, tint.Green * 10, tint.Blue * 10, true); return 0; } + +DEFINE_HOOK(0x52BE3B, InitGame_CreateTiberiumDrawer, 0x5) +{ + MapTintFix::TiberiumLightDrawer = std::make_unique(LightConvertClass( + &FileSystem::ISOx_PAL, &FileSystem::TEMPERAT_PAL, + DSurface::Primary, 1000, 1000, 1000, false, nullptr, 53)); + + return 0; +} + +DEFINE_HOOK(0x53AD00, IonStormClass_AdjustLighting_TintTiberiumDrawer, 5) +{ + GET(int, red, ECX); + GET(int, green, EDX); + GET_STACK(int, blue, STACK_OFFSET(0x0, 0x4)); + GET_STACK(bool, tint, STACK_OFFSET(0x0,0x8)); + + MapTintFix::TiberiumLightDrawer->UpdateColors(red, green, blue, tint); + return 0; +} + +DEFINE_HOOK(0x47F94B, CellClass_DrawOverlay_ReplaceTiberiumDrawer_1, 6) +{ + R->EDX(MapTintFix::TiberiumLightDrawer.get()); + //*(int*)(R->ESP() + 12) = 0; + return 0x47F951; +} + +DEFINE_HOOK(0x47FA5C, CellClass_DrawOverlay_ReplaceTiberiumDrawer_2, 6) +{ + R->EDX(MapTintFix::TiberiumLightDrawer.get()); + //*(int*)(R->ESP() + 8) = 0; + return 0x47FA62; +} + +DEFINE_HOOK(0x47FA1F, CellClass_DrawOverlay_ReplaceWeirdDrawer, 6) +{ + R->EDX(MapTintFix::TiberiumLightDrawer.get()); + return 0x47FA25; +} + +DEFINE_HOOK(0x5FE5F9, OverlayTypeClass_DrawIt_ReplaceTiberiumDrawer, 6) +{ + R->EDX(MapTintFix::TiberiumLightDrawer.get()); + return 0x5FE5FF; +} + +DEFINE_HOOK(0x6BE468, Prog_End_DeleteTiberiumDrawer, 6) +{ + MapTintFix::TiberiumLightDrawer.release(); + return 0; +} From 57c7b216794025ab5cc87f06cbab5e0a98c96de7 Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sun, 11 Feb 2024 02:44:46 +0100 Subject: [PATCH 4/8] I may be stupid --- src/Misc/Hooks.MapTint.cpp | 4 ++-- src/Phobos.INI.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index 1320bd040a..c5f33c0e81 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -31,13 +31,13 @@ DEFINE_HOOK(0x683E7F, Start_Scenario_SetInitialTint, 7) DEFINE_HOOK(0x52BE3B, InitGame_CreateTiberiumDrawer, 0x5) { MapTintFix::TiberiumLightDrawer = std::make_unique(LightConvertClass( - &FileSystem::ISOx_PAL, &FileSystem::TEMPERAT_PAL, + &FileSystem::TEMPERAT_PAL, &FileSystem::TEMPERAT_PAL, DSurface::Primary, 1000, 1000, 1000, false, nullptr, 53)); return 0; } -DEFINE_HOOK(0x53AD00, IonStormClass_AdjustLighting_TintTiberiumDrawer, 5) +DEFINE_HOOK(0x53AD00, ScenarioClass_RecalcLighting_TintTiberiumDrawer, 5) { GET(int, red, ECX); GET(int, green, EDX); diff --git a/src/Phobos.INI.cpp b/src/Phobos.INI.cpp index b13a8fa3f0..5b74e9f047 100644 --- a/src/Phobos.INI.cpp +++ b/src/Phobos.INI.cpp @@ -121,7 +121,7 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5) CCINIClass* pINI_RULESMD = CCINIClass::LoadINIFile(GameStrings::RULESMD_INI); Phobos::Config::ArtImageSwap = pINI_RULESMD->ReadBool(GameStrings::General, "ArtImageSwap", false); - Phobos::Config::FixLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixLightingTint", false); + Phobos::Config::FixLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixLightingTint", true); // Custom game speeds, 6 - i so that GS6 is index 0, just like in the engine Phobos::Config::CampaignDefaultGameSpeed = 6 - CCINIClass::INI_RA2MD->ReadInteger("Phobos", "CampaignDefaultGameSpeed", 4); From 1c62ded035e09c4fecbcec5e7a669531d76e5620 Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sun, 11 Feb 2024 03:12:40 +0100 Subject: [PATCH 5/8] Correct in docs that the feature is on by default --- docs/Fixed-or-Improved-Logics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 9a82a536f2..067966511d 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -146,7 +146,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes. - Fixed railgun and fire particles being cut off by elevation changes. - Fixed teleport units' (for example CLEG) frozen-still timer being cleared after load game. -- Fixed units, buildings and tibeirums not being affected by map lighting color tint (must be enabled with `FixLightingTint=true` under `[General]` in `rulesmd.ini`). +- Fixed units, buildings and tiberiums not being affected by map lighting color tint (can be disabled with `FixLightingTint=false` under `[General]` in `rulesmd.ini`). ## Fixes / interactions with other extensions From d4eb4e73a03ab2ed0edf46e0844fb6ee97396a8a Mon Sep 17 00:00:00 2001 From: MortonPL Date: Sun, 11 Feb 2024 19:35:15 +0100 Subject: [PATCH 6/8] Add a separate toggle for tiberium --- docs/Fixed-or-Improved-Logics.md | 4 +++- src/Misc/Hooks.MapTint.cpp | 7 +++++-- src/Phobos.INI.cpp | 6 ++++-- src/Phobos.h | 3 ++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 067966511d..26c72264f1 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -146,7 +146,9 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed `AmbientDamage` when used with `IsRailgun=yes` being cut off by elevation changes. - Fixed railgun and fire particles being cut off by elevation changes. - Fixed teleport units' (for example CLEG) frozen-still timer being cleared after load game. -- Fixed units, buildings and tiberiums not being affected by map lighting color tint (can be disabled with `FixLightingTint=false` under `[General]` in `rulesmd.ini`). +- Fixed units, buildings and tiberiums not being affected by map lighting color tint. + - This can be disabled with `FixUnitLightingTint=false` and `FixTiberiumLightingTint=false` under `[General]` in `rulesmd.ini` + - `FixTiberiumLightingTint=true` requires `FixUnitLightingTint=true` to work. ## Fixes / interactions with other extensions diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index c5f33c0e81..7ebbbea868 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -10,7 +10,7 @@ namespace MapTintFix DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) { - if (!Phobos::Config::FixLightingTint) + if (!Phobos::Config::FixUnitLightingTint) return 0; auto tint = ScenarioClass::Instance->NormalLighting.Tint; @@ -20,7 +20,7 @@ DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) DEFINE_HOOK(0x683E7F, Start_Scenario_SetInitialTint, 7) { - if (!Phobos::Config::FixLightingTint) + if (!Phobos::Config::FixUnitLightingTint) return 0; auto tint = ScenarioClass::Instance->NormalLighting.Tint; @@ -39,6 +39,9 @@ DEFINE_HOOK(0x52BE3B, InitGame_CreateTiberiumDrawer, 0x5) DEFINE_HOOK(0x53AD00, ScenarioClass_RecalcLighting_TintTiberiumDrawer, 5) { + if (!Phobos::Config::FixTiberiumLightingTint) + return 0; + GET(int, red, ECX); GET(int, green, EDX); GET_STACK(int, blue, STACK_OFFSET(0x0, 0x4)); diff --git a/src/Phobos.INI.cpp b/src/Phobos.INI.cpp index 5b74e9f047..8f7a45ba64 100644 --- a/src/Phobos.INI.cpp +++ b/src/Phobos.INI.cpp @@ -40,7 +40,8 @@ int Phobos::Config::CampaignDefaultGameSpeed = 2; bool Phobos::Config::SkirmishUnlimitedColors = false; bool Phobos::Config::ShowDesignatorRange = false; bool Phobos::Config::SaveVariablesOnScenarioEnd = false; -bool Phobos::Config::FixLightingTint = true; +bool Phobos::Config::FixUnitLightingTint = true; +bool Phobos::Config::FixTiberiumLightingTint = true; bool Phobos::Misc::CustomGS = false; int Phobos::Misc::CustomGS_ChangeInterval[7] = { -1, -1, -1, -1, -1, -1, -1 }; @@ -121,7 +122,8 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5) CCINIClass* pINI_RULESMD = CCINIClass::LoadINIFile(GameStrings::RULESMD_INI); Phobos::Config::ArtImageSwap = pINI_RULESMD->ReadBool(GameStrings::General, "ArtImageSwap", false); - Phobos::Config::FixLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixLightingTint", true); + Phobos::Config::FixUnitLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixUnitLightingTint", true); + Phobos::Config::FixTiberiumLightingTint = pINI_RULESMD->ReadBool(GameStrings::General, "FixTiberiumLightingTint", true); // Custom game speeds, 6 - i so that GS6 is index 0, just like in the engine Phobos::Config::CampaignDefaultGameSpeed = 6 - CCINIClass::INI_RA2MD->ReadInteger("Phobos", "CampaignDefaultGameSpeed", 4); diff --git a/src/Phobos.h b/src/Phobos.h index dc4020b221..fc97b7d8d4 100644 --- a/src/Phobos.h +++ b/src/Phobos.h @@ -76,7 +76,8 @@ class Phobos static bool SkirmishUnlimitedColors; static bool ShowDesignatorRange; static bool SaveVariablesOnScenarioEnd; - static bool FixLightingTint; + static bool FixUnitLightingTint; + static bool FixTiberiumLightingTint; }; class Misc From 0812230c78d2880162ac6d3e0772908735d5791c Mon Sep 17 00:00:00 2001 From: MortonPL Date: Tue, 13 Feb 2024 15:46:21 +0100 Subject: [PATCH 7/8] Doesn't fix lamp posts --- src/Ext/TAction/Hooks.cpp | 10 ++++++++++ src/Misc/Hooks.MapTint.cpp | 2 -- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Ext/TAction/Hooks.cpp b/src/Ext/TAction/Hooks.cpp index ba7582bce5..ac3c2c5019 100644 --- a/src/Ext/TAction/Hooks.cpp +++ b/src/Ext/TAction/Hooks.cpp @@ -94,6 +94,16 @@ DEFINE_HOOK(0x6E2EA7, TActionClass_Retint_LightSourceFix, 0x3) // Red return 0; } +// Same as above, but needed to work with pr#1202. +// See Misc/Hooks.MapTint.cpp hook @ 0x683E7F. +DEFINE_HOOK(0x683E94, Start_Scenario_RetintLightSourceFix, 0x5) +{ + // Flag the light sources to update, actually do it later and only once to prevent redundancy. + RetintTemp::UpdateLightSources = true; + + return 0; +} + // Update light sources if they have been flagged to be updated. DEFINE_HOOK(0x6D4455, Tactical_Render_UpdateLightSources, 0x8) { diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index 7ebbbea868..1d8bd573f6 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -54,14 +54,12 @@ DEFINE_HOOK(0x53AD00, ScenarioClass_RecalcLighting_TintTiberiumDrawer, 5) DEFINE_HOOK(0x47F94B, CellClass_DrawOverlay_ReplaceTiberiumDrawer_1, 6) { R->EDX(MapTintFix::TiberiumLightDrawer.get()); - //*(int*)(R->ESP() + 12) = 0; return 0x47F951; } DEFINE_HOOK(0x47FA5C, CellClass_DrawOverlay_ReplaceTiberiumDrawer_2, 6) { R->EDX(MapTintFix::TiberiumLightDrawer.get()); - //*(int*)(R->ESP() + 8) = 0; return 0x47FA62; } From 6a34deedd70ca32493199d7f4c38b6538c80fdbe Mon Sep 17 00:00:00 2001 From: MortonPL Date: Wed, 2 Oct 2024 21:37:08 +0200 Subject: [PATCH 8/8] Apply suggestions from code review Co-authored-by: Trsdy <914137150@qq.com> --- src/Misc/Hooks.MapTint.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Misc/Hooks.MapTint.cpp b/src/Misc/Hooks.MapTint.cpp index 1d8bd573f6..adfe86ffbc 100644 --- a/src/Misc/Hooks.MapTint.cpp +++ b/src/Misc/Hooks.MapTint.cpp @@ -5,7 +5,7 @@ namespace MapTintFix { - std::unique_ptr TiberiumLightDrawer; + LightConvertClass* TiberiumLightDrawer; } DEFINE_HOOK(0x53C441, ScenarioClass_UpdateLighting, 5) @@ -30,7 +30,7 @@ DEFINE_HOOK(0x683E7F, Start_Scenario_SetInitialTint, 7) DEFINE_HOOK(0x52BE3B, InitGame_CreateTiberiumDrawer, 0x5) { - MapTintFix::TiberiumLightDrawer = std::make_unique(LightConvertClass( + MapTintFix::TiberiumLightDrawer = GameCreate( &FileSystem::TEMPERAT_PAL, &FileSystem::TEMPERAT_PAL, DSurface::Primary, 1000, 1000, 1000, false, nullptr, 53)); @@ -77,6 +77,6 @@ DEFINE_HOOK(0x5FE5F9, OverlayTypeClass_DrawIt_ReplaceTiberiumDrawer, 6) DEFINE_HOOK(0x6BE468, Prog_End_DeleteTiberiumDrawer, 6) { - MapTintFix::TiberiumLightDrawer.release(); + GameDelete(MapTintFix::TiberiumLightDrawer); return 0; }