From 2a59dba71e86f099c0ed50588e7f87ee4e29630c Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sun, 12 Dec 2021 15:50:33 +0700 Subject: [PATCH 1/6] Init Feature --- Phobos.vcxproj | 765 ++++++++++++++++--------------- README.md | 2 +- docs/Fixed-or-Improved-Logics.md | 1 + docs/Whats-New.md | 1 + src/Ext/BuildingType/Body.cpp | 8 + src/Ext/BuildingType/Body.h | 4 +- src/Ext/BuildingType/Hooks.cpp | 61 +++ src/Utilities/TemplateDef.h | 28 ++ 8 files changed, 486 insertions(+), 384 deletions(-) create mode 100644 src/Ext/BuildingType/Hooks.cpp diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 15c1932315..b76689c7b2 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -1,383 +1,384 @@ - - - - true - - - - Debug - Win32 - - - DevBuild - Win32 - - - Release - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15.0 - {3FAF7126-F38C-4D1E-9973-C21A37870F60} - Phobos - 10.0 - Phobos - - - - DynamicLibrary - false - v141_xp - NotSet - false - - - DynamicLibrary - false - v141_xp - NotSet - false - - - DynamicLibrary - false - v141_xp - NotSet - false - - - - - - - - - - - - - - - - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - - Level4 - MaxSpeed - true - - false - Caret - true - IS_RELEASE_VER;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - IS_RELEASE_VER;%(PreprocessorDefinitions) - - - - - Level4 - MaxSpeed - true - - false - Caret - true - SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - - - Level4 - Disabled - true - - - false - Caret - true - DEBUG;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - - - - /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) - - - /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) - - - - - /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) - - - /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) - - - - + + + + true + + + + Debug + Win32 + + + DevBuild + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 15.0 + {3FAF7126-F38C-4D1E-9973-C21A37870F60} + Phobos + 10.0 + Phobos + + + + DynamicLibrary + false + v141_xp + NotSet + false + + + DynamicLibrary + false + v141_xp + NotSet + false + + + DynamicLibrary + false + v141_xp + NotSet + false + + + + + + + + + + + + + + + + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + + Level4 + MaxSpeed + true + + false + Caret + true + IS_RELEASE_VER;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + IS_RELEASE_VER;%(PreprocessorDefinitions) + + + + + Level4 + MaxSpeed + true + + false + Caret + true + SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + + + Level4 + Disabled + true + + + false + Caret + true + DEBUG;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + + + + /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) + + + /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) + + + + + /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) + + + /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) + + + + \ No newline at end of file diff --git a/README.md b/README.md index c49ed596e3..cd85ee6995 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,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, 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 -- **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` +- **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` bug fix - **E1 Elite** - TileSet 255 and above bridge repair fix - **FS-21** - Dump Object Info enhancements, Powered.KillSpawns, Spawner.LimitRange, ScriptType Actions 71, 72, 73, 74 to 81, 92, 93, 94, 95 to 98, 111, 112, MC deployer fixes, help with docs, Automatic Passenger Deletion - **AutoGavy** - interceptor logic, warhead critical damage system diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 9ced255c13..8e69dd736d 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -41,6 +41,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Animations can now be offset on the X axis with `XDrawOffset`. - `IsSimpleDeployer` units now only play `DeploySound` and `UndeploySound` once, when done with (un)deploying instead of repeating it over duration of turning and/or `DeployingAnim`. - AITrigger can now recognize Building Upgrades as legal condition. +- Fixed bug when Occupied Building `MuzzleFlashX` is drawn on the center of the building when `X` is go beyond 10. ## Animations diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 1e9135f5ff..32e136426a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -262,6 +262,7 @@ Vanilla fixes: - Fixed temporal weapon crash under certain conditions where stack dump starts with 0051BB7D (by secsome) - Fixed the bug when retinting map lighting with a map action corrupted light sources (by secsome) - Fixed the bug that AITriggerTypes do not recognize building upgrades (by Uranusian) +- Fixed the bug when Occupied Building `MuzzleFlashX` is drawn on the center of the building when `X` is go beyond 10 (by Otamaa) Phobos fixes: - Fixed shields being able to take damage when the parent TechnoType was under effects of a `Temporal` Warhead (by Starkku) diff --git a/src/Ext/BuildingType/Body.cpp b/src/Ext/BuildingType/Body.cpp index 23d1d4bf1f..03100d8684 100644 --- a/src/Ext/BuildingType/Body.cpp +++ b/src/Ext/BuildingType/Body.cpp @@ -75,11 +75,14 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) { auto pThis = this->OwnerObject(); const char* pSection = pThis->ID; + //const char* pArtSection = pThis->ImageFile; + auto pArtINI = &CCINIClass::INI_Art(); if (!pINI->GetSection(pSection)) return; INI_EX exINI(pINI); + INI_EX exArtINI(pArtINI); this->PowersUp_Owner.Read(exINI, pSection, "PowersUp.Owner"); this->PowersUp_Buildings.Read(exINI, pSection, "PowersUp.Buildings"); @@ -113,6 +116,10 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) } } } + + if (pThis->MaxNumberOccupants > 10) + Templated::ParseVectorWithBaseSize(this->PhobosMuzzleFlash, pThis->MaxNumberOccupants, exArtINI, pSection, "MuzzleFlash", Point2D::Empty,true); + } void BuildingTypeExt::ExtData::CompleteInitialization() @@ -131,6 +138,7 @@ void BuildingTypeExt::ExtData::Serialize(T& Stm) .Process(this->PowerPlantEnhancer_Amount) .Process(this->PowerPlantEnhancer_Factor) .Process(this->SuperWeapons) + .Process(this->PhobosMuzzleFlash) ; } diff --git a/src/Ext/BuildingType/Body.h b/src/Ext/BuildingType/Body.h index 0ad858e452..4d9f17a2f2 100644 --- a/src/Ext/BuildingType/Body.h +++ b/src/Ext/BuildingType/Body.h @@ -22,12 +22,14 @@ class BuildingTypeExt Nullable PowerPlantEnhancer_Amount; Nullable PowerPlantEnhancer_Factor; + DynamicVectorClass PhobosMuzzleFlash; ExtData(BuildingTypeClass* OwnerObject) : Extension(OwnerObject), PowersUp_Owner(AffectedHouse::Owner), PowersUp_Buildings(), PowerPlantEnhancer_Buildings(), PowerPlantEnhancer_Amount(), - PowerPlantEnhancer_Factor() + PowerPlantEnhancer_Factor(), + PhobosMuzzleFlash() { } virtual ~ExtData() = default; diff --git a/src/Ext/BuildingType/Hooks.cpp b/src/Ext/BuildingType/Hooks.cpp new file mode 100644 index 0000000000..512301c2fc --- /dev/null +++ b/src/Ext/BuildingType/Hooks.cpp @@ -0,0 +1,61 @@ +#include "Body.h" + +#include + +DEFINE_HOOK(0x460285, BuildingTypeClass_LoadFromINI_Muzzle, 0x6) +{ + GET(BuildingTypeClass*, pThis, EBP); + + R->Stack(STACK_OFFS(0x368, 0x358), 0); + R->EDX(0); + + auto nCount = pThis->MaxNumberOccupants; + + //manipulate this so it can disable itself use phobos one instead + nCount = Math::clamp(nCount, 0, 11); + return !nCount || nCount == 11 ? 0x460388 : 0x460299; +} + +DEFINE_HOOK(0x44043D, BuildingClass_AI_Temporaled_Chronosparkle_MuzzleFix, 0x8) +{ + GET(BuildingClass*, pThis, ESI); + + auto pType = pThis->Type; + if (pType->MaxNumberOccupants > 10) + { + GET(int, nFiringIndex, EBX); + auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); + R->EAX(&pTypeExt->PhobosMuzzleFlash[nFiringIndex]); + } + + return 0; +} + +DEFINE_HOOK(0x45387A, BuildingClass_FireOffset_Replace_MuzzleFix, 0xA) +{ + GET(BuildingClass*, pThis, ESI); + + auto pType = pThis->Type; + if (pType->MaxNumberOccupants > 10) + { + auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); + R->EDX(&pTypeExt->PhobosMuzzleFlash[pThis->FiringOccupantIndex]); + } + + return 0; +} + +DEFINE_HOOK(0x458623, BuildingClass_KillOccupiers_Replace_MuzzleFix, 0x7) +{ + GET(BuildingClass*, pThis, ESI); + + auto pType = pThis->Type; + if (pType->MaxNumberOccupants > 10) + { + GET(int, nFiringIndex, EDI); + auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); + R->ECX(&pTypeExt->PhobosMuzzleFlash[nFiringIndex]); + } + + return 0; +} \ No newline at end of file diff --git a/src/Utilities/TemplateDef.h b/src/Utilities/TemplateDef.h index 3b818409d3..b857af35c2 100644 --- a/src/Utilities/TemplateDef.h +++ b/src/Utilities/TemplateDef.h @@ -50,6 +50,34 @@ #include #include +namespace Templated +{ + template + void ParseVectorWithBaseSize(DynamicVectorClass& nVec, int nBaseSize, INI_EX& nParser, const char* pSection, const char* pBaseFlag, Ta nDefaultVal, bool bParseDebug = false) + { + nVec.Clear(); + nVec.Reserve(nBaseSize); + + for (int i = nVec.Count; i < nBaseSize; ++i) + nVec[i] = nDefaultVal; + + nVec.Count = nBaseSize; + + for (int i = 0; i < nBaseSize; ++i) + { + Valueable nBuffer; + std::string nFlag(pBaseFlag + std::to_string(i)); + nFlag.shrink_to_fit(); + + if (bParseDebug) + Debug::Log("ParseVectorWithBaseSize for [%s]=%s idx[%d] \n", pSection, nFlag.c_str(), i); + + nBuffer.Read(nParser, pSection, nFlag.c_str()); + nVec[i] = nBuffer.Get(); + } + } +}; + namespace detail { template inline bool read(T& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate = false) { From 699cc12b66cde79546949b69f2299f0e70dcd147 Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sun, 12 Dec 2021 18:29:27 +0700 Subject: [PATCH 2/6] test vcxproj --- Phobos.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phobos.vcxproj b/Phobos.vcxproj index b76689c7b2..190edf2b9d 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -21,7 +21,6 @@ - @@ -86,6 +85,7 @@ + @@ -381,4 +381,4 @@ - \ No newline at end of file + From 7be0c7e484c58a987dfe3618a0ec784c23f1ad4a Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 3 Jan 2022 19:24:25 +0200 Subject: [PATCH 3/6] Apply fixes to code style --- Phobos.vcxproj | 768 +++++++++++++++---------------- README.md | 2 +- docs/Fixed-or-Improved-Logics.md | 2 +- docs/Whats-New.md | 2 +- src/Utilities/TemplateDef.h | 48 +- 5 files changed, 411 insertions(+), 411 deletions(-) diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 190edf2b9d..9f5181f543 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -1,384 +1,384 @@ - - - - true - - - - Debug - Win32 - - - DevBuild - Win32 - - - Release - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15.0 - {3FAF7126-F38C-4D1E-9973-C21A37870F60} - Phobos - 10.0 - Phobos - - - - DynamicLibrary - false - v141_xp - NotSet - false - - - DynamicLibrary - false - v141_xp - NotSet - false - - - DynamicLibrary - false - v141_xp - NotSet - false - - - - - - - - - - - - - - - - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - false - $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) - false - $(Configuration)\ - $(Configuration)\IntDir\ - - - - Level4 - MaxSpeed - true - - false - Caret - true - IS_RELEASE_VER;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - IS_RELEASE_VER;%(PreprocessorDefinitions) - - - - - Level4 - MaxSpeed - true - - false - Caret - true - SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - - - Level4 - Disabled - true - - - false - Caret - true - DEBUG;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) - true - false - MultiThreaded - 8Bytes - false - false - StreamingSIMDExtensions - true - false - stdcpplatest - $(IntDir)\%(RelativeDir) - $(IntDir)\%(RelativeDir) - StdCall - /Zc:twoPhase- %(AdditionalOptions) - 4100;4530;4731;4740; - true - true - - - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) - Windows - $(IntDir)$(TargetName).pdb - $(IntDir)$(TargetName).pgd - $(IntDir)$(TargetName).lib - - - - - - - - - /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) - - - /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) - - - - - /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) - - - /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) - - - - - + + + + true + + + + Debug + Win32 + + + DevBuild + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 15.0 + {3FAF7126-F38C-4D1E-9973-C21A37870F60} + Phobos + 10.0 + Phobos + + + + DynamicLibrary + false + v141_xp + NotSet + false + + + DynamicLibrary + false + v141_xp + NotSet + false + + + DynamicLibrary + false + v141_xp + NotSet + false + + + + + + + + + + + + + + + + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + false + $(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath) + false + $(Configuration)\ + $(Configuration)\IntDir\ + + + + Level4 + MaxSpeed + true + + false + Caret + true + IS_RELEASE_VER;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + IS_RELEASE_VER;%(PreprocessorDefinitions) + + + + + Level4 + MaxSpeed + true + + false + Caret + true + SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + + + Level4 + Disabled + true + + + false + Caret + true + DEBUG;SYR_VER=2;HAS_EXCEPTIONS=0;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_USING_V110_SDK71_;%(PreprocessorDefinitions);%(AdditionalDefinitions) + true + false + MultiThreaded + 8Bytes + false + false + StreamingSIMDExtensions + true + false + stdcpplatest + $(IntDir)\%(RelativeDir) + $(IntDir)\%(RelativeDir) + StdCall + /Zc:twoPhase- %(AdditionalOptions) + 4100;4530;4731;4740; + true + true + + + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;dbghelp.lib;%(AdditionalDependencies) + Windows + $(IntDir)$(TargetName).pdb + $(IntDir)$(TargetName).pgd + $(IntDir)$(TargetName).lib + + + + + + + + + /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) + + + /DGIT_COMMIT="$(GitCommit)" %(AdditionalOptions) + + + + + /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) + + + /DGIT_BRANCH="$(GitBranch)" %(AdditionalOptions) + + + + + diff --git a/README.md b/README.md index cd85ee6995..6991437534 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,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, 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 -- **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` bug fix +- **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 - **E1 Elite** - TileSet 255 and above bridge repair fix - **FS-21** - Dump Object Info enhancements, Powered.KillSpawns, Spawner.LimitRange, ScriptType Actions 71, 72, 73, 74 to 81, 92, 93, 94, 95 to 98, 111, 112, MC deployer fixes, help with docs, Automatic Passenger Deletion - **AutoGavy** - interceptor logic, warhead critical damage system diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 8e69dd736d..fcd494fc17 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -41,7 +41,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Animations can now be offset on the X axis with `XDrawOffset`. - `IsSimpleDeployer` units now only play `DeploySound` and `UndeploySound` once, when done with (un)deploying instead of repeating it over duration of turning and/or `DeployingAnim`. - AITrigger can now recognize Building Upgrades as legal condition. -- Fixed bug when Occupied Building `MuzzleFlashX` is drawn on the center of the building when `X` is go beyond 10. +- Fixed the bug when occupied building's `MuzzleFlashX` is drawn on the center of the building when `X` goes past 10. ## Animations diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 32e136426a..3195662d93 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -262,7 +262,7 @@ Vanilla fixes: - Fixed temporal weapon crash under certain conditions where stack dump starts with 0051BB7D (by secsome) - Fixed the bug when retinting map lighting with a map action corrupted light sources (by secsome) - Fixed the bug that AITriggerTypes do not recognize building upgrades (by Uranusian) -- Fixed the bug when Occupied Building `MuzzleFlashX` is drawn on the center of the building when `X` is go beyond 10 (by Otamaa) +- Fixed the bug when occupied building's `MuzzleFlashX` is drawn on the center of the building when `X` goes past 10 (by Otamaa) Phobos fixes: - Fixed shields being able to take damage when the parent TechnoType was under effects of a `Temporal` Warhead (by Starkku) diff --git a/src/Utilities/TemplateDef.h b/src/Utilities/TemplateDef.h index b857af35c2..b1fd71d5d1 100644 --- a/src/Utilities/TemplateDef.h +++ b/src/Utilities/TemplateDef.h @@ -50,31 +50,31 @@ #include #include -namespace Templated +namespace Templated { - template - void ParseVectorWithBaseSize(DynamicVectorClass& nVec, int nBaseSize, INI_EX& nParser, const char* pSection, const char* pBaseFlag, Ta nDefaultVal, bool bParseDebug = false) - { - nVec.Clear(); - nVec.Reserve(nBaseSize); - - for (int i = nVec.Count; i < nBaseSize; ++i) - nVec[i] = nDefaultVal; - - nVec.Count = nBaseSize; - - for (int i = 0; i < nBaseSize; ++i) - { - Valueable nBuffer; - std::string nFlag(pBaseFlag + std::to_string(i)); - nFlag.shrink_to_fit(); - - if (bParseDebug) - Debug::Log("ParseVectorWithBaseSize for [%s]=%s idx[%d] \n", pSection, nFlag.c_str(), i); - - nBuffer.Read(nParser, pSection, nFlag.c_str()); - nVec[i] = nBuffer.Get(); - } + template + void ParseVectorWithBaseSize(DynamicVectorClass& result, int baseSize, INI_EX& iniParser, const char* pSection, const char* pBaseFlag, T defaultValue, bool debug = false) + { + result.Clear(); + result.Reserve(baseSize); + + for (int i = result.Count; i < baseSize; ++i) + result[i] = defaultValue; + + result.Count = baseSize; + + for (int i = 0; i < baseSize; ++i) + { + Valueable buffer; + std::string flag(pBaseFlag + std::to_string(i)); + flag.shrink_to_fit(); + + if (debug) + Debug::Log("ParseVectorWithBaseSize for [%s]=%s idx[%d] \n", pSection, flag.c_str(), i); + + buffer.Read(iniParser, pSection, flag.c_str()); + result[i] = buffer.Get(); + } } }; From 435ebb4c0232ae2537506c8ef8d24820dda6d0f9 Mon Sep 17 00:00:00 2001 From: Metadorius Date: Mon, 3 Jan 2022 20:12:53 +0200 Subject: [PATCH 4/6] Rename variable --- src/Ext/BuildingType/Body.cpp | 6 +++--- src/Ext/BuildingType/Body.h | 5 +++-- src/Ext/BuildingType/Hooks.cpp | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Ext/BuildingType/Body.cpp b/src/Ext/BuildingType/Body.cpp index 03100d8684..b15ceaa9e7 100644 --- a/src/Ext/BuildingType/Body.cpp +++ b/src/Ext/BuildingType/Body.cpp @@ -117,8 +117,8 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) } } - if (pThis->MaxNumberOccupants > 10) - Templated::ParseVectorWithBaseSize(this->PhobosMuzzleFlash, pThis->MaxNumberOccupants, exArtINI, pSection, "MuzzleFlash", Point2D::Empty,true); + if (pThis->MaxNumberOccupants > 10) + Templated::ParseVectorWithBaseSize(this->OccupierMuzzleFlashes, pThis->MaxNumberOccupants, exArtINI, pSection, "MuzzleFlash", Point2D::Empty,true); } @@ -138,7 +138,7 @@ void BuildingTypeExt::ExtData::Serialize(T& Stm) .Process(this->PowerPlantEnhancer_Amount) .Process(this->PowerPlantEnhancer_Factor) .Process(this->SuperWeapons) - .Process(this->PhobosMuzzleFlash) + .Process(this->OccupierMuzzleFlashes) ; } diff --git a/src/Ext/BuildingType/Body.h b/src/Ext/BuildingType/Body.h index 4d9f17a2f2..391c6f487e 100644 --- a/src/Ext/BuildingType/Body.h +++ b/src/Ext/BuildingType/Body.h @@ -22,14 +22,15 @@ class BuildingTypeExt Nullable PowerPlantEnhancer_Amount; Nullable PowerPlantEnhancer_Factor; - DynamicVectorClass PhobosMuzzleFlash; + DynamicVectorClass OccupierMuzzleFlashes; + ExtData(BuildingTypeClass* OwnerObject) : Extension(OwnerObject), PowersUp_Owner(AffectedHouse::Owner), PowersUp_Buildings(), PowerPlantEnhancer_Buildings(), PowerPlantEnhancer_Amount(), PowerPlantEnhancer_Factor(), - PhobosMuzzleFlash() + OccupierMuzzleFlashes() { } virtual ~ExtData() = default; diff --git a/src/Ext/BuildingType/Hooks.cpp b/src/Ext/BuildingType/Hooks.cpp index 512301c2fc..4982dc8290 100644 --- a/src/Ext/BuildingType/Hooks.cpp +++ b/src/Ext/BuildingType/Hooks.cpp @@ -25,7 +25,7 @@ DEFINE_HOOK(0x44043D, BuildingClass_AI_Temporaled_Chronosparkle_MuzzleFix, 0x8) { GET(int, nFiringIndex, EBX); auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); - R->EAX(&pTypeExt->PhobosMuzzleFlash[nFiringIndex]); + R->EAX(&pTypeExt->OccupierMuzzleFlashes[nFiringIndex]); } return 0; @@ -39,7 +39,7 @@ DEFINE_HOOK(0x45387A, BuildingClass_FireOffset_Replace_MuzzleFix, 0xA) if (pType->MaxNumberOccupants > 10) { auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); - R->EDX(&pTypeExt->PhobosMuzzleFlash[pThis->FiringOccupantIndex]); + R->EDX(&pTypeExt->OccupierMuzzleFlashes[pThis->FiringOccupantIndex]); } return 0; @@ -54,7 +54,7 @@ DEFINE_HOOK(0x458623, BuildingClass_KillOccupiers_Replace_MuzzleFix, 0x7) { GET(int, nFiringIndex, EDI); auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType); - R->ECX(&pTypeExt->PhobosMuzzleFlash[nFiringIndex]); + R->ECX(&pTypeExt->OccupierMuzzleFlashes[nFiringIndex]); } return 0; From 81aa75e6ba990898255e2198680559be18156f94 Mon Sep 17 00:00:00 2001 From: Otamaa Date: Tue, 4 Jan 2022 12:10:33 +0700 Subject: [PATCH 5/6] Resolve --- src/Ext/BuildingType/Hooks.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Ext/BuildingType/Hooks.cpp b/src/Ext/BuildingType/Hooks.cpp index 4982dc8290..5f96ac547c 100644 --- a/src/Ext/BuildingType/Hooks.cpp +++ b/src/Ext/BuildingType/Hooks.cpp @@ -4,16 +4,17 @@ DEFINE_HOOK(0x460285, BuildingTypeClass_LoadFromINI_Muzzle, 0x6) { + enum { Skip = 0x460388, Read = 0x460299 }; + GET(BuildingTypeClass*, pThis, EBP); + // Restore overriden instructions R->Stack(STACK_OFFS(0x368, 0x358), 0); R->EDX(0); - auto nCount = pThis->MaxNumberOccupants; - - //manipulate this so it can disable itself use phobos one instead - nCount = Math::clamp(nCount, 0, 11); - return !nCount || nCount == 11 ? 0x460388 : 0x460299; + // Disable Vanilla Muzzle flash when MaxNumberOccupants is 0 or more than 10 + return !pThis->MaxNumberOccupants || pThis->MaxNumberOccupants > 10 + ? Skip : Read; } DEFINE_HOOK(0x44043D, BuildingClass_AI_Temporaled_Chronosparkle_MuzzleFix, 0x8) From 747f944c3866a4190f5f14386f79ecd7de9204ac Mon Sep 17 00:00:00 2001 From: Otamaa Date: Tue, 4 Jan 2022 12:27:47 +0700 Subject: [PATCH 6/6] Remove `Templated` --- src/Ext/BuildingType/Body.cpp | 16 ++++++++++++++-- src/Utilities/TemplateDef.h | 28 ---------------------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/Ext/BuildingType/Body.cpp b/src/Ext/BuildingType/Body.cpp index b15ceaa9e7..454d145d47 100644 --- a/src/Ext/BuildingType/Body.cpp +++ b/src/Ext/BuildingType/Body.cpp @@ -75,7 +75,7 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) { auto pThis = this->OwnerObject(); const char* pSection = pThis->ID; - //const char* pArtSection = pThis->ImageFile; + const char* pArtSection = pThis->ImageFile; auto pArtINI = &CCINIClass::INI_Art(); if (!pINI->GetSection(pSection)) @@ -118,7 +118,19 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) } if (pThis->MaxNumberOccupants > 10) - Templated::ParseVectorWithBaseSize(this->OccupierMuzzleFlashes, pThis->MaxNumberOccupants, exArtINI, pSection, "MuzzleFlash", Point2D::Empty,true); + { + char tempBuffer[32]; + this->OccupierMuzzleFlashes.Clear(); + this->OccupierMuzzleFlashes.Reserve(pThis->MaxNumberOccupants); + + for (int i = 0; i < pThis->MaxNumberOccupants; ++i) + { + Nullable nMuzzleLocation; + _snprintf_s(tempBuffer, sizeof(tempBuffer), "MuzzleFlash%d", i); + nMuzzleLocation.Read(exArtINI, pArtSection, tempBuffer); + this->OccupierMuzzleFlashes[i] = nMuzzleLocation.Get(Point2D::Empty); + } + } } diff --git a/src/Utilities/TemplateDef.h b/src/Utilities/TemplateDef.h index b1fd71d5d1..3b818409d3 100644 --- a/src/Utilities/TemplateDef.h +++ b/src/Utilities/TemplateDef.h @@ -50,34 +50,6 @@ #include #include -namespace Templated -{ - template - void ParseVectorWithBaseSize(DynamicVectorClass& result, int baseSize, INI_EX& iniParser, const char* pSection, const char* pBaseFlag, T defaultValue, bool debug = false) - { - result.Clear(); - result.Reserve(baseSize); - - for (int i = result.Count; i < baseSize; ++i) - result[i] = defaultValue; - - result.Count = baseSize; - - for (int i = 0; i < baseSize; ++i) - { - Valueable buffer; - std::string flag(pBaseFlag + std::to_string(i)); - flag.shrink_to_fit(); - - if (debug) - Debug::Log("ParseVectorWithBaseSize for [%s]=%s idx[%d] \n", pSection, flag.c_str(), i); - - buffer.Read(iniParser, pSection, flag.c_str()); - result[i] = buffer.Get(); - } - } -}; - namespace detail { template inline bool read(T& value, INI_EX& parser, const char* pSection, const char* pKey, bool allocate = false) {