From a88f02ca61e90fb0ed97d03af1d8cc34761e7cce Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Sat, 26 Feb 2022 22:23:36 +0800 Subject: [PATCH 1/4] Sharpnel enhancement --- README.md | 2 +- YRpp | 2 +- docs/New-or-Enhanced-Logics.md | 8 ++++++++ docs/Whats-New.md | 3 ++- src/Ext/Bullet/Hooks.cpp | 20 ++++++++++++++++++++ src/Ext/BulletType/Body.cpp | 4 ++++ src/Ext/BulletType/Body.h | 4 ++++ 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb8aa6d64a..6a273d3bbe 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Credits - **4SG** - help with docs - **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 +- **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` - **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, Customize resource storage diff --git a/YRpp b/YRpp index 7c7a04b939..edebf4aeb7 160000 --- a/YRpp +++ b/YRpp @@ -1 +1 @@ -Subproject commit 7c7a04b9398a2c193dc3f962ded866296ede05a4 +Subproject commit edebf4aeb7f173d151ffb10d158bbc3b25bcbf4b diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 5227d73bbb..ac256cf814 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -627,6 +627,14 @@ Interceptor.EliteMinimumGuardRange=0.0 ; double Interceptable=no ; boolean ``` +### Sharpnel enhancement +- Sharpnel behavior can be forced to trigger now. + +In `rulesmd.ini` +[SOMEPROJECTILE] ; Projectile +Sharpnel.Forced=no ; boolean +Sharpnel.AffectBuildings=no ; boolean + ## Trigger events ### `500-511` Variable comparation diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 3399125190..7f9e4e6a00 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -231,7 +231,8 @@ New: - Quicksave hotkey command (by secsome) - Save Game Trigger Action (by secsome) - Numeric Variables (by secsome) -- TechnoType's tooltip would display it's build time now (by secsome) +- TechnoType's tooltip would display it's build time now (by secsome) +- Sharpnel enhancement (by secsome) - Allow `NotHuman=yes` infantry to use random `Death` anim sequence (by Otamaa) - Ability for warheads to trigger specific `NotHuman=yes` infantry `Death` anim sequence (by Otamaa) - XDrawOffset for animations (by Morton) diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index 56273abe9d..39764c1339 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -175,4 +175,24 @@ DEFINE_HOOK(0x6FF031, TechnoClass_FireAt_ReverseVelocityWhileGravityIsZero, 0xA) } return 0; +} + +DEFINE_HOOK(0x46A3D6, BulletClass_Sharpnel_Forced, 0xA) +{ + enum { Sharpnel = 0x46A40C, Skip = 0x46ADCD }; + + GET(BulletClass*, pBullet, EDI); + + auto const pData = BulletTypeExt::ExtMap.Find(pBullet->Type); + + if (pData->Sharpnel_Forced) + return Sharpnel; + + if (auto const pObject = pBullet->GetCell()->FirstObject) + { + if (pObject->WhatAmI() != AbstractType::Building || pData->Sharpnel_AffectBuildings) + return Sharpnel; + } + + return Skip; } \ No newline at end of file diff --git a/src/Ext/BulletType/Body.cpp b/src/Ext/BulletType/Body.cpp index fc126b8109..23785f22e9 100644 --- a/src/Ext/BulletType/Body.cpp +++ b/src/Ext/BulletType/Body.cpp @@ -26,6 +26,8 @@ void BulletTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Interceptable.Read(exINI, pSection, "Interceptable"); this->Gravity.Read(exINI, pSection, "Gravity"); this->Gravity_HeightFix.Read(exINI, pSection, "Gravity.HeightFix"); + this->Sharpnel_Forced.Read(exINI, pSection, "Sharpnel.Forced"); + this->Sharpnel_AffectBuildings.Read(exINI, pSection, "Sharpnel.AffectBuildings"); INI_EX exArtINI(CCINIClass::INI_Art); @@ -43,6 +45,8 @@ void BulletTypeExt::ExtData::Serialize(T& Stm) .Process(this->LaserTrail_Types) .Process(this->Gravity) .Process(this->Gravity_HeightFix) + .Process(this->Sharpnel_Forced) + .Process(this->Sharpnel_AffectBuildings) ; } diff --git a/src/Ext/BulletType/Body.h b/src/Ext/BulletType/Body.h index 2dddedb24a..d47c1d6080 100644 --- a/src/Ext/BulletType/Body.h +++ b/src/Ext/BulletType/Body.h @@ -19,12 +19,16 @@ class BulletTypeExt ValueableIdxVector LaserTrail_Types; Nullable Gravity; Valueable Gravity_HeightFix; + Valueable Sharpnel_Forced; + Valueable Sharpnel_AffectBuildings; ExtData(BulletTypeClass* OwnerObject) : Extension(OwnerObject) , Interceptable { false } , LaserTrail_Types {} , Gravity {} , Gravity_HeightFix { false } + , Sharpnel_Forced { false } + , Sharpnel_AffectBuildings { false } { } virtual ~ExtData() = default; From 496708d7c0467710762d43ee1e61be6b6c89c710 Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Sat, 26 Feb 2022 23:53:12 +0800 Subject: [PATCH 2/4] Try to switch to Windows-2019 --- .github/workflows/nightly.yml | 2 +- Phobos.vcxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c3b65cd35f..bea505fedd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: windows-latest + runs-on: windows-2019 steps: - uses: actions/checkout@v2 diff --git a/Phobos.vcxproj b/Phobos.vcxproj index 4c154c045b..206bb87e0e 100644 --- a/Phobos.vcxproj +++ b/Phobos.vcxproj @@ -175,7 +175,7 @@ 15.0 {3FAF7126-F38C-4D1E-9973-C21A37870F60} Phobos - 10.0 + 7.0 Phobos From 5bd20c6048f1ed0ece16751830bcda59112cab54 Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Sun, 27 Feb 2022 00:02:23 +0800 Subject: [PATCH 3/4] Fix spelling --- docs/New-or-Enhanced-Logics.md | 8 ++++---- src/Ext/Bullet/Hooks.cpp | 12 ++++++------ src/Ext/BulletType/Body.cpp | 8 ++++---- src/Ext/BulletType/Body.h | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index ac256cf814..d52b93a6cc 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -627,13 +627,13 @@ Interceptor.EliteMinimumGuardRange=0.0 ; double Interceptable=no ; boolean ``` -### Sharpnel enhancement -- Sharpnel behavior can be forced to trigger now. +### Shrapnel enhancement +- Shrapnel behavior can be forced to trigger now. In `rulesmd.ini` [SOMEPROJECTILE] ; Projectile -Sharpnel.Forced=no ; boolean -Sharpnel.AffectBuildings=no ; boolean +Shrapnel.Forced=no ; boolean +Shrapnel.AffectsBuildings=no ; boolean ## Trigger events diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index 39764c1339..3c89dfc575 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -177,21 +177,21 @@ DEFINE_HOOK(0x6FF031, TechnoClass_FireAt_ReverseVelocityWhileGravityIsZero, 0xA) return 0; } -DEFINE_HOOK(0x46A3D6, BulletClass_Sharpnel_Forced, 0xA) +DEFINE_HOOK(0x46A3D6, BulletClass_Shrapnel_Forced, 0xA) { - enum { Sharpnel = 0x46A40C, Skip = 0x46ADCD }; + enum { Shrapnel = 0x46A40C, Skip = 0x46ADCD }; GET(BulletClass*, pBullet, EDI); auto const pData = BulletTypeExt::ExtMap.Find(pBullet->Type); - if (pData->Sharpnel_Forced) - return Sharpnel; + if (pData->Shrapnel_Forced) + return Shrapnel; if (auto const pObject = pBullet->GetCell()->FirstObject) { - if (pObject->WhatAmI() != AbstractType::Building || pData->Sharpnel_AffectBuildings) - return Sharpnel; + if (pObject->WhatAmI() != AbstractType::Building || pData->Shrapnel_AffectsBuildings) + return Shrapnel; } return Skip; diff --git a/src/Ext/BulletType/Body.cpp b/src/Ext/BulletType/Body.cpp index 23785f22e9..b6eeeb8059 100644 --- a/src/Ext/BulletType/Body.cpp +++ b/src/Ext/BulletType/Body.cpp @@ -26,8 +26,8 @@ void BulletTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Interceptable.Read(exINI, pSection, "Interceptable"); this->Gravity.Read(exINI, pSection, "Gravity"); this->Gravity_HeightFix.Read(exINI, pSection, "Gravity.HeightFix"); - this->Sharpnel_Forced.Read(exINI, pSection, "Sharpnel.Forced"); - this->Sharpnel_AffectBuildings.Read(exINI, pSection, "Sharpnel.AffectBuildings"); + this->Shrapnel_Forced.Read(exINI, pSection, "Shrapnel.Forced"); + this->Shrapnel_AffectsBuildings.Read(exINI, pSection, "Shrapnel.AffectsBuildings"); INI_EX exArtINI(CCINIClass::INI_Art); @@ -45,8 +45,8 @@ void BulletTypeExt::ExtData::Serialize(T& Stm) .Process(this->LaserTrail_Types) .Process(this->Gravity) .Process(this->Gravity_HeightFix) - .Process(this->Sharpnel_Forced) - .Process(this->Sharpnel_AffectBuildings) + .Process(this->Shrapnel_Forced) + .Process(this->Shrapnel_AffectsBuildings) ; } diff --git a/src/Ext/BulletType/Body.h b/src/Ext/BulletType/Body.h index d47c1d6080..b1786e2504 100644 --- a/src/Ext/BulletType/Body.h +++ b/src/Ext/BulletType/Body.h @@ -19,16 +19,16 @@ class BulletTypeExt ValueableIdxVector LaserTrail_Types; Nullable Gravity; Valueable Gravity_HeightFix; - Valueable Sharpnel_Forced; - Valueable Sharpnel_AffectBuildings; + Valueable Shrapnel_Forced; + Valueable Shrapnel_AffectsBuildings; ExtData(BulletTypeClass* OwnerObject) : Extension(OwnerObject) , Interceptable { false } , LaserTrail_Types {} , Gravity {} , Gravity_HeightFix { false } - , Sharpnel_Forced { false } - , Sharpnel_AffectBuildings { false } + , Shrapnel_Forced { false } + , Shrapnel_AffectsBuildings { false } { } virtual ~ExtData() = default; From 970a7040205ac6ab7518598fa96bf177db88520d Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Sun, 27 Feb 2022 00:29:55 +0800 Subject: [PATCH 4/4] Remove Shrapnel.Forced, Add Shrapnel.AffectsGround --- docs/New-or-Enhanced-Logics.md | 4 ++-- src/Ext/Bullet/Hooks.cpp | 5 ++--- src/Ext/BulletType/Body.cpp | 4 ++-- src/Ext/BulletType/Body.h | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index d52b93a6cc..9342c09624 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -628,11 +628,11 @@ Interceptable=no ; boolean ``` ### Shrapnel enhancement -- Shrapnel behavior can be forced to trigger now. +- Shrapnel behavior can be triggered on the ground and buildings. In `rulesmd.ini` [SOMEPROJECTILE] ; Projectile -Shrapnel.Forced=no ; boolean +Shrapnel.AffectsGround=no ; boolean Shrapnel.AffectsBuildings=no ; boolean ## Trigger events diff --git a/src/Ext/Bullet/Hooks.cpp b/src/Ext/Bullet/Hooks.cpp index 3c89dfc575..93e585d422 100644 --- a/src/Ext/Bullet/Hooks.cpp +++ b/src/Ext/Bullet/Hooks.cpp @@ -185,14 +185,13 @@ DEFINE_HOOK(0x46A3D6, BulletClass_Shrapnel_Forced, 0xA) auto const pData = BulletTypeExt::ExtMap.Find(pBullet->Type); - if (pData->Shrapnel_Forced) - return Shrapnel; - if (auto const pObject = pBullet->GetCell()->FirstObject) { if (pObject->WhatAmI() != AbstractType::Building || pData->Shrapnel_AffectsBuildings) return Shrapnel; } + else if (pData->Shrapnel_AffectsGround) + return Shrapnel; return Skip; } \ No newline at end of file diff --git a/src/Ext/BulletType/Body.cpp b/src/Ext/BulletType/Body.cpp index b6eeeb8059..74b1203235 100644 --- a/src/Ext/BulletType/Body.cpp +++ b/src/Ext/BulletType/Body.cpp @@ -26,7 +26,7 @@ void BulletTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Interceptable.Read(exINI, pSection, "Interceptable"); this->Gravity.Read(exINI, pSection, "Gravity"); this->Gravity_HeightFix.Read(exINI, pSection, "Gravity.HeightFix"); - this->Shrapnel_Forced.Read(exINI, pSection, "Shrapnel.Forced"); + this->Shrapnel_AffectsGround.Read(exINI, pSection, "Shrapnel.AffectsGround"); this->Shrapnel_AffectsBuildings.Read(exINI, pSection, "Shrapnel.AffectsBuildings"); INI_EX exArtINI(CCINIClass::INI_Art); @@ -45,7 +45,7 @@ void BulletTypeExt::ExtData::Serialize(T& Stm) .Process(this->LaserTrail_Types) .Process(this->Gravity) .Process(this->Gravity_HeightFix) - .Process(this->Shrapnel_Forced) + .Process(this->Shrapnel_AffectsGround) .Process(this->Shrapnel_AffectsBuildings) ; } diff --git a/src/Ext/BulletType/Body.h b/src/Ext/BulletType/Body.h index b1786e2504..b10e54e119 100644 --- a/src/Ext/BulletType/Body.h +++ b/src/Ext/BulletType/Body.h @@ -19,7 +19,7 @@ class BulletTypeExt ValueableIdxVector LaserTrail_Types; Nullable Gravity; Valueable Gravity_HeightFix; - Valueable Shrapnel_Forced; + Valueable Shrapnel_AffectsGround; Valueable Shrapnel_AffectsBuildings; ExtData(BulletTypeClass* OwnerObject) : Extension(OwnerObject) @@ -27,7 +27,7 @@ class BulletTypeExt , LaserTrail_Types {} , Gravity {} , Gravity_HeightFix { false } - , Shrapnel_Forced { false } + , Shrapnel_AffectsGround { false } , Shrapnel_AffectsBuildings { false } { }