Skip to content

Commit 5a4750f

Browse files
authored
[Vanilla Enhancement] Restore turret recoil effect (#1625)
- Now you can use `TurretRecoil` to control units’ turret/barrel recoil effect when firing. - `TurretTravel` and `BarrelTravel` control the maximum recoil distance. - `TurretRecoil.Suppress` can prevent the weapon from producing this effect when firing. In `rulesmd.ini`: ```ini [SOMEVEHICLE] ; VehicleType TurretRecoil=no ; boolean TurretTravel=2 ; integer, pixels TurretCompressFrames=1 ; integer, game frames TurretHoldFrames=1 ; integer, game frames TurretRecoverFrames=1 ; integer, game frames BarrelTravel=2 ; integer, pixels BarrelCompressFrames=1 ; integer, game frames BarrelHoldFrames=1 ; integer, game frames BarrelRecoverFrames=1 ; integer, game frames [SOMEWEAPON] ; WeaponType TurretRecoil.Suppress=no ; boolean ``` ```{note} This is not a 1:1 restoration but a separate thing, not like it was in *Tiberian Sun*. ``` ![barrel](https://github.com/user-attachments/assets/9fec1804-67f6-465c-b663-e9df191ff95d) --- And: - Fix an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow`. - Fixed an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file.
1 parent a88a203 commit 5a4750f

File tree

9 files changed

+286
-102
lines changed

9 files changed

+286
-102
lines changed

CREDITS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ This page lists all the individual contributions to the project by their author.
534534
- Fix an issue where Ares' `Convert.Deploy` triggers repeatedly when the unit is turning or moving
535535
- Reverse engineer warhead
536536
- AI base construction modification
537+
- Restore turret recoil effect
538+
- Fix an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow`
539+
- Fix an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file
537540
- **Ollerus**:
538541
- Build limit group enhancement
539542
- Customizable rocker amplitude

YRpp

Submodule YRpp updated 1 file

docs/Fixed-or-Improved-Logics.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
254254
- Fixed the bug that hover vehicle will sink if destroyed on bridge.
255255
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target.
256256
- When `Speed=0` or the TechnoTypes cell cannot move due to `MovementRestrictedTo`, vehicles cannot attack targets beyond the weapon's range. `Area Guard` and `Hunt` missions will also become ineffective.
257+
- Fixed an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file.
257258

258259
## Fixes / interactions with other extensions
259260

@@ -1838,6 +1839,33 @@ In `artmd.ini`:
18381839
TurretShadow= ; boolean
18391840
```
18401841

1842+
### Turret recoil
1843+
1844+
- Now you can use `TurretRecoil` to control units’ turret/barrel recoil effect when firing.
1845+
- `TurretTravel` and `BarrelTravel` control the maximum recoil distance.
1846+
- `TurretRecoil.Suppress` can prevent the weapon from producing this effect when firing.
1847+
1848+
In `rulesmd.ini`:
1849+
```ini
1850+
[SOMEVEHICLE] ; VehicleType
1851+
TurretRecoil=no ; boolean
1852+
TurretTravel=2 ; integer, pixels
1853+
TurretCompressFrames=1 ; integer, game frames
1854+
TurretHoldFrames=1 ; integer, game frames
1855+
TurretRecoverFrames=1 ; integer, game frames
1856+
BarrelTravel=2 ; integer, pixels
1857+
BarrelCompressFrames=1 ; integer, game frames
1858+
BarrelHoldFrames=1 ; integer, game frames
1859+
BarrelRecoverFrames=1 ; integer, game frames
1860+
1861+
[SOMEWEAPON] ; WeaponType
1862+
TurretRecoil.Suppress=no ; boolean
1863+
```
1864+
1865+
```{note}
1866+
The logic below was not reverse-engineered but reimplemented to achieve the same effect, hence there might be some differences in behavior compared to Tiberian Sun version.
1867+
```
1868+
18411869
### Customize harvester dump amount
18421870

18431871
- Now you can limit how much ore the harvester can dump out per time, like it in Tiberium Sun.

docs/Whats-New.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ New:
431431
- When the vehicle loses its target, you can customize whether to align the turret direction with the vehicle body (by FlyStar)
432432
- Reverse engineer warhead (by CrimRecya)
433433
- AI base construction modification (by CrimRecya)
434+
- Restore turret recoil effect (by CrimRecya)
434435
435436
Vanilla fixes:
436437
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
@@ -444,10 +445,12 @@ Vanilla fixes:
444445
- Fixed an issue where airstrike flare line drawn to target at lower elevation would clip (by Starkku)
445446
- Fixed the bug that damaged particle dont disappear after building has repaired by engineer (by NetsuNegi)
446447
- Projectiles with `Vertical=true` now drop straight down if fired off by AircraftTypes instead of behaving erratically (by Starkku)
448+
- Fixed an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file (by CrimRecya)
447449
448450
Phobos fixes:
449451
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
450452
- When `Speed=0` or the TechnoTypes cell cannot move due to `MovementRestrictedTo`, vehicles cannot attack targets beyond the weapon's range. `Area Guard` and `Hunt` missions will also become ineffective (by FlyStar)
453+
- Fixed an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow` (by CrimRecya)
451454
452455
Fixes / interactions with other extensions:
453456
- Allowed `AuxBuilding` and Ares' `SW.Aux/NegBuildings` to count building upgrades (by Ollerus)

src/Ext/Techno/Hooks.Firing.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,15 @@ DEFINE_HOOK(0x6FF43F, TechnoClass_FireAt_FeedbackWeapon, 0x6)
642642
return 0;
643643
}
644644

645+
DEFINE_HOOK(0x6FF0DD, TechnoClass_FireAt_TurretRecoil, 0x6)
646+
{
647+
enum { SkipGameCode = 0x6FF15B };
648+
649+
GET_STACK(WeaponTypeClass* const, pWeapon, STACK_OFFSET(0xB0, -0x70));
650+
651+
return WeaponTypeExt::ExtMap.Find(pWeapon)->TurretRecoil_Suppress ? SkipGameCode : 0;
652+
}
653+
645654
DEFINE_HOOK(0x6FF905, TechnoClass_FireAt_FireOnce, 0x6)
646655
{
647656
GET(TechnoClass*, pThis, ESI);

0 commit comments

Comments
 (0)