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): -volsmoke tank death sparks white, base masses apart
Olcay Seyganb41c278fcc5d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6cb930b6d..d418b973c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -112,7 +112,7 @@ found and fixed, EA's own, not port damage.**## Smoke simulation- Options > Effects has a Smoke Simulation box. On Low or High a tank's cook-off, a shell's dirt fountain and a nuclear mushroom are a moving body of air rather than flat sprites: the smoke rolls, rises with the heat, settles as dust and parts round the buildings in its way. Off is the default, and Off draws exactly the picture the game drew before. The box works mid-match, the next frame after you press Accept, on the default renderer; the Direct3D 9 renderer and the Classic graphics setting hide it.-- A tank goes up the way the footage of a real one does. Orange flame and black smoke burst out low along its own hull, long under an Overlord and short under a Crusader, and roll along the ground off both ends. A ragged fan of blown-out white fire with orange edges rises straight off the hull and opens wider as it climbs, tallest in the middle, on High about twice as tall as the fire is wide and on Low a shorter fan of the same shape, and in about a second it has cooled through orange to grey-brown smoke. Near-black masses bank up on both long sides of the hull at its top, in front of the fire, with flame showing between them, and slump away inside a second; the soot laid there before burned with the fire beside it and from the side read as a haze. Hot sparks streak up out of the fire and out over the fan in long thin straight lines and fall back, where they were short beaded comets. The wreck's black column is gone about two seconds after the death, and a thin wisp over a glowing ember fades out by three and a half, a quarter as long as the game's own smoke with the setting Off, so a fast game is never fighting through last minute's smoke; it used to stand for half a minute, which in a fast game left a field of black pillars. A Crusader's fan no longer stands on a thin stem or grows horns at its edges. The glowing ball and the rays round it are gone, and so is the ring on the ground. Shells that hit a tank's armour no longer throw a fountain of dirt off it. The scrap flying off a dead tank keeps its own sparks but no longer drags thick grey arcs across the fire, and every gun but a tank's keeps the soft grey muzzle puff it always had, where it had turned into a flat tan disc on the ground.+- A tank goes up the way the footage of a real one does. Orange flame and black smoke burst out low along its own hull, long under an Overlord and short under a Crusader, and roll along the ground off both ends. A ragged fan of blown-out white fire with orange edges rises straight off the hull and opens wider as it climbs, tallest in the middle, on High about twice as tall as the fire is wide and on Low a shorter fan of the same shape, and in about a second it has cooled through orange to grey-brown smoke. Two round near-black blobs stand on each long side of the hull at its top, in front of the fire, apart from each other with flame showing between them and their rims glowing red, and slump away inside a second; the soot laid there before burned with the fire beside it and from the side read as a haze. White-hot sparks streak up out of the fire and out over the fan in long thin straight lines and fall back, where they were short orange beaded comets. The wreck's black column is gone about two seconds after the death, and a thin wisp over a glowing ember fades out by three and a half, a quarter as long as the game's own smoke with the setting Off, so a fast game is never fighting through last minute's smoke; it used to stand for half a minute, which in a fast game left a field of black pillars. A Crusader's fan no longer stands on a thin stem or grows horns at its edges. The glowing ball and the rays round it are gone, and so is the ring on the ground. Shells that hit a tank's armour no longer throw a fountain of dirt off it. The scrap flying off a dead tank keeps its own sparks but no longer drags thick grey arcs across the fire, and every gun but a tank's keeps the soft grey muzzle puff it always had, where it had turned into a flat tan disc on the ground.- A tank gun fires the way footage of a real one does. A cone of flame comes straight out of the muzzle along the barrel's own aim, white-hot at the tip and orange-red at its fringe, widening forward, and is gone in about a sixth of a second; the first version blew a round ball a gun's length ahead of the barrel with a gap behind it. It leaves a little grey smoke in front of the gun over the dust the blast blows off the ground round the tank's front, and both are gone in a second and a half. A Battlemaster's or a Scorpion's smaller gun throws a smaller flame, an Overlord's a bigger one. A shell striking armour throws one dense burst of thin white-yellow streaks out of the point it struck, over a hot white core, back towards the tank that fired it. The game's own sparks used to burst over the turret whichever side was struck, and stacked on the new ones they read as fireworks all over the tank: for those hits they are gone, and the white oval that used to flash over the whole tank is a small flash now. In a fight of fifteen tanks the shots and hits cost about 0.2 ms of GPU time a frame on High and next to nothing on Low, on an RTX 2060. Six shots at a time draw this way on High and three on Low; past that a shot keeps the game's own flash, and a shot whose slab a bigger blast takes gets its own flash back.- A nuke builds a mushroom you can read. The flash is light: the ground, the buildings and the missile's own smoke trail go white for a third of a second, where a flat white disc used to cover half the screen for most of a second. From the first frame a lumpy ball of fire sits on the ground, yellow-white inside an orange-red rim, with a thin white dome running out round it, and the orange disc that lay on the ground under it is gone. The ball rises and slows, and by five seconds is an orange cap on a thin grey-brown stem. A white collar rings the stem for a few seconds. The cap cools to cream and lumpy cauliflower, three to four times as wide as the stem, and it stays up for over a minute; the old one was a dark brown disc that had thinned away inside twelve seconds. The dark dust that used to bury the whole base under the cloud is gone, and a low wall of dust runs out along the ground between the buildings instead. The missile's own trail is smoke in the same air now, a thick pale column behind it on the way up from the silo and on the way down, drifting with the wind and spreading as it thins, where it used to stay a column of flat sprites.- Every other smoke goes the same way while it is on: missile and rocket trails, the dust behind a tank, a burning building's column, muzzle smoke. They are fed into one body of air round the camera instead of being drawn as sprites, and a unit moving through it pushes it. A tank's hull shoves the smoke aside and leaves a turning wake, a jet drags a sheet of it down between two wingtip vortices, and a helicopter hovering low flattens a burning column into a dark ring on the ground and lifts a band of dust round itself. A blast's front pushes the smoke already hanging round it outwards. Units you cannot see push nothing, so the smoke never gives away a stealthed tank or an unscouted base.diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.iniindex 531fa4467..a59db3b01 100644--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini@@ -6506,9 +6506,9 @@ ParticleSystem ReforgedTankDeathSparksGravity = -0.30Lifetime = 20.00 32.00SystemLifetime = 4- Size = 2.00 2.60+ Size = 1.20 1.60StartSizeRate = 0.00 0.00- SizeRate = -0.03 -0.02+ SizeRate = -0.02 -0.01SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0@@ -6518,9 +6518,9 @@ ParticleSystem ReforgedTankDeathSparksAlpha6 = 0.00 0.00 0Alpha7 = 0.00 0.00 0Alpha8 = 0.00 0.00 0- Color1 = R:255 G:245 B:215 0- Color2 = R:255 G:190 B:90 12- Color3 = R:210 G:90 B:25 22+ Color1 = R:255 G:255 B:245 0+ Color2 = R:255 G:245 B:200 12+ Color3 = R:255 G:220 B:150 22Color4 = R:0 G:0 B:0 30Color5 = R:0 G:0 B:0 0Color6 = R:0 G:0 B:0 0@@ -6573,9 +6573,9 @@ ParticleSystem ReforgedTankDeathSparkTailGravity = 0.00Lifetime = 13.00 14.00SystemLifetime = 33- Size = 1.40 1.70+ Size = 0.70 0.85StartSizeRate = 0.00 0.00- SizeRate = -0.10 -0.10+ SizeRate = -0.05 -0.05SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0@@ -6585,8 +6585,8 @@ ParticleSystem ReforgedTankDeathSparkTailAlpha6 = 0.00 0.00 0Alpha7 = 0.00 0.00 0Alpha8 = 0.00 0.00 0- Color1 = R:255 G:215 B:140 0- Color2 = R:230 G:120 B:40 5+ Color1 = R:255 G:250 B:235 0+ Color2 = R:255 G:235 B:180 6Color3 = R:0 G:0 B:0 13Color4 = R:0 G:0 B:0 0Color5 = R:0 G:0 B:0 0@@ -6702,9 +6702,9 @@ ParticleSystem ReforgedTankHitSparkTailGravity = 0.00Lifetime = 4.00 4.00SystemLifetime = 9- Size = 0.45 0.55+ Size = 0.25 0.30StartSizeRate = 0.00 0.00- SizeRate = -0.11 -0.11+ SizeRate = -0.06 -0.06SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cppindex c97639fb4..c75fc267c 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp@@ -109,7 +109,7 @@ struct TierShape { unsigned gx, gy, gz, slabs, first; };TierShape TierShapes[3] = { { 48, 48, 40, 24, 0 }, { 96, 96, 80, 2, 24 }, { 32, 32, 48, 12, 26 } };const unsigned MaxVolumes = 38; // all three tiers' slabs at High, the small tier's first, the fires' lastconst unsigned MaxSlabs = 24; // the constant arrays' length, the same in both tiers-const unsigned MaxPuffs = 28; // a tank's 24 (base, jets, stem, dark base masses); PUFFS in the HLSL is the same+const unsigned MaxPuffs = 28; // a tank's 28 (base, jets, stem, dark base masses and their rims); PUFFS in the HLSL is the sameconst unsigned MaxMovers = 16; // High's; Low takes the nearest 8const unsigned NoiseSide = 32;@@ -2317,11 +2317,13 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)// The dust channel carries the near-black soot masses at the base (below): it never glows (the// march lights fire by the soot's share of a cell alone), so laid beside the fire it stays a// dark mass in front of it, where soot laid there burned with the fire's heat and read as haze.- // So the tank's dust is dark brown-black; what dust the jets and the base band carry darkens- // with it. (Pale, 0.70/0.62/0.50, it was the sunlit skirt of passes 6-17.)+ // So the tank's dust is dark brown-black, and nothing else of it lays dust: one dust colour a+ // slab, and the jets' and the base band's dust darkened with it (pass 18) turned the fan's+ // cooled smoke and the band's ends dark on three sides of the fire from the play camera.+ // (Pale, 0.70/0.62/0.50, it was the sunlit skirt of passes 6-17.)dust[0] = 0.10f; dust[1] = 0.085f; dust[2] = 0.075f;// The base: orange flame and black soot bursting out low along the whole hull, rolling off- // both ends and a little to the sides, held down by the dust in it. The four towards the+ // both ends and a little to the sides. The four towards the// ends do not glow (heat 0.5, where fireColour starts), so the hot middle sits between dark// lobes, as in the photo; at 1.25 all along the base read as one bright band, and at 0.8 and// 0.62 the soot laid in them glowed (heat is the hottest emitter's) and read as haze.@@ -2332,7 +2334,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float across = (unit(810 + i) - 0.5f) * W * 0.7f;const float radius = (std::max)(W * 0.85f, 2.2f) * (0.8f + 0.4f * unit(820 + i));onHull(s * L * 1.15f, across, 0.6f + 0.6f * unit(830 + i), radius, s * (8.0f + 12.0f * unit(840 + i)) * fade,- (across < 0 ? -2.5f : 2.5f) * fade, 1.5f, 20.0f * fade, std::fabs(s) < 0.5f ? 1.25f : 0.5f, 8.0f * fade, 0.35f);+ (across < 0 ? -2.5f : 2.5f) * fade, 1.5f, 20.0f * fade, std::fabs(s) < 0.5f ? 1.25f : 0.5f, 0.0f, 0.35f);}}// The plume, the photo's tallest part: thirteen jets of white-hot fire and dust shot up out@@ -2351,7 +2353,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float reach = (std::min)((std::max)(2.2f * (2.3f * L + 1.7f * W), 12.0f), TierShapes[0].gz - 20.0f);// an odd count, so one jet stands straight up the middle: with fourteen the two middle ones// leaned apart and notched the top into a heart- const unsigned jets = 13; // with the base, the stem and the four dark base masses, 24 of the 28 a slab holds+ const unsigned jets = 13; // with the base, the stem and the four dark base masses and their rims, the 28 a slab holds// A shorter reach (Low's, or a very small hull's on High) fans a short hull's rays less and// from less of its length, so its fan is as tall for its width as High's: at High's angles// Low's came out a round dome. Long hulls do not use it.@@ -2431,8 +2433,8 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float along = a0 + ca * out, across = c0 + cc * out, da = ca * outSpeed / (std::max)(now, 1e-3f),dc = cc * outSpeed / (std::max)(now, 1e-3f);// Smoke and heat both go with the jet's speed, hottest low down; it cools once laid.- // Some dust, which the sun lights pale; the soot is what glows (a jet of twice as much dust- // burned dull tan), and with the dust it cools to grey-brown smoke rather than black. The+ // No dust: the tank's dust is the dark base masses' (above); the soot is what glows (a jet+ // with as much dust as soot burned dull tan), and it cools to dark smoke. The// fan of jets is what widens the plume; one jet widens only a little. Thin jets that// doubled their width as they climbed stood on a thin stem under a fat top, a mushroom.// Wider as it climbs, then over its last stretch the jet thins, lays less and cools, so@@ -2457,7 +2459,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)* (0.45f + 0.55f * taper) * (0.7f - 0.25f * shortHull + (0.3f + 0.25f * shortHull) * smoothstep01(path, 0.0f, 0.15f));onHull(along, across, H * 0.4f + dz * travelled, (2.0f + 0.06f * travelled) * (0.35f + 0.65f * taper)* (0.8f + 0.2f * shortHull + (0.5f - 0.2f * shortHull) * centre * centre),- da * now, dc * now, dz * now, rate, heat, rate * 0.4f, 0.08f * (1 - 0.75f * shortHull));+ da * now, dc * now, dz * now, rate, heat, 0.0f, 0.08f * (1 - 0.75f * shortHull));}// The stem: one wide hot puff climbing at 0.4 of the middle jet's pace,// so the column under the crown stays lit and the crown does not float off the hull.@@ -2470,7 +2472,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)// (on a short hull no wider than half its length and only orange-hot, or it lit the whole// base white and the dark soot beside it never showed)onHull(0, 0, H * 0.4f + climbed, (std::max)((std::max)(W * (1.2f - 0.4f * stemShort), L * 0.6f), 3.0f) * (1 + climbed / reach), 0, 0,- pace * reach / 0.18f * std::exp(-t / 0.18f), 25.0f * reach / 36.0f * fade, 2.8f - 1.2f * stemShort, 10.0f * reach / 36.0f * fade, 0.05f);+ pace * reach / 0.18f * std::exp(-t / 0.18f), 25.0f * reach / 36.0f * fade, 2.8f - 1.2f * stemShort, 0.0f, 0.05f);}// the default 1.6 once the flare is over; about a third of a second of white, as long as// the jets run, and no longer, so several tanks dying at once do not white out the view@@ -2484,18 +2486,29 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)// slowly, swelling by half, gone in about a second: heavy, they slump onto the ground, which// eats the dust lying on it (GroundDustHalfLife).// (at 70 a second over a hull and a half for 0.85 s they closed round the wreck into a black- // ring from the play camera and lay on as a dark disc)+ // ring from the play camera and lay on as a dark disc; four masses of 0.8 the hull's width+ // at 0.35 of its length either way met into one dark band from the side)+ // Each is a round blob with clear air between it and the next: its dust peaks in the middle+ // and falls off to its edge, and a ring of hot soot round it (a second puff a third wider+ // laying a little soot at heat 0.85) glows red-orange where the blob's own dust thins out,+ // while its black middle, all dust, does not light. With the base, jets and stem, the 28 a slab holds.if (t > 0.05f && t < 0.75f) {- const float fade = 1 - (t - 0.05f) / 0.7f, swell = 1 + 0.4f * (std::min)(t / 0.4f, 1.0f);+ const float fade = 1 - (t - 0.05f) / 0.7f, swell = 1 + 0.3f * (std::min)(t / 0.4f, 1.0f);+ const float size = (std::min)((std::max)(W * 0.6f, 2.0f), 0.35f * L);for (unsigned k = 0; k < 4; ++k) {- const float s = (k < 2 ? -0.35f : 0.35f) * (0.85f + 0.3f * unit(980 + k)), side = (k & 1) ? 1.0f : -1.0f;+ const float s = (k < 2 ? -0.5f : 0.5f) * (0.9f + 0.2f * unit(980 + k)), side = (k & 1) ? 1.0f : -1.0f;const float wander = 6.2831853f * unit(988 + k) + t * (2.0f + 1.5f * unit(992 + k));// (at 0.4 and at 0.75 to 0.95 of the hull's height they lay black on the black hull's side// and did not show from the side: the photo's stand against the flame, so these stand at// the hull's top, in front of the fan's foot)- onHull(s * L, side * W * (1.0f + 0.1f * unit(984 + k)), H * (1.0f + 0.2f * unit(986 + k)) + 0.3f * std::sin(wander),- (std::max)(W * 0.8f, 2.4f) * swell * (0.85f + 0.3f * unit(996 + k)),- s * 2.0f * fade + 1.5f * std::cos(wander), side * 2.0f * fade, 0.8f, 0, 0.3f, 45.0f * fade * fade, 0.3f);+ // (out past the flank, at 1.25 of the half width: at the hull's edge the jets' roots drew+ // them up into the fan and they never showed as blobs)+ const float along = s * L, across = side * W * (1.25f + 0.1f * unit(984 + k));+ const float up = H * (0.9f + 0.2f * unit(986 + k)) + 0.3f * std::sin(wander);+ const float radius = size * swell * (0.9f + 0.2f * unit(996 + k));+ const float va = s * 1.5f * fade + 1.0f * std::cos(wander), vc = side * 1.5f * fade;+ onHull(along, across, up, radius, va, vc, 0.8f, 0, 0, 55.0f * fade * fade, 0.3f);+ onHull(along, across, up, radius * 1.35f, va, vc, 0.8f, 6.0f * fade, 0.85f, 0, 0.1f);}}// the cook-off pops, two to four, each a hot orange puff out of a hatch somewhere on the hull@@ -2506,7 +2519,7 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float age = t - when;if (age >= 0 && age < 0.15f)onHull((unit(910 + p) - 0.5f) * L * 1.4f, (unit(920 + p) - 0.5f) * W * 0.8f, H * 0.6f, 2.4f, 0, 0, 12.0f,- 12.0f, 1.7f, 2.0f, 0.3f);+ 12.0f, 1.7f, 0.0f, 0.3f);}// The hull burning: a black column off its whole length for about a second and a half, which// with the soot thinning (TankSootHalfLife) is gone about 2 s after the death, a quarter as