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
fix(w3ddevice): turn only a launch bone by the turret's art angle
Olcay Seyganc4f85c099fe5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2deeb0d99..96e5690f9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -365,7 +365,7 @@ found and fixed, EA's own, not port damage.**- 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.- 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.-- The Fire Base lobs its shells again. Its howitzer fires the tanks' shell, so once tank shells went straight it fired flat as well: the barrel stood 46 degrees up and the shell went out ten degrees down, straight along the line to the target. A shell from a raised barrel now follows the barrel, climbs 35 over the line on a 105 shot and drops onto the target at about 67 degrees, and the Air Force, Laser and Superweapon generals' Fire Bases do the same. Tank barrels sit level, so tank shells still fly straight, at a target close below them too.+- The Fire Base lobs its shells again. Its howitzer fires the tanks' shell, so once tank shells went straight it fired flat as well: the barrel stood 46 degrees up and the shell went out ten degrees down, straight along the line to the target. A shell from a raised barrel now follows the barrel, climbs 35 over the line on a 105 shot and drops onto the target at about 67 degrees, and the Air Force, Laser and Superweapon generals' Fire Bases do the same. Tank barrels sit level, so tank shells still fly straight, at a target close below them too. The campaign's battleships had it the other way round: the front turret's art faces backward, and its shells left 12 degrees under barrels drawn 12 degrees up (20 under on the USS Bender). They now leave along the barrel and still land on the target.- 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.- Machine gun fire looks fast. The tracers of a Humvee, a Technical or a Quad Cannon crawled across the field at 300 a second and took half a second to reach a target 150 away; they now cross it in a tenth of a second, at 1,500, as streaks twice as long. Rangers, Rebels, Gattling Tanks and Cannons, Comanches and the Spectre got the same treatment. Only the picture changed: every bullet lands when it always did.diff --git a/GeneralsMD/Code/Data/Scenarios/shellpaths.txt b/GeneralsMD/Code/Data/Scenarios/shellpaths.txtindex 1644475f5..296869be3 100644--- a/GeneralsMD/Code/Data/Scenarios/shellpaths.txt+++ b/GeneralsMD/Code/Data/Scenarios/shellpaths.txt@@ -18,8 +18,9 @@# and Superweapon Fire Bases do the same (barrel 38 to 57, leave 1.4 under it). Every tank barrel# reads -2.5 or 0, since the logic never tilts a hull on a slope, and every tank shell, the Overlord's# at 10 degrees down included, still flies the line. The battleship's front turret is aimed 12 up but-# its launch bone reads 12 down (its art faces backward and the logic pitches it the wrong way), so-# its shells fly the line and land on the target as before. Inferno and Nuke Cannon shells are+# its launch matrix read 12 down (its art faces backward, it has no launch bone, and the identity+# matrix was turned by the art angle anyway), so its shells flew the line. It now reads 12 up: the+# shell leaves at 11, peaks 19 over the line on a 330 shot and comes down on the car at 17. Inferno and Nuke Cannon shells are# unchanged to the tenth of a degree.## Sharpest nose turn in one frame, before and after straight tank shells, barrel-led lobs and thediff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.hindex b404ca778..4ec92a7b2 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h@@ -178,6 +178,7 @@ struct ModelConditionInfoInt m_fxBone; ///< the FX bone for this barrel (zero == no bone)Int m_muzzleFlashBone; ///< the muzzle-flash subobj bone for this barrel (zero == none)Matrix3D m_projectileOffsetMtx; ///< where the projectile fires from+ Bool m_hasProjectileLaunchBone; ///< m_projectileOffsetMtx is a launch bone, posed the way the turret's art faces; else identity#if defined(_DEBUG) || defined(_INTERNAL)AsciiString m_muzzleFlashBoneName;#endif@@ -193,6 +194,7 @@ struct ModelConditionInfom_fxBone = 0;m_muzzleFlashBone = 0;m_projectileOffsetMtx.Make_Identity();+ m_hasProjectileLaunchBone = false;#if defined(_DEBUG) || defined(_INTERNAL)m_muzzleFlashBoneName.clear();#endifdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppindex acb9eda70..ff040e84f 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp@@ -822,7 +822,10 @@ void ModelConditionInfo::validateWeaponBarrelInfo() constsnprintf(buffer, ARRAY_SIZE(buffer), "%s%02d",plbName.str(), i);const Matrix3D* mtx = findPristineBone(NAMEKEY(buffer), &plbBoneIndex);if (mtx != NULL)+ {info.m_projectileOffsetMtx = *mtx;+ info.m_hasProjectileLaunchBone = true;+ }}if (info.m_fxBone == 0 && info.m_recoilBone == 0 && info.m_muzzleFlashBone == 0 && plbBoneIndex == 0)@@ -857,7 +860,10 @@ void ModelConditionInfo::validateWeaponBarrelInfo() constconst Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName), NULL);if (plbMtx != NULL)+ {info.m_projectileOffsetMtx = *plbMtx;+ info.m_hasProjectileLaunchBone = true;+ }elseinfo.m_projectileOffsetMtx.Make_Identity();@@ -3972,7 +3978,11 @@ Bool W3DModelDraw::getProjectileLaunchOffset(CRCDEBUG_LOG(("specificBarrelToUse = %d\n", specificBarrelToUse));*launchPos = wbvec[specificBarrelToUse].m_projectileOffsetMtx;- if (tur != TURRET_INVALID)+ // The art angle turns a launch bone, posed the way the turret's art faces, to the front. With+ // no launch bone the matrix is the object's own, facing the front already, and turned by the+ // art it faced backward, so the turret's pitch tipped it down: the battleship's front guns+ // fired 12 degrees under barrels drawn 12 degrees up.+ if (tur != TURRET_INVALID && wbvec[specificBarrelToUse].m_hasProjectileLaunchBone){launchPos->Pre_Rotate_Z(stateToUse->m_turrets[tur].m_turretArtAngle);launchPos->Pre_Rotate_Y(-stateToUse->m_turrets[tur].m_turretArtPitch);