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 smoke halved, long spark streaks
Olcay Seygan49becf9c8c76
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 75ac05642..9245673a7 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 over a skirt of pale dust. 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 soot banks up low along the hull, licked red by the fire under it, and swells for nearly two seconds after the flash, while hot sparks streak up out of the fire and fall back. The wreck's black column is gone about eight seconds after the death, as quickly as the game's own smoke with the setting Off, and a thin wisp over a glowing ember goes on to about twelve; 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 a gun's muzzle smoke is the soft grey puff it always was, 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 over a skirt of pale dust. 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 soot banks up low along the hull, licked red by the fire under it, and swells for nearly a second after the flash, while hot sparks streak up out of the fire in long thin lines and fall back. The wreck's black column is gone about four seconds after the death, and a thin wisp over a glowing ember fades out by seven, half 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 a gun's muzzle smoke is the soft grey puff it always was, where it had turned into a flat tan disc on the ground.- 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.- Missile and rocket trails are thin ribbons of real smoke. A Tomahawk's, a Rocket Buggy's and a Scud Launcher's lay a pale line that breaks into puffs, widens towards its old end, stirs and drifts off with the wind, and is gone about as soon as the game's own trail would be, so a Rocket Buggy salvo no longer leaves a tan haze over the field: a Tomahawk's arc over Heartland Shield is gone about 3.5 s after the launch, where it hung on for 5 to 6 and the game's own lasts about 3. A trail that climbs high, a Scud's arc or the nine columns a Scud Storm puts up, goes into a second, taller body of air over the battlefield, a thousand units high, where it thins just as fast. The trails are lit by the sun like any smoke: the Scud Storm's columns had stood as straight glowing pillars of one width, and at night on Dark Night the trails stood out pale blue as if lit from inside. Before, a fast missile's trail broke into a dotted line of brown blobs, and once a missile climbed past about 200 units over the ground the top of its trail simply vanished.diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.iniindex ccf87003f..c82c60e2f 100644--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini@@ -6550,13 +6550,19 @@ ParticleSystem ReforgedTankDeathSparksWindPingPongEndAngleMax = 6.283185End-; The tail one spark drags: a point every frame where the spark is, left standing and fading in a-; sixth of a second, shrinking, so a spark reads as a short streak behind its head: the points start-; about as wide as a spark moves in a frame (at 2.6 to 3.6 they read as a line of beads). It dies with+; The tail one spark drags: a point every frame where the spark is, left standing and fading over+; 0.4 s while it shrinks to nothing, so a spark reads as a thin straight streak, widest at its head+; and tapering behind it. The points start wider than a spark moves in a frame (6 to 13 units), so+; near the head they overlap into a line (at 2.6 to 3.6, and at 4.2 to 5.2 over this life, they read+; as a line of beads); a life of 4 or 5 frames left a short comet where the footage has long+; streaks. A point a frame is the finest the per-particle system gives, so the far end still beads+; a little where the points have shrunk. It dies with; its spark (a per-particle system ends with the particle that carries it), and its own life of 33-; frames, past the spark's 32, ends one a saved game restored without its spark.+; frames, past the spark's 32, ends one a saved game restored without its spark. Its points rank as+; debris trails, so at the particle cap the tails give way before other effects do (about 300 points+; a tank).ParticleSystem ReforgedTankDeathSparkTail- Priority = UNIT_DAMAGE_FX+ Priority = DEBRIS_TRAILIsOneShot = NoShader = ADDITIVEType = PARTICLE@@ -6566,11 +6572,11 @@ ParticleSystem ReforgedTankDeathSparkTailAngularDamping = 0.00 0.00VelocityDamping = 1.00 1.00Gravity = 0.00- Lifetime = 4.00 5.00+ Lifetime = 11.00 13.00SystemLifetime = 33- Size = 6.00 8.00+ Size = 7.00 8.00StartSizeRate = 0.00 0.00- SizeRate = -1.40 -1.10+ SizeRate = -0.53 -0.50SizeRateDamping = 1.00 1.00Alpha1 = 0.00 0.00 0Alpha2 = 0.00 0.00 0@@ -6580,9 +6586,9 @@ ParticleSystem ReforgedTankDeathSparkTailAlpha6 = 0.00 0.00 0Alpha7 = 0.00 0.00 0Alpha8 = 0.00 0.00 0- Color1 = R:255 G:200 B:110 0- Color2 = R:200 G:90 B:25 3- Color3 = R:0 G:0 B:0 5+ Color1 = R:255 G:215 B:140 0+ Color2 = R:230 G:120 B:40 5+ Color3 = R:0 G:0 B:0 13Color4 = R:0 G:0 B:0 0Color5 = R:0 G:0 B:0 0Color6 = R:0 G:0 B:0 0diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cppindex 81cf0a22f..00edceade 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp@@ -128,11 +128,12 @@ const float HeatHalfLife = 1.8f;const float DustHalfLife = 6.0f;const float CapSpillHalfLife = 1.0f; // a nuclear cap's soot once the flow has carried it out of the capconst float StructureSootHalfLife = 3.0f; // a building's blast's soot: at 7 a fall's smoke was on screen for 14 s, stock's for 7 to 10-// A tank's soot from 5 s on, once its column is falling: its black column is gone from the play-// camera about 8 s after the death, as the game's billboard column (ReforgedTankSmoke, 1.5 s of-// puffs living 5 to 6 s) is, and only a thin smoulder is left to 13 s (the volume lives 15). It used-// to hang for half a minute; thinned from 3 s at 1.2 it was gone in 4, sooner than the game's own.-const float TankSootThinFrom = 5.0f, TankSootHalfLife = 1.5f;+// A tank's soot from 2.5 s on, once its column is falling: its black column is gone from the play+// camera about 4 s after the death and a thin smoulder fades out by 7 s (the volume lives 8.5, so its+// own 3 s end fade starts as the smoulder's ends and does not dim it twice). The+// owner halved it (2026-10-29) from 8 and 14 s, which had matched the game's billboard column+// (ReforgedTankSmoke, 1.5 s of puffs living 5 to 6 s); before that it hung for half a minute.+const float TankSootThinFrom = 2.5f, TankSootHalfLife = 0.75f;const float ShadeLight = 0.26f; // the light smoke keeps where the sun does not reach itconst float SunShare = 0.75f; // and what the sun adds where it doesconst float Extinction = 0.16f; // per world unit at density 1@@ -1587,9 +1588,9 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)dust[0] = 0.70f; dust[1] = 0.62f; dust[2] = 0.50f; // sunlit, fire-lit dust, warm against the tan ground// 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- // ends burn only a dull red (heat 0.62), 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 the soot laid- // in them glowed orange (heat is the hottest emitter's) instead of reading dark.+ // 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.if (t < 0.7f) {const float fade = 1 - t / 0.7f;for (unsigned i = 0; i < 6; ++i) {@@ -1597,7 +1598,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.62f, 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, 8.0f * fade, 0.35f);}}// The plume, the photo's tallest part: thirteen jets of white-hot fire and dust shot up out@@ -1743,18 +1744,20 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)// Dark soot banked on the hull: four big lobes lying low along its length, two over each// half from the jets' roots out past the end, which the base fire edges red, so the bright// core stands between near-black masses as in the photo and the fan's top stays clear of- // them. They swell for nearly two seconds, well after the flash, and the column takes over. Heat+ // them. They swell for nearly a second, past the flash, and the column takes over. Heat// 0.3 does not glow at all (fireColour starts at 0.5). Heat is the hottest emitter's, so laid// inside the jets' roots the soot burned as bright as they did; laid round the hull's sides// as well (pass 12) the lobes closed into a dark ring round the fire from the play camera;- // small and gone in half a second (pass 13) they hid behind the fire from the side.- // 22 a second at most and half as wide again by 1.2 s: at 45 and nearly twice as wide they+ // small and gone in half a second (pass 13) they hid behind the fire from the side. Laid at+ // 0.75 to 1 of the hull's height, over the base band's glow, with no dust in them (dust is lit+ // pale): lower and dusty they glowed inside the band and read as haze from the side.+ // 22 a second at most and half as wide again by 0.6 s: at 45 and nearly twice as wide they// rolled into one black ball over the wreck from the play camera. Each lobe wanders round// its place and pushes the air it lays into a slow roll, at half that rate over a third more// width: laid still and thick it saturated into a black cut-out with a hard edge, where thinner// smoke keeps the march's billows inside it and a soft rim.- if (t < 1.8f) {- const float fade = 1 - t / 1.8f, swell = 1 + 0.7f * (std::min)(t / 1.2f, 1.0f);+ if (t < 0.95f) {+ const float fade = 1 - t / 0.95f, swell = 1 + 0.7f * (std::min)(t / 0.6f, 1.0f);for (unsigned k = 0; k < 4; ++k) {// the inner pair waits for the jets to stop: laid in their roots it burned at their heatif (!(k & 1) && t < 0.35f) continue;@@ -1762,15 +1765,16 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)const float s = (k < 2 ? -1.0f : 1.0f) * ((k & 1) ? 1.05f : 0.7f) * (0.95f + 0.1f * unit(980 + k))+ 0.12f * std::sin(wander);const float across = ((k & 1) ? 0.3f : -0.3f) * W + 0.25f * W * std::cos(wander * 1.3f);- onHull(s * L, across, H * (0.4f + 0.2f * unit(984 + k)) + 0.6f * std::sin(wander * 0.7f),+ onHull(s * L, across, H * (0.75f + 0.25f * unit(984 + k)) + 0.6f * std::sin(wander * 0.7f),(std::max)(W * 0.9f, 2.6f) * 1.3f * swell * (0.85f + 0.3f * unit(996 + k)),s * 2.5f * fade + 3.0f * std::cos(wander), across * 0.3f * fade + 3.0f * std::sin(wander), 1.5f,- 11.0f * fade * fade, 0.3f, 2.0f * fade, 0.35f);+ 11.0f * fade * fade, 0.3f, 0.0f, 0.35f);}}- // Pale dust lifted along the ground on both sides of the hull, pushed out low, no ring.- if (t < 0.9f) {- const float fade = 1 - t / 0.9f;+ // Pale dust lifted along the ground on both sides of the hull, pushed out low, no ring. From+ // a third of a second, once the soot lobes stand: lifted at once it veiled them from the side.+ if (t > 0.3f && t < 1.2f) {+ const float fade = 1 - (t - 0.3f) / 0.9f;for (unsigned k = 0; k < 4; ++k) {const float s = k < 2 ? -0.7f : 0.7f, side = (k & 1) ? 1.0f : -1.0f;onHull(s * L * (1.0f + 0.4f * unit(960 + k)), side * W * 1.1f, 0.5f, (std::max)(W * 0.9f, 2.5f),@@ -1779,29 +1783,31 @@ void schedule(const Volume &volume, unsigned slab, float t, DrawConstants *draw)}// the cook-off pops, two to four, each a hot orange puff out of a hatch somewhere on the hullconst unsigned pops = 2 + unsigned(unit(900) * 2.99f);- float when = 0.9f;+ float when = 0.45f; // all of them inside the first 3.5 s, as the columnfor (unsigned p = 0; p < pops; ++p) {- when += 0.5f + 1.0f * unit(901 + p);+ when += 0.25f + 0.5f * unit(901 + p);const float age = t - when;if (age >= 0 && age < 0.2f)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);}- // The hull burning: a black column off its whole length for about seven seconds, which with- // the soot thinning (TankSootHalfLife) is gone about as soon as- // the game's own billboard column (ReforgedTankSmoke). At half a minute it outlived the wreck.- if (t > 0.8f && t < 7.0f) {- const float rise = (std::min)((t - 0.8f) / 1.5f, 1.0f), fall = t > 4.0f ? 1 - (t - 4.0f) / 3.0f : 1.0f;+ // The hull burning: a black column off its whole length for about three seconds, which with+ // the soot thinning (TankSootHalfLife) is gone about 4 s after the death, half as long as the+ // game's own billboard column (ReforgedTankSmoke), as the owner asked for a fast game. At half+ // a minute it outlived the wreck.+ if (t > 0.5f && t < 3.5f) {+ const float rise = (std::min)((t - 0.5f) / 0.75f, 1.0f), fall = t > 2.0f ? 1 - (t - 2.0f) / 1.5f : 1.0f;for (int end = -1; end <= 1; end += 2)onHull(end * L * 0.45f, 0, 0.5f, (std::max)(W * 0.9f, 2.2f), 0, 0, 12.0f, 2.7f * rise * fall, 1.0f, 0.05f, 0.25f);}// Then the wreck smoulders: a thin grey wisp off one end and a glowing ember in the hull,- // flickering, to about 13.5 s, as faint as the game's own smoke with the setting Off is then.- // Cut at 7 s the column left a dead wreck straight after a big blast.- if (t > 6.0f && t < 13.5f) {- const float in = (std::min)((t - 6.0f) / 1.0f, 1.0f), out = t > 11.5f ? 1 - (t - 11.5f) / 2.0f : 1.0f;- // (at a tenth and a third of these the soot thinning took the wisp before it showed)- onHull(L * 0.35f, 0, 0.6f, (std::max)(W * 0.6f, 2.0f), 0, 0, 6.0f, 3.2f * in * out, 0.9f, 0.15f, 0.2f);+ // flickering, from 3 s, fading out over its last two seconds to nothing at 7 s. With nothing+ // after the column the wreck went dead straight after a big blast.+ if (t > 3.0f && t < 7.0f) {+ const float in = (std::min)((t - 3.0f) / 0.5f, 1.0f), out = t > 5.0f ? 1 - (t - 5.0f) / 2.0f : 1.0f;+ // (at a tenth and a third of these the soot thinning took the wisp before it showed; twice+ // the pass-16 rate, since the thinning's half-life was halved with everything else)+ onHull(L * 0.35f, 0, 0.6f, (std::max)(W * 0.6f, 2.0f), 0, 0, 6.0f, 6.4f * in * out, 0.9f, 0.15f, 0.2f);const float flicker = 0.5f + 0.5f * std::sin(t * 11.0f + 6.2831853f * unit(970)) * std::sin(t * 4.3f);// the flicker in its size: heat holds the hottest it has seen for a while, so a flicker in// heat read as a slow sag, and at 1.95 the ember burned as hot as a cook-off pop@@ -2895,18 +2901,18 @@ bool screenRect(const float boxLow[3], const float boxHigh[3], const float viewP// How long each kind lives, in seconds, how big its cell is, how far and how long after its blast// another system of the same FX joins it, and which of those it takes.-float lifeOf(Kind kind) { return kind == TankDeath ? 15.0f : kind == Structure ? 12.0f : kind == Nuclear ? 90.0f : 12.0f; }+float lifeOf(Kind kind) { return kind == TankDeath ? 8.5f : kind == Structure ? 12.0f : kind == Nuclear ? 90.0f : 12.0f; }float cellOf(Kind kind, float scale) { return kind == TankDeath ? 3.0f : kind == Nuclear ? 10.0f : 2.0f * scale; }float joinRadius(const Volume &volume){if (volume.kind == Structure) return (std::max)(volume.hull[2], volume.hull[3]) * volume.cell + 40.0f;return volume.kind == Nuclear ? 500.0f : volume.kind == TankDeath ? 60.0f : 30.0f * volume.scale;}-// A tank's volume past 7 s holds only its smoulder, so it gives its slab up before any new blast does.+// A tank's volume past 3.5 s holds only its smoulder, so it gives its slab up before any new blast does.int rankOf(const Volume &volume){if (volume.kind == TankDeath && volume.live && TheGameLogic- && (int)TheGameLogic->getFrame() - volume.born > 7 * LOGICFRAMES_PER_SECOND)+ && 2 * ((int)TheGameLogic->getFrame() - volume.born) > 7 * LOGICFRAMES_PER_SECOND)return -1;return volume.kind == TankDeath || volume.kind == Structure ? 2 : volume.scale >= 2.0f ? 1 : 0;}