Skip to content

[Vanilla Enhancement] Restore turret recoil effect #1625

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 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ This page lists all the individual contributions to the project by their author.
- Fix an issue that if the garrison unload occupants when there is no open space around it would result in the disappearance of the occupants
- Fix an issue where Ares' `Convert.Deploy` triggers repeatedly when the unit is turning or moving
- Reverse engineer warhead
- Restore turret recoil effect
- Fix an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow`
- 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
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
28 changes: 28 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the bug that hover vehicle will sink if destroyed on bridge.
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target.
- 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.
- 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.

## Fixes / interactions with other extensions

Expand Down Expand Up @@ -1817,6 +1818,33 @@ In `artmd.ini`:
TurretShadow= ; boolean
```

### Turret recoil

- 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}
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.
```

### Customize harvester dump amount

- Now you can limit how much ore the harvester can dump out per time, like it in Tiberium Sun.
Expand Down
3 changes: 3 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ New:
- [Auto deploy for GI-like infantry](Fixed-or-Improved-Logics.md#auto-deploy-for-gi-like-infantry) (by TaranDahl)
- When the vehicle loses its target, you can customize whether to align the turret direction with the vehicle body (by FlyStar)
- Reverse engineer warhead (by CrimRecya)
- Restore turret recoil effect (by CrimRecya)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand All @@ -443,10 +444,12 @@ Vanilla fixes:
- Fixed an issue where airstrike flare line drawn to target at lower elevation would clip (by Starkku)
- Fixed the bug that damaged particle dont disappear after building has repaired by engineer (by NetsuNegi)
- Projectiles with `Vertical=true` now drop straight down if fired off by AircraftTypes instead of behaving erratically (by Starkku)
- 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)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
- 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)
- Fixed an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow` (by CrimRecya)

Fixes / interactions with other extensions:
- Allowed `AuxBuilding` and Ares' `SW.Aux/NegBuildings` to count building upgrades (by Ollerus)
Expand Down
9 changes: 9 additions & 0 deletions src/Ext/Techno/Hooks.Firing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,15 @@ DEFINE_HOOK(0x6FF43F, TechnoClass_FireAt_FeedbackWeapon, 0x6)
return 0;
}

DEFINE_HOOK(0x6FF0DD, TechnoClass_FireAt_TurretRecoil, 0x6)
{
enum { SkipGameCode = 0x6FF15B };

GET_STACK(WeaponTypeClass* const, pWeapon, STACK_OFFSET(0xB0, -0x70));

return WeaponTypeExt::ExtMap.Find(pWeapon)->TurretRecoil_Suppress ? SkipGameCode : 0;
}

DEFINE_HOOK(0x6FF905, TechnoClass_FireAt_FireOnce, 0x6)
{
GET(TechnoClass*, pThis, ESI);
Expand Down
Loading
Loading