Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameengine): tank guns pitch onto their target
Olcay Seygan82f77d5dbed9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ed0c2622a..38c1443c4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -421,6 +421,7 @@ found and fixed, EA's own, not port damage.**- A replay recorded before this change plays back differently.- Tell a tank to fire at the ground and it fires from where it stands. On any slope the game read the spot as hidden behind the very hill it was lying on, so a tank with the spot well inside its range drove off looking for a better angle, swinging its hull round under its own turret, and fired on the way. Pulled off a building to shell the ground 140 behind them, a Battlemaster took 84 frames to its first shell on the new spot and now takes 45, which is how long its turret needs to come round, and a pair of Scorpions that used to wander about 200 away over eight seconds now stay where they were put. Replays recorded before this play back differently.- Tank shells fly straight at the target. EA's shell climbed ten over the highest ground on the way and dropped back down, so once the shells glowed, every Crusader shot looked like a lob: it left the barrel 12 degrees high, rose 7 over the line and hit coming down at 25 degrees. Now it flies the line, rising off it by nothing, and only a hill between the tank and its target still lifts it over. This goes for every tank cannon, the Battlemaster, Overlord, Scorpion and Marauder too.+- The gun lowers onto its target. Turrets used to only turn, so the barrel stayed level and a straight shell left it at an angle: a Paladin shooting a car 13 degrees below put its shell 7 degrees under its own barrel. The Crusader, Paladin, Battlemaster and Scorpion, the generals' versions and Turkiye's Altay included, now dip and raise the barrel onto the line from the muzzle to the middle of the target, down to 15 below, and the shell leaves along it: measured at the shot, a Paladin's barrel sat within a degree of its shell's line. The barrel holds that line while the hull tilts on a slope and rocks back with the shot. Hits land when they did and do the same damage: the same fight of five tanks plays out to the same health, frame for frame. The Overlord, the Emperor and the Marauder keep a level gun, because each carries two barrels that the turret cannot pitch together. A replay recorded before this can play back differently, since the shell now starts from the lowered muzzle.- Artillery shells leave along the barrel. A Nuke Cannon's shell used to come out six and a half degrees under its raised barrel and jerk onto its arc; it now leaves the muzzle at the barrel's angle and the arc grows from there. Inferno and Nuke Cannon shells still lob as high as they did.- Artillery lands on time. The Fire Base, the Inferno Cannon, the Nuke Cannon and the campaign's battleships fire like real guns now: the shell flies a true arc and comes down the same time after it left at any range, 1.2 seconds for a Fire Base and 1.6 for the Inferno and Nuke Cannons, and the gun raises its barrel to that arc before it fires. A target close in gets a steep lob from a barrel near upright (a Fire Base fires at 57 degrees on a 108 shot, an Inferno at 77 on a 55 one), a far one a flatter shot (34 degrees at 225, 49 at 235), and the drawn barrel and the shell's way out agree to under a degree. Each flight time is the old shot's average over the gun's range, so a tank has as long to drive out from under it as it had, and a shell still follows a target that keeps moving. Before this the barrel's angle and the arc came from two places and never met. The Fire Base's howitzer fires the tanks' shell, so when tank shells went straight it fired flat under a barrel 46 degrees up; the Inferno's barrel sat at 45 whatever the range. The battleships fired from a point 65 past their front guns and from under the waterline behind them, and both turrets aimed for the front gun; every shell now leaves its own drawn muzzle. A Technical's cannon shell left 17 in front of its gun and now leaves the gun. Tank shells still fly straight.- A SCUD or a Tomahawk flies one smooth curve to its target. A SCUD went straight up, flipped over the top at six degrees a frame, glided flat for a moment and then kinked again into its dive. Now it rolls over and comes down in a single sweep that only ever eases off, its sharpest turn 4.6 degrees a frame. The Scud Storm takes the same curve and lands within half a second of when it did. Replays recorded before this play back differently.diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.iniindex cb1a25cb8..eec1f87e1 100644--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini@@ -1358,6 +1358,920 @@ Object Nuke_OverlordTankShellEndEnd+; ---- tank guns pitch onto their target -----------------------------------------------------------+;+; The shell flew the line, but EA's tank turrets only turn, so the barrel stayed level and the shell+; left the muzzle at an angle to it: 13 degrees down at a Dozer 28 away, and a target on a ridge+; was shot at by a barrel pointing at the ridge's foot. The turret now pitches, 120 degrees a second+; and down to the 15 below that the gun's own MinTargetPitch allows, and AimFromMuzzle lays the+; barrel on the line from its muzzle to the middle of the target, the line the shell flies. The+; drawn barrel pitches on TurretPitch: the Scorpion has an elevation bone (TurretEl, TurretEl01 on+; the big turret); the Crusader, Paladin and Battlemaster pitch the barrel bone that also recoils.+; StabilizedTurretPitch holds the drawn barrel on that line while the drawn hull tilts on the ground+; and rocks with each shot, which the logic's hull never does.+;+; The Overlord, the Emperor and the Marauder keep a level gun. Each has a turret with two barrels on+; two bones (the Marauder's after its second upgrade), and a turret pitches one bone.++Object AmericaTankCrusader+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ DefaultConditionState+ Model = AVLeopard+ Turret = Turret+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = REALLYDAMAGED+ Model = AVLeopard_D+ End+ ConditionState = RUBBLE+ Model = AVLeopard_D+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object SupW_AmericaTankCrusader+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ DefaultConditionState+ Model = AVLeopard+ Turret = Turret+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = REALLYDAMAGED+ Model = AVLeopard_D+ End+ ConditionState = RUBBLE+ Model = AVLeopard_D+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Lazr_AmericaTankCrusader+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ DefaultConditionState+ Model = AVLaserTnk+ Turret = Turret+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponLaunchBone = PRIMARY TurretMS+ HideSubObject = TurretFX01+ End+ ConditionState = REALLYDAMAGED+ Model = AVLaserTnk_D+ End+ ConditionState = RUBBLE+ Model = AVLaserTnk_D1+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object AmericaTankPaladin+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ ExtraPublicBone = Laser+ ConditionState = NONE+ Model = AVPaladin+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = REALLYDAMAGED+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = RUBBLE+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object SupW_AmericaTankPaladin+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ ExtraPublicBone = Laser+ ConditionState = NONE+ Model = AVPaladin+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = REALLYDAMAGED+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = RUBBLE+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Lazr_AmericaTankPaladin+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ ExtraPublicBone = Laser+ ConditionState = NONE+ Model = AVPaladin+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponLaunchBone = PRIMARY TurretMS+ HideSubObject = TurretFX01+ End+ ConditionState = REALLYDAMAGED+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponLaunchBone = PRIMARY TurretMS+ HideSubObject = TurretFX01+ End+ ConditionState = RUBBLE+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponLaunchBone = PRIMARY TurretMS+ HideSubObject = TurretFX01+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Boss_TankPaladin+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ ExtraPublicBone = Laser+ ConditionState = NONE+ Model = AVPaladin+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = REALLYDAMAGED+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ ConditionState = RUBBLE+ Model = AVPaladin_D+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY TurretMS+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY TurretFX+ WeaponLaunchBone = PRIMARY TurretMS+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ TreadDriveSpeedFraction = 0.3+ TreadPivotSpeedFraction = 0.6+ OkToChangeModelColor = Yes+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 180+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object ChinaTankBattleMaster+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ DefaultConditionState+ Model = NVBtMstr+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = NVBtMstr_D+ End+ ConditionState = RUBBLE+ Model = NVBtMstr_D+ End+ TrackMarks = EXTnkTrack.tga+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 120+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Nuke_ChinaTankBattleMaster+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ DefaultConditionState+ Model = NVBtMstr+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = NVBtMstr_D+ End+ ConditionState = RUBBLE+ Model = NVBtMstr_D+ End+ TrackMarks = EXTnkTrack.tga+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 120+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Tank_ChinaTankBattleMaster+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ DefaultConditionState+ Model = NVBtMstrNG+ Turret = Turret01+ TurretPitch = Barrel01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = NVBtMstrNG_D+ End+ ConditionState = RUBBLE+ Model = NVBtMstrNG_D+ End+ TrackMarks = EXTnkTrack.tga+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 120+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ ControlledWeaponSlots = PRIMARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++; The Scorpion's turret also carries its missile rack, which does not pitch; the rocket leaves along+; the barrel's pitch and steers onto the target as it always did.++Object GLATankScorpion+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ ProjectileBoneFeedbackEnabledSlots = SECONDARY+ DefaultConditionState+ Model = UVLiteTank+ Turret = Turret+ TurretPitch = TurretEl+ ShowSubObject = Turret01+ HideSubObject = MissleRack01 MissleRack02 TurretUP01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = UVLiteTank_d+ End+ AliasConditionState = RUBBLE+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ ConditionState = WEAPONSET_PLAYER_UPGRADE+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE REALLYDAMAGED+ Model = UVLiteTank_d+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 100+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ RecenterTime = 5000+ ControlledWeaponSlots = PRIMARY SECONDARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Chem_GLATankScorpion+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ ProjectileBoneFeedbackEnabledSlots = SECONDARY+ DefaultConditionState+ Model = UVLiteTank+ Turret = Turret+ TurretPitch = TurretEl+ ShowSubObject = Turret01+ HideSubObject = MissleRack01 MissleRack02 TurretUP01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = UVLiteTank_d+ End+ AliasConditionState = RUBBLE+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ ConditionState = WEAPONSET_PLAYER_UPGRADE+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE REALLYDAMAGED+ Model = UVLiteTank_d+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 100+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ RecenterTime = 5000+ ControlledWeaponSlots = PRIMARY SECONDARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Demo_GLATankScorpion+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ ProjectileBoneFeedbackEnabledSlots = SECONDARY+ DefaultConditionState+ Model = UVLiteTank+ Turret = Turret+ TurretPitch = TurretEl+ ShowSubObject = Turret01+ HideSubObject = MissleRack01 MissleRack02 TurretUP01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = UVLiteTank_d+ End+ AliasConditionState = RUBBLE+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ ConditionState = WEAPONSET_PLAYER_UPGRADE+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE REALLYDAMAGED+ Model = UVLiteTank_d+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 100+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ RecenterTime = 5000+ ControlledWeaponSlots = PRIMARY SECONDARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object Slth_GLATankScorpion+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ ProjectileBoneFeedbackEnabledSlots = SECONDARY+ DefaultConditionState+ Model = UVLiteTank+ Turret = Turret+ TurretPitch = TurretEl+ ShowSubObject = Turret01+ HideSubObject = MissleRack01 MissleRack02 TurretUP01+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = UVLiteTank_d+ End+ AliasConditionState = RUBBLE+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO+ ConditionState = WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = TurretUP01+ HideSubObject = MissleRack01 MissleRack02 Turret01+ End+ AliasConditionState = WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ ConditionState = WEAPONSET_PLAYER_UPGRADE+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE REALLYDAMAGED+ Model = UVLiteTank_d+ ShowSubObject = MissleRack01 Turret01+ HideSubObject = MissleRack02 TurretUP01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_ONE REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 TurretUP01+ HideSubObject = MissleRack02 Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE WEAPONSET_CRATEUPGRADE_TWO REALLYDAMAGED+ Model = UVLiteTank_d+ TurretPitch = TurretEl01+ ShowSubObject = MissleRack01 MissleRack02 TurretUP01+ HideSubObject = Turret01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 100+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ RecenterTime = 5000+ ControlledWeaponSlots = PRIMARY SECONDARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End++Object GC_Chem_GLATankScorpion+ ReplaceModule ModuleTag_01+ Draw = W3DTankDraw ModuleTag_01_Reforged+ StabilizedTurretPitch = Yes+ OkToChangeModelColor = Yes+ ProjectileBoneFeedbackEnabledSlots = SECONDARY+ DefaultConditionState+ Model = UVLiteTank+ Turret = Turret01+ TurretPitch = TurretEl+ HideSubObject = MissleRack01 Missile+ WeaponFireFXBone = PRIMARY Muzzle+ WeaponRecoilBone = PRIMARY Barrel+ WeaponMuzzleFlash = PRIMARY MuzzleFX+ WeaponLaunchBone = PRIMARY Muzzle+ End+ ConditionState = REALLYDAMAGED+ Model = UVLiteTank_d+ End+ ConditionState = RUBBLE+ Model = UVLiteTank_d+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE+ ShowSubObject = MissleRack01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ WeaponHideShowBone = SECONDARY Missile+ End+ ConditionState = WEAPONSET_PLAYER_UPGRADE REALLYDAMAGED+ Model = UVLiteTank_d+ ShowSubObject = MissleRack01+ WeaponFireFXBone = SECONDARY WeaponA+ WeaponLaunchBone = SECONDARY WeaponA+ WeaponHideShowBone = SECONDARY Missile+ End+ TrackMarks = EXTnkTrack.tga+ TreadAnimationRate = 2.0+ End+ End+ ReplaceModule ModuleTag_03+ Behavior = AIUpdateInterface ModuleTag_03_Reforged+ Turret+ TurretTurnRate = 100+ TurretPitchRate = 120+ AllowsPitch = Yes+ AimFromMuzzle = Yes+ MinPhysicalPitch = -15+ RecenterTime = 5000+ ControlledWeaponSlots = PRIMARY SECONDARY+ End+ AutoAcquireEnemiesWhenIdle = Yes+ End+ End+End+; ---- artillery shells land on time ---------------------------------------------------------------;; EA's artillery shell flew a fixed curve at a speed: the arc's height came from the shell, thediff --git a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini b/GeneralsMD/Code/Data/INI/TurkiyeReforged.iniindex 9cf264c64..acc36a4f7 100644--- a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini+++ b/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini@@ -1047,8 +1047,10 @@ Object TurkiyeVehicleSakaryaEndEnd; The Paladin's turret fires level, and a rocket leaving it level never reached a target: the- ; salvo went off and nothing was hit. It pitches up the way the Firtina's launcher does.- ReplaceModule ModuleTag_03+ ; salvo went off and nothing was hit. It pitches up the way the Firtina's launcher does, and since+ ; the Paladin's barrel pitches (BalanceReforged.ini, whose AI module this replaces) the drawn+ ; launcher stands at the 45 degrees the rockets leave at.+ ReplaceModule ModuleTag_03_ReforgedBehavior = AIUpdateInterface ModuleTag_03_TurkiyeTurretTurretTurnRate = 180diff --git a/GeneralsMD/Code/Data/Scenarios/flatshells.txt b/GeneralsMD/Code/Data/Scenarios/flatshells.txtnew file mode 100644index 000000000..b18753935--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/flatshells.txt@@ -0,0 +1,69 @@+# Tank guns pitched onto their target: one tank per lane, each shooting an unarmed target, on the+# generated map shellpaths.txt uses, whose lanes include a slope up and one down. The tallies give+# when each target lost health and how much, so two builds can be set side by side for hit timing+# and damage.+#+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit+# -randommap 1 2 small -autoskirmish 2 -takeover+# -side 0 FactionAmerica -side 1 FactionGLA -seed 1 -maxframes 900+# -scenario flatshells -logPrefix flatshells_+#+# See mobstress.txt for the line grammar.++30 spawn 0 AmericaTankCrusader 1 500 500+30 spawn 1 AmericaVehicleDozer 1 630 500+30 spawn 0 AmericaTankPaladin 1 850 1600+30 spawn 1 CarCamaro 1 850 1470+30 spawn 0 GLATankScorpion 1 750 1680+30 spawn 1 CarTaxiCab04 1 750 1570+30 spawn 0 ChinaTankOverlord 1 1150 1720+30 spawn 1 CarTaxiCab02 1 1150 1650+30 spawn 0 ChinaTankBattleMaster 1 560 650+30 spawn 1 ChinaVehicleDozer 1 810 650++60 attack 0 AmericaTankCrusader 1 AmericaVehicleDozer+60 attack 0 AmericaTankPaladin 1 CarCamaro+60 attack 0 GLATankScorpion 1 CarTaxiCab04+60 attack 0 ChinaTankOverlord 1 CarTaxiCab02+60 attack 0 ChinaTankBattleMaster 1 ChinaVehicleDozer++62 tally 1 AmericaVehicleDozer+62 tally 1 CarCamaro+62 tally 1 CarTaxiCab04+62 tally 1 CarTaxiCab02+62 tally 1 ChinaVehicleDozer+70 tally 1 AmericaVehicleDozer+70 tally 1 CarCamaro+70 tally 1 CarTaxiCab04+70 tally 1 CarTaxiCab02+70 tally 1 ChinaVehicleDozer+80 tally 1 AmericaVehicleDozer+80 tally 1 CarCamaro+80 tally 1 CarTaxiCab04+80 tally 1 CarTaxiCab02+80 tally 1 ChinaVehicleDozer+100 tally 1 AmericaVehicleDozer+100 tally 1 CarCamaro+100 tally 1 CarTaxiCab04+100 tally 1 CarTaxiCab02+100 tally 1 ChinaVehicleDozer+130 tally 1 AmericaVehicleDozer+130 tally 1 CarCamaro+130 tally 1 CarTaxiCab04+130 tally 1 CarTaxiCab02+130 tally 1 ChinaVehicleDozer+160 tally 1 AmericaVehicleDozer+160 tally 1 CarCamaro+160 tally 1 CarTaxiCab04+160 tally 1 CarTaxiCab02+160 tally 1 ChinaVehicleDozer+220 tally 1 AmericaVehicleDozer+220 tally 1 CarCamaro+220 tally 1 CarTaxiCab04+220 tally 1 CarTaxiCab02+220 tally 1 ChinaVehicleDozer+400 tally 1 AmericaVehicleDozer+400 tally 1 CarCamaro+400 tally 1 CarTaxiCab04+400 tally 1 CarTaxiCab02+400 tally 1 ChinaVehicleDozerdiff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.hindex a43f3d746..3b0fb4b7b 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h@@ -243,6 +243,7 @@ public:Bool m_initiallyDisabled; ///< manually controlled and disabled.Bool m_firesWhileTurning; ///< so the firing state does not instantly expire the turning stateBool m_isAllowsPitch; ///< This type of turret can pitch up and down as well as spin+ Bool m_aimFromMuzzle; ///< dependent on allowspitch. Pitch the barrel down the line from its muzzle to the middle of the target (a tank gun)TurretAIData();static void buildFieldParse(MultiIniFieldParse& p);@@ -283,6 +284,7 @@ public:Real getPitchRate() const { return m_data->m_pitchRate; }Real getFirePitch() const { return m_data->m_firePitch; }Real getGroundUnitPitch() const { return m_data->m_groundUnitPitch; }+ Bool isAimFromMuzzle() const { return m_data->m_aimFromMuzzle; }Real getNaturalTurretPitch() const { return m_data->m_naturalTurretPitch; }Real getTurretFireAngleSweepForWeaponSlot( WeaponSlotType slot ) const;Real getTurretSweepSpeedModifierForWeaponSlot( WeaponSlotType slot ) const;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cppindex f09797737..79a323411 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp@@ -210,6 +210,7 @@ TurretAIData::TurretAIData()m_initiallyDisabled = false;m_firesWhileTurning = FALSE;m_isAllowsPitch = false;+ m_aimFromMuzzle = false;}//-------------------------------------------------------------------------------------------------@@ -258,6 +259,7 @@ void TurretAIData::buildFieldParse(MultiIniFieldParse& p){ "TurretSweepSpeedModifier",TurretAIData::parseTurretSweepSpeed, NULL, NULL },{ "ControlledWeaponSlots", parseTWS, NULL, offsetof( TurretAIData, m_turretWeaponSlots ) },{ "AllowsPitch", INI::parseBool, NULL, offsetof( TurretAIData, m_isAllowsPitch ) },+ { "AimFromMuzzle", INI::parseBool, NULL, offsetof( TurretAIData, m_aimFromMuzzle ) },#ifdef INTER_TURRET_DELAY{ "InterTurretDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_interTurretDelay ) },#endif@@ -1230,6 +1232,24 @@ StateReturnType TurretAIAimTurretState::update()desiredPitch = turret->getMinPitch();}}+ // A tank gun points down the line its shell flies, from the muzzle to the middle of the target. EA's+ // aim below runs from the top of the tank to the target's feet, six degrees under the shell's line+ // at 50 away. The pitch is the barrel's own, so the drawn barrel lies on the line; the launch bone+ // is not the measure, since a Crusader's points 2.5 degrees under its barrel and laid on the line+ // it left the barrel that much over it. The drawn hull tilts and the logic's does not, which the+ // draw module takes off (StabilizedTurretPitch).+ else if( turret->isAimFromMuzzle() )+ {+ Matrix3D launchTransform(true);+ Coord3D launchPos;+ Weapon::calcProjectileLaunchPosition( obj, turretWeapon->getWeaponSlot(), turretWeapon->getCurBarrel(), launchTransform, launchPos );+ Real run = sqrtf( sqr( enemyPosition.x - launchPos.x ) + sqr( enemyPosition.y - launchPos.y ) );+ desiredPitch = ATan2( enemyPosition.z + bodyMiddleHeight - launchPos.z, run );+ if( desiredPitch < turret->getMinPitch() )+ {+ desiredPitch = turret->getMinPitch();+ }+ }// Some turrets want to fire at a set pitch, and some want to fire straight to the targetelse if( turret->getFirePitch() > 0 ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cppindex 5941b5456..59b4fef16 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp@@ -63,11 +63,12 @@const Int DEFAULT_MAX_LIFESPAN = 10 * LOGICFRAMES_PER_SECOND;// A StraightWhenClear shell whose barrel is raised steeper than this slope is being lobbed, and takes-// the barrel's arc on open ground too. It is the barrel against level ground and not against the line-// to the victim: a tank's barrel cannot dip, so a target close below it stands well under the barrel,-// and measured that way a Paladin's shot 28 away and 13 degrees down went back to EA's arc. A tank's-// barrel sits within 3 degrees of level (the logic does not tilt the hull on a slope); a Fire Base's-// stands 38 to 57 degrees up. The tangent of 8 degrees.+// the barrel's arc on open ground too. It is the barrel against level ground, or against the line to+// the victim when that climbs: a barrel that cannot dip (the Overlord's) stands well over a target close+// below it, and measured against the line a Paladin's shot 28 away and 13 degrees down went back to+// EA's arc, while a Crusader's barrel that pitches 12 degrees up at a tank on a ridge is aiming, not+// lobbing. A level barrel sits within 3 degrees of level (the logic does not tilt the hull on a slope);+// a Fire Base's stands 38 to 57 degrees up. The tangent of 8 degrees.const Real STRAIGHT_SHOT_MAX_BARREL_SLOPE = 0.1405f;//-----------------------------------------------------------------------------@@ -493,6 +494,8 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments)targetVector.Z = controlPoints[3].z - controlPoints[0].z;Real targetDistance = targetVector.Length();+ Real targetRun = sqrtf( sqr( targetVector.X ) + sqr( targetVector.Y ) );+ Real targetSlope = (targetRun > 0.0f) ? targetVector.Z / targetRun : 0.0f;targetVector.Normalize();Vector3 firstPointAlongLine = targetVector * (targetDistance * d->m_firstPercentIndent );Vector3 secondPointAlongLine = targetVector * (targetDistance * d->m_secondPercentIndent );@@ -508,7 +511,7 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments)controlPoints[1].z = highestInterveningTerrain + d->m_firstHeight;controlPoints[2].z = highestInterveningTerrain + d->m_secondHeight;- if( d->m_straightWhenClear && m_launchSlope < STRAIGHT_SHOT_MAX_BARREL_SLOPE+ if( d->m_straightWhenClear && m_launchSlope < max( targetSlope, 0.0f ) + STRAIGHT_SHOT_MAX_BARREL_SLOPE&& ThePartitionManager->isClearLineOfSightTerrain( NULL, controlPoints[0], NULL, controlPoints[3] ) ){// A cannon shell flies the line to its victim. The arc above was ten over the highest ground on thediff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.hindex 4e3b387e8..7d190dc99 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h@@ -308,6 +308,7 @@ public:ModelConditionFlags m_ignoreConditionStates;Bool m_okToChangeModelColor;Bool m_animationsRequirePower;///< Should UnderPowered disable type pause animations in this draw module?+ Bool m_stabilizedTurretPitch; ///< draw a pitch bone at the logic's pitch against level ground, whatever the drawn hull's tilt#ifdef CACHE_ATTACH_BONEmutable Bool m_attachToDrawableBoneOffsetValid;#endif@@ -531,6 +532,7 @@ private:Int m_hexColor;Int m_whichAnimInCurState; ///< the index of the currently playing anim in cur state (if any)WeaponRecoilInfoVec m_weaponRecoilInfoVec[WEAPONSLOT_COUNT];+ Real m_drawnTurretPitch[MAX_TURRETS]; ///< the pitch handleClientTurretPositioning gave each turret's pitch bone this frameBool m_needRecalcBoneParticleSystems;Coord3D m_groundMotionPos; ///< where stepGroundMotion last saw the unitReal m_groundMotionAngle;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppindex dd0ca5e77..738f222b9 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp@@ -1060,6 +1060,7 @@ W3DModelDrawModuleData::W3DModelDrawModuleData() :m_okToChangeModelColor(false),m_particlesAttachedToAnimatedBones(false),m_animationsRequirePower(true),+ m_stabilizedTurretPitch(false),#ifdef CACHE_ATTACH_BONEm_attachToDrawableBoneOffsetValid(false),#endif@@ -1255,6 +1256,7 @@ void W3DModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p){ "RecoilSettleSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilSettle) },{ "OkToChangeModelColor", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) },{ "AnimationsRequirePower", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) },+ { "StabilizedTurretPitch", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_stabilizedTurretPitch) },{ "ParticlesAttachedToAnimatedBones", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_particlesAttachedToAnimatedBones) },{ "MinLODRequired", INI::parseStaticGameLODLevel, NULL, offsetof(W3DModelDrawModuleData, m_minLODRequired) },{ "ProjectileBoneFeedbackEnabledSlots", INI::parseBitString32, TheWeaponSlotTypeNames, offsetof(W3DModelDrawModuleData, m_projectileBoneFeedbackEnabledSlots) },@@ -1794,6 +1796,8 @@ W3DModelDraw::W3DModelDraw(Thing *thing, const ModuleData* moduleData) : DrawMod{m_weaponRecoilInfoVec[i].clear();}+ for (i = 0; i < MAX_TURRETS; ++i)+ m_drawnTurretPitch[i] = 0.0f;m_needRecalcBoneParticleSystems = false;m_fullyObscuredByShroud = false;m_groundMotionPos.zero();@@ -2936,6 +2940,26 @@ void W3DModelDraw::handleClientTurretPositioning(){if (m_curState)turretPitch += tur.m_turretArtPitch;+ // The logic aims from a hull that never tilts; the drawn one lies on the ground and rocks when+ // it fires. A stabilized gun takes that tilt along its own heading off, and the pitch the art+ // gave the bone (a Paladin's barrel is modelled 5 degrees up), so the drawn barrel stands at+ // the logic's pitch against level ground, down the line its shell flies.+ if (getW3DModelDrawModuleData()->m_stabilizedTurretPitch && m_renderObject && obj)+ {+ Vector3 heading(cosf(turretAngle), sinf(turretAngle), 0.0f);+ Vector3 drawn = m_renderObject->Get_Transform().Rotate_Vector(heading);+ Vector3 logic = obj->getTransformMatrix()->Rotate_Vector(heading);+ turretPitch -= atan2f(drawn.Z, sqrtf(drawn.X * drawn.X + drawn.Y * drawn.Y))+ - atan2f(logic.Z, sqrtf(logic.X * logic.X + logic.Y * logic.Y));+ Int restBone;+ const Matrix3D* rest = m_curState->findPristineBone(tur.m_turretPitchNameKey, &restBone);+ if (rest)+ {+ Vector3 restX = rest->Get_X_Vector();+ turretPitch -= atan2f(restX.Z, sqrtf(restX.X * restX.X + restX.Y * restX.Y));+ }+ }+ m_drawnTurretPitch[tslot] = turretPitch;Matrix3D turretPitchXfrm(1);turretPitchXfrm.Rotate_Y(-turretPitch);if (m_renderObject)@@ -3039,6 +3063,17 @@ void W3DModelDraw::handleClientRecoil()Matrix3D gunXfrm;gunXfrm.Make_Identity();+ // A barrel that is also its turret's pitch bone (a Crusader's, a Battlemaster's: the art has+ // no other bone to pitch) keeps the pitch while it recoils, back along the pitched barrel.+ // This matrix replaces the bone's whole control, so without it every shot snapped it level.+ for (Int tslot = 0; tslot < MAX_TURRETS; ++tslot)+ {+ if (m_curState->m_turrets[tslot].m_turretPitchBone == barrels[i].m_recoilBone)+ {+ gunXfrm.Rotate_Y( -m_drawnTurretPitch[tslot] );+ break;+ }+ }gunXfrm.Translate_X( -recoils[i].m_shift );//DEBUG_ASSERTLOG(recoils[i].m_shift==0.0f,("adjust bone %d by %f\n",recoils[i].m_recoilBone,recoils[i].m_shift));