Skip to content

[Highly Customized] New AdvancedDrive locomotor #1622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6d0a072
Core
CrimRecya Apr 10, 2025
c3e87b0
Missing part
CrimRecya Apr 10, 2025
cf6502e
...
CrimRecya Apr 10, 2025
ebe9a83
Update YRpp
CrimRecya Apr 15, 2025
2c66b9b
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Apr 15, 2025
fea9843
Update YRpp
CrimRecya Apr 15, 2025
e74d2a0
Reverse when delivering ore
CrimRecya Apr 16, 2025
b4d7747
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Apr 16, 2025
4d0a7d9
Some optimize
CrimRecya Apr 16, 2025
738d0f5
Rename
CrimRecya Apr 16, 2025
a3110e0
Fix AI
CrimRecya Apr 17, 2025
c05abde
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Apr 17, 2025
7e9b9ca
Fix 0 speed crash
CrimRecya Apr 24, 2025
ac1378f
Merge branch 'develop' into develop-SkilledLoco
CrimRecya Apr 24, 2025
769a628
Update YRpp
CrimRecya Apr 24, 2025
d39b6f6
Doc
CrimRecya Apr 25, 2025
c737326
Fix piggyback stuck
CrimRecya Apr 26, 2025
10cf0b3
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Apr 26, 2025
9f0414b
Fix reverse tilt when crush
CrimRecya May 8, 2025
6fc3a41
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya May 8, 2025
70fec73
Use `locomotion_cast`
CrimRecya May 9, 2025
1de63ef
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya May 9, 2025
3db4bc2
Fix merge
CrimRecya May 9, 2025
a213432
最小自动倒车距离
CrimRecya May 15, 2025
1c5528f
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya May 15, 2025
466b161
Fix the permanent deceleration caused by crushing
CrimRecya May 21, 2025
eafc793
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya May 21, 2025
8020e2a
Readability
CrimRecya May 21, 2025
3512e94
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya May 21, 2025
a880866
Fix `AdvancedDrive.FaceTargetRange`
CrimRecya Jun 9, 2025
ce79863
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Jun 9, 2025
e65b2b9
Update YRpp
CrimRecya Jun 9, 2025
6a8276c
Fix typo
CrimRecya Aug 11, 2025
3579c3e
Merge remote-tracking branch 'upstream/develop' into develop-SkilledLoco
CrimRecya Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ This page lists all the individual contributions to the project by their author.
- Laser, electric bolt and rad beam scatter
- Fix an issue that laser, electric bolt and rad beam not support `Inviso=true` projectiles with `FlakScatter=true` to scatter
- Fix an issue that units on the slope tilted at an excessive angle
- New Skilled locomotor
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
2 changes: 2 additions & 0 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<ClCompile Include="src\Ext\Trigger\Hooks.cpp" />
<ClCompile Include="src\Ext\Unit\Hooks.Crushing.cpp" />
<ClCompile Include="src\Locomotion\TestLocomotionClass.cpp" />
<ClCompile Include="src\Locomotion\SkilledLocomotionClass.cpp" />
<ClCompile Include="src\Misc\Hooks.Gamespeed.cpp" />
<ClCompile Include="src\Misc\Hooks.Ares.cpp" />
<ClCompile Include="src\Misc\Hooks.Crates.cpp" />
Expand Down Expand Up @@ -212,6 +213,7 @@
<ClInclude Include="src\Ext\Team\Body.h" />
<ClInclude Include="src\Ext\TEvent\Body.h" />
<ClInclude Include="src\Locomotion\TestLocomotionClass.h" />
<ClInclude Include="src\Locomotion\SkilledLocomotionClass.h" />
<ClInclude Include="src\Misc\BlittersFix.h" />
<ClInclude Include="src\Ext\CaptureManager\Body.h" />
<ClInclude Include="src\Misc\FlyingStrings.h" />
Expand Down
1 change: 1 addition & 0 deletions docs/Miscellanous.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ SaveVariablesOnScenarioEnd=false ; boolean
|Teleport | `{4A582747-9839-11d1-B709-00A024DDAFD1}` |
|Mech | `{55D141B8-DB94-11d1-AC98-006008055BB5}` |
|Ship | `{2BEA74E1-7CCA-11d3-BE14-00104B62A16C}` |
|Skilled | `{4A582751-9839-11d1-B709-00A024DDAFD1}` |

```{note}
`Chrono` is not a standard Alias, but since the default behavior of using `Teleport` will be triggered when the value of `Locomotor` is incorrect, the result of the operation will appear as if `Chrono` has taken effect.
Expand Down
23 changes: 23 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,29 @@ NoQueueUpToEnter= ; boolean
NoQueueUpToUnload= ; boolean
```

## Locomotor

### Skilled Locomotor

- `Skilled` locomotor (`{4A582751-9839-11d1-B709-00A024DDAFD1}`) is an improved `Drive` locomotor (`{4A582741-9839-11d1-B709-00A024DDAFD1}`) that can serve as a complete upper level replacement for it.
- It fixes the issue where `Drive` cannot correctly crush objects during rapid turns.
- It has smoother uphill and downhill dynamic visual effects.
- It has the function of driving the unit backwards.
- `Skilled.ReverseSpeed` controls the speed ratio when reversing.
- `Skilled.FaceTargetRange` controls how close the unit is to its target, allowing reversing.
- `Skilled.ConfrontEnemies` controls whether to maitain the frontal movement towards the enemy within the aforementioned distance and no longer automatically selects by the current orientation.
- `Skilled.RetreatDuration` controls how long since the unit was last injured, allowing reversing.

In `rulesmd.ini`:
```ini
[SOMEVEHICLE] ; VehicleType
Locomotor=Skilled ; Locomotor
Skilled.ReverseSpeed=0.85 ; floating point value
Skilled.FaceTargetRange=16.0 ; floating point value
Skilled.ConfrontEnemies=true ; boolean
Skilled.RetreatDuration=150 ; integer, game frames
```

## Terrain

### Destroy animation & sound
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ Vanilla fixes:
- Fixed the bug that `EnterBioReactorSound`, `LeaveBioReactorSound`, `EnterGrinderSound` on technotype does not used (by NetsuNegi)
- Fixed the bug that harvester dont stop unloading and cannot unload cargos anymore when lifting by `IsLocomotor=yes` warhead (by NetsuNegi)
- Fixed an issue that units on the slope tilted at an excessive angle (by CrimRecya & NetsuNegi)
- New Skilled locomotor (by CrimRecya)

Fixes / interactions with other extensions:
- Allowed `AuxBuilding` and Ares' `SW.Aux/NegBuildings` to count building upgrades (by Ollerus)
Expand Down
1 change: 1 addition & 0 deletions src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ void TechnoExt::ExtData::Serialize(T& Stm)
.Process(this->FiringObstacleCell)
.Process(this->IsDetachingForCloak)
.Process(this->BeControlledThreatFrame)
.Process(this->LastHurtFrame)
.Process(this->LastTargetID)
.Process(this->AccumulatedGattlingValue)
.Process(this->ShouldUpdateGattlingValue)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Techno/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class TechnoExt
CellClass* FiringObstacleCell; // Set on firing if there is an obstacle cell between target and techno, used for updating WaveClass target etc.
bool IsDetachingForCloak; // Used for checking animation detaching, set to true before calling Detach_All() on techno when this anim is attached to and to false after when cloaking only.
int BeControlledThreatFrame;
int LastHurtFrame;
DWORD LastTargetID;
int AccumulatedGattlingValue;
bool ShouldUpdateGattlingValue;
Expand Down Expand Up @@ -103,6 +104,7 @@ class TechnoExt
, FiringObstacleCell {}
, IsDetachingForCloak { false }
, BeControlledThreatFrame { 0 }
, LastHurtFrame { 0 }
, LastTargetID { 0xFFFFFFFF }
, AccumulatedGattlingValue { 0 }
, ShouldUpdateGattlingValue { false }
Expand Down
9 changes: 7 additions & 2 deletions src/Ext/Techno/Hooks.ReceiveDamage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
}

// Raise Combat Alert
if (pRules->CombatAlert && *args->Damage > 1)
if (*args->Damage && (MapClass::GetTotalDamage(*args->Damage, args->WH, pType->Armor, args->DistanceToEpicenter) > 0))
{
auto raiseCombatAlert = [&]()
{
Expand Down Expand Up @@ -96,7 +96,12 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
if (index != -1)
VoxClass::PlayIndex(index);
};
raiseCombatAlert();

if (pRules->CombatAlert)
raiseCombatAlert();

if (pWHExt->CanTargetHouse(pSourceHouse, pThis))
pExt->LastHurtFrame = Unsorted::CurrentFrame;
}

// Shield Receive Damage
Expand Down
10 changes: 10 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

this->RecountBurst.Read(exINI, pSection, "RecountBurst");

this->Skilled_ReverseSpeed.Read(exINI, pSection, "Skilled.ReverseSpeed");
this->Skilled_FaceTargetRange.Read(exINI, pSection, "Skilled.FaceTargetRange");
this->Skilled_ConfrontEnemies.Read(exINI, pSection, "Skilled.ConfrontEnemies");
this->Skilled_RetreatDuration.Read(exINI, pSection, "Skilled.RetreatDuration");

this->BuildLimitGroup_Types.Read(exINI, pSection, "BuildLimitGroup.Types");
this->BuildLimitGroup_Nums.Read(exINI, pSection, "BuildLimitGroup.Nums");
this->BuildLimitGroup_Factor.Read(exINI, pSection, "BuildLimitGroup.Factor");
Expand Down Expand Up @@ -884,6 +889,11 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)

.Process(this->RecountBurst)

.Process(this->Skilled_ReverseSpeed)
.Process(this->Skilled_FaceTargetRange)
.Process(this->Skilled_ConfrontEnemies)
.Process(this->Skilled_RetreatDuration)

.Process(this->BuildLimitGroup_Types)
.Process(this->BuildLimitGroup_Nums)
.Process(this->BuildLimitGroup_Factor)
Expand Down
10 changes: 10 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ class TechnoTypeExt

Nullable<bool> RecountBurst;

Valueable<double> Skilled_ReverseSpeed;
Valueable<double> Skilled_FaceTargetRange;
Valueable<bool> Skilled_ConfrontEnemies;
Valueable<int> Skilled_RetreatDuration;

ValueableVector<TechnoTypeClass*> BuildLimitGroup_Types;
ValueableVector<int> BuildLimitGroup_Nums;
Valueable<int> BuildLimitGroup_Factor;
Expand Down Expand Up @@ -509,6 +514,11 @@ class TechnoTypeExt

, RecountBurst {}

, Skilled_ReverseSpeed { 0.85 }
, Skilled_FaceTargetRange { 16.0 }
, Skilled_ConfrontEnemies { true }
, Skilled_RetreatDuration { 150 }

, BuildLimitGroup_Types {}
, BuildLimitGroup_Nums {}
, BuildLimitGroup_Factor { 1 }
Expand Down
Loading
Loading