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(w3ddevice): -volsmoke aircraft and helicopter wakes at any height
Olcay Seygan90c2ea425b57
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ec6a69cd..453632384 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -116,6 +116,7 @@ found and fixed, EA's own, not port damage.**- 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 wave runs out through every smoke it reaches, the other blasts' clouds, the burning buildings' flames and the smoke hanging in the air, and moves it while it passes: a Scud Launcher's missile lands in the last one's smoke and shoves it aside, and a second nuke's wave tears into the first one's mushroom, which lets go of its cauliflower shape and is shoved aside and upward as a soft tan cloud, still plain to see eleven seconds after the second hit, and thins away until it is gone 18 seconds after it was let go; it used to hang on untouched for over a minute. On Low the second nuke takes the first one's place in the air, so there the first cloud goes the moment the second lands. Before, a wave's push was mostly lost in the first frame, a nuke's cap pulled itself straight back into shape, and a Scud's warheads pushed nothing at all. Units you cannot see push nothing, and a blast in the shroud sends no wave, so the smoke never gives away a stealthed tank, an unscouted base or a strike out of sight.+- Aircraft thin the smoke they fly through, at any height. A jet drags clean air along the last two and a half seconds of its path, through a nuke's stem or a burning column; its wake used to fade out as it climbed, and at its usual 100 units over the ground it was down to about half. A helicopter's downwash now reaches down from wherever it flies and thins what it blows through: a Helix crossing a nuke's stem leaves it visibly thinner, and one over a Scud Storm's cloud shoves it down and out along the ground. A helicopter more than about ten rotor radii up used to do nothing at all.- 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 fades out along its length as it goes, the oldest end first, so a Rocket Buggy salvo no longer leaves a tan haze over the field: a Tomahawk's arc over Heartland Shield is gone about 2 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 that read as beams of light, and at night on Dark Night the trails stood out pale blue as if lit from inside. Now a big missile, a Scud's, a Tomahawk's or the nuclear missile's, leaves a white plume that billows out wider as it ages, lumpy and shaded on its far side, while a Rocket Buggy's, a Stinger's or a Comanche's rocket leaves a thin grey trail. The infantry rockets follow the RPG-7 photo: a Tunnel Defender's, a Tank Hunter's or a Missile Defender's rocket carries a small bright flame right at its tail and draws a thin grey wisp straight along its path, where the game's own trail was a bright white rope with a regular wiggle (the rocket flies within a unit of a straight line; the game threw each point of its line sideways) and its glow burned as two orange dots a rocket's length behind it. The launcher puffs a white backblast behind the soldier instead of a yellow-white flash as big as he is. Every one burns at the nozzle, a short white-yellow flame that is gone a few frames behind the missile. A launch throws a cloud: a Scud Storm, a Scud Launcher, a Tomahawk launcher and the nuclear silo blow a white cloud out sideways over the pad and the ground round it, under a flash at the nozzle, and it is gone in about four seconds. A rocket's backblast leaves a white puff at the launcher, where before it was gone before it showed. 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.- Buildings come down in their own shape. The smoke reads the building's model: the moment one dies, a white-yellow fireball bursts out of each of its parts, a War Factory's hall and its two stacks, a Speaker Tower's mast, bigger than the part it came from and pushed out through its walls, cools to orange under a sooty edge and is gone in well under a second, while a ragged plume climbs out of the tops and cools to smoke. Before, the parts filled with dull dust that slumped and only three small fires came off the roof. The chunks the building throws trail thin pale dust as they fly, gone before the column is, where they used to fly bare, and the white shower of shards that burst over the fall like a firework is gone while the smoke draws it; with the smoke Off both stay as they were. The collapse throws a pale dust cloud that rolls out along the ground on every side, heavier than the air and hugging the terrain, two to three times the building's width out before it thins, and runs round the buildings beside it, between their real walls and stacks rather than over one box. Before, the dust had nowhere to go but up, and a fall was only a column. The ruin burns under a thick black-grey column with the fire still glowing in its foot, where it used to be a thin pale wisp, for two seconds, so a fall's own smoke and dust are off the screen 3 to 4 s after it and only the game's own column is left in the air until about 6, sooner than the game's own at 7 to 8 (it stayed for fourteen at first, and in a fast game that hid the next fight); a damaged building's own smoke and the dust round it thin within a couple of seconds of their puffs. The size follows the building: an American Power Plant's is about half the width of a War Factory's or a Particle Cannon's. Each damaged stage on the way down blows fire out of the top of the standing building with a little smoke, where it used to leave a big black cloud over the roof, and the shells landing on it in that moment no longer leave their fireballs floating over the cloud. A Rocket Buggy's rockets hitting the rubble throw their dirt for a second and it falls back, where their brown fountains stood beside a fallen War Factory as tan fingers for six seconds after everything else had gone. The fall's smoke is lit on its sunny side: on Winter Wolf's snow it had stood as one block of pure black across the middle of the screen. The game's own fireball sprites, flare and flat shock ring for that moment are gone while the smoke is on; flying debris keeps its sparks.- Burning buildings burn. A damaged building's fires are flames in that same air now, where they were flat sprites: each burning spot gives off fuel off the building's own roof and wall tops, read from its model, at the heat the game's own flame there stands for, so the flames stand on the building instead of hanging over it; the fuel comes off in patches and lights, burns hottest on its outside where the air reaches it, rises on its own heat and leans with the wind. The flame glows the colour hot soot glows, yellow-white at its foot where it burns hottest and orange to dull red higher up, where it breaks into licks with clear air between them, and it puffs the way a real fire puffs, a wide one slower than a small one. The fuel a flame carries past its tips is too cool to burn by then and turns into near-black smoke, which climbs off the building and thins away in about three seconds; while it does, the game's own smoke on that building stands aside. The building's own floors and roofs are what the flames stand on, so a GLA barracks, whose outline is one big box over its tents, no longer smothers all but one of its fires. Units push it like any smoke: a helicopter hovering over a burning factory fans its flames down and out. It goes out within two seconds of the game's own fire, so a repaired building stops burning and a fire never outlasts the building's damage. Fires on the move, a burning tank driving off or a running soldier, keep the game's own flames, and so do sparks, embers and a burning car wreck, whose flame the first version had put out altogether. Eight burning buildings on Twilight Flame's plateau cost 0.4 ms of GPU time a frame on Low and 1.0 on High over the smoke alone, on an RTX 2060.diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cppindex 39a99995c..f9892fce0 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/DX11VolumeSmoke.cpp@@ -185,6 +185,12 @@ const unsigned MuzzleCap[3] = { 0, 3, 6 };// LoosenedSpillHalfLife, the 4 s it had before the released cloud was slowed: a cap that stays// loosened keeps that spill for the rest of its 90 s.const float NukeDisperseHalfLife = 10.0f, NukeDisperseLife = 18.0f, LoosenedSpillHalfLife = 4.0f;+// A rotor's column under its disc, units/s down (MoverPass), the same at any height; the sheet along+// the ground and the dust ring take it as close as the ground is. Air particles in a jet's or a+// rotor's wake move at this share of its speed there (nudge).+const float RotorWash = 45.0f, WakeNudge = 0.5f;+// How much of a jet's path its wake lasts over, seconds (MoverPass's JET_WAKE).+const float JetWake = 2.5f;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@@ -489,7 +495,48 @@ const char *const MoverPass = R"HLSL(#define JET 1#define ROTOR 2#define WALKER 3+// what a second of a wake's clean air mixes away where it is thickest: a jet's tube keeps under a+// tenth of the smoke it passes, so the lane it cuts reads from the game's camera (at 1.0 over 1.5 s+// it kept half, and a stem's rising dust closed that as a slight pinch)+#define JET_MIX 2.0+#define ROTOR_MIX 0.8+// A jet's wake lasts over this much of its path, seconds (JetWake in the C++). Every jet in the game+// flies under a risen nuclear cap, at 100 units over the ground against its underside's 165 to 200, so+// this cuts the stem and a low cap. A wake drawn 8 times as far up to reach the cap cut no lane either.+#define JET_WAKE 2.5float3 pullTowards(float3 v, float3 target, float k) { return lerp(v, target, saturate(k)); }+// How much of mover i's wake is clean air at this point, 0 to 1: a jet's tube over the last JET_WAKE s+// of its path, widening as it ages (its vortex pair spreads) and fading out, or a rotor's column under+// its disc. Never thinner than 1.5 cells.+float wakeCore(uint i, float3 world, float size)+{+ float4 a = Movers[i * 4], b = Movers[i * 4 + 1];+ uint kind = (uint)(b.w + 0.5);+ if (kind == JET) {+ float3 path = b.xyz * JET_WAKE;+ float along = dot(a.xyz - world, path) / max(dot(path, path), 1e-3);+ if (along < 0 || along > 1) return 0;+ float3 r = world - (a.xyz - path * along);+ float tube = max(a.w, 1.5 * size) * (1 + 2 * along);+ return exp(-dot(r, r) / (tube * tube)) * (1 - along);+ }+ if (kind == ROTOR) {+ float below = a.z - world.z;+ float columnR = max(a.w * 1.2 + max(below, 0) * 0.15, 1.5 * size);+ float rho = length(world.xy - a.xy);+ if (below < -a.w * 0.5 || rho >= columnR) return 0;+ return (1 - rho / columnR) * (below < 0 ? 0.3 : 1);+ }+ return 0;+}+// the most of any wake's clean air at this point (MushroomPass: a nuclear cap lays no soot there)+float wakeHole(float3 world, float size)+{+ float hole = 0;+ uint count = (uint)MoverCount.x;+ for (uint i = 0; i < count; ++i) hole = max(hole, wakeCore(i, world, size));+ return hole;+}void applyMovers(inout float4 vt, inout DEN d, float3 cell, uint slab, float dt){uint count = (uint)MoverCount.x;@@ -517,44 +564,59 @@ void applyMovers(inout float4 vt, inout DEN d, float3 cell, uint slab, float dt)}} else if (kind == JET) {// A body of air dragged along its last 0.3 s, two counter-rotating vortices off the wing- // tips over its last 1.5 s with the downwash between them, all fading with its height.- float3 path = b.xyz * 1.5; // from the nose back over 1.5 s+ // tips over its last JET_WAKE s with the downwash between them, and the clean air it drags+ // in mixing the smoke thin along its path. All at any height, a nuclear cap's included:+ // only the downwash's reach to the ground fades as it flies higher. In cells coarser+ // than its wings the pair is laid 1.5 cells apart with the same circulation, wider and+ // weaker, where at the real span it fell between the cells' middles.+ float3 path = b.xyz * JET_WAKE; // from the nose backfloat along = dot(-off, path) / max(dot(path, path), 1e-3);if (along < -0.05 || along > 1.05) continue;+ d *= exp(-JET_MIX * wakeCore(i, world, size) * dt);float s = saturate(along);float3 r = world - (a.xyz - path * s);- float span = a.w;+ float span = a.w, wide = max(span, 1.5 * size);float2 side = normalize(float2(-path.y, path.x) + float2(1e-4, 0));float lateral = dot(r.xy, side);- if (abs(lateral) > span * 3 || r.z > span * 3) continue;- float fade = exp(-e.z / 150) * (1 - s);- if (s < 0.2 && dot(r, r) < span * span) vt.xyz = pullTowards(vt.xyz, v * 0.5, 0.4 * fade);+ if (abs(lateral) > wide * 3 || r.z > wide * 3) continue;+ float fade = 1 - s;+ // the body held to 20 cells/s: half a jet's speed in 2-unit cells is 50, which the+ // backtrace smears into a streak+ float3 body = v * 0.5;+ body *= min(1, 20 / max(length(body), 1e-3));+ if (s < 0.3 / JET_WAKE && dot(r, r) < wide * wide) vt.xyz = pullTowards(vt.xyz, body, 0.4 * fade);float strength = length(b.xyz) * 0.12 / size * f.y;for (int tip = -1; tip <= 1; tip += 2) {- float2 rr = float2(lateral - tip * span, r.z);- float rho = max(length(rr), span * 0.25);- float swirl = strength * span * 0.5 / rho * exp(-rho * rho / (span * span * 2.5));+ float2 rr = float2(lateral - tip * wide, r.z);+ float rho = max(length(rr), wide * 0.25);+ float swirl = strength * span * 0.5 / rho * exp(-rho * rho / (wide * wide * 2.5));float2 t = float2(-rr.y, rr.x) / rho * tip;vt.xyz = pullTowards(vt.xyz, vt.xyz + (float3(side * t.x, t.y) * swirl), 0.5 * fade);}// the sheet pushed down between the tips, reaching the ground under a low pass- if (abs(lateral) < span && r.z < 0)- vt.z = lerp(vt.z, -strength * 0.6, saturate(0.4 * fade * exp(r.z / 90)));+ if (abs(lateral) < wide && r.z < 0)+ vt.z = lerp(vt.z, -strength * 0.6, saturate(0.4 * fade * exp(-e.z / 150) * exp(r.z / 90)));} else if (kind == ROTOR) {- // A rotor's downwash: a column 1.2 radii wide under the disc, as strong as the ground is- // close; at the ground it turns into a thin sheet running outwards and lifts a ring of- // dust about two radii out.- float R = a.w, height = e.z, close = f.y;+ // A rotor's downwash at any height: a column under the disc, 1.2 radii wide and spreading+ // as it falls, its speed (f.x, units/s) falling as it widens since the momentum it carries+ // down is kept, thinning the smoke it carries with the clean air drawn through the disc.+ // As close as the ground is (f.y) it turns there into a thin sheet running outwards and+ // lifts a ring of dust about two radii out.+ float R = a.w, close = f.y;float2 flat = off.xy;float rho = length(flat);float below = a.z - world.z;if (rho > R * 5 || below < -R) continue;- float wash = 45.0 / size * close;- float columnR = R * 1.2 + max(below, 0) * 0.15;+ float columnR = max(R * 1.2 + max(below, 0) * 0.15, 1.5 * size);if (below > -R * 0.5 && rho < columnR && overGround > size * 1.5) {float k = (1 - rho / columnR) * (below < 0 ? 0.3 : 1);- vt.xyz = pullTowards(vt.xyz, float3(vt.xy * 0.5, -wash), 0.6 * k);+ float narrow = R * 1.2 / columnR;+ vt.xyz = pullTowards(vt.xyz, float3(vt.xy * 0.5, -f.x / size * narrow * narrow), 0.6 * k);}+ d *= exp(-ROTOR_MIX * wakeCore(i, world, size) * dt);+ float wash = f.x / size * close;+ // (none from one too high to reach the ground: both would still hold the air there still)+ if (close <= 0) continue;float sheet = 1 - smoothstep(size, size * 3 + 8, overGround);if (sheet > 0 && rho > R * 0.3) {float2 outwards = flat / rho * wash * min(1.6, R * 1.2 / rho);@@ -804,12 +866,17 @@ const char *const MushroomPass = R"HLSL(float overGround = cell.z - groundAt((int2)cell.xy, slab);float stemR = stem.y * (1 + 0.8 * exp(-overGround / 2)) * (0.8 + 0.4 * lumps);float inStem = (1 - smoothstep(0.6, 1.0, rho / stemR)) * (1 - smoothstep(stem.z - 2, stem.z + 1, cell.z));- float rate = saturate(stem.w * dt);// no soot laid on the ground itself: the skirt carried the fireball's foot out over the// terrain as a brown washfloat soot = cap.x * inCap * smoothstep(0.5, 2.5, overGround), dust = stem.x * inStem;- if (soot > d.x) d.x += (soot - d.x) * rate;- if (dust > d.y) d.y += (dust - d.y) * rate;+ // A jet's tube and a rotor's column are clean air the shape is not laid into again while the+ // wake lasts: laid back at Stem.w, the tunnel a jet cut through the cap closed on the next step.+ // Only asked where the shape has something to lay: most of the slab is outside it or full.+ if (soot > d.x || dust > d.y) {+ float rate = saturate(stem.w * dt) * saturate(1 - 3 * wakeHole(Origins[slab].xyz + (cell + 0.5) * volume.z, volume.z));+ if (soot > d.x) d.x += (soot - d.x) * rate;+ if (dust > d.y) d.y += (dust - d.y) * rate;+ }d.x *= lerp(Spill[slab].x, 1, saturate((1.3 - surface) * 3));d.y *= lerp(Spill[slab].x, 1, saturate(inStem * 3));// white-yellow in the middle, orange-red at the rim, the lumps hotter than the folds between@@ -3466,9 +3533,13 @@ float shockMask(const float low[3], const float high[3], float cell, int slot)return (float)mask;}-// An air particle inside a front this step moves with it, so the cells the air lays under it-// (AirTakeUp) follow the push instead of pulling the smoke back where it was. A client particle:-// nothing in the logic reads where one is. At most three quarters of an air cell a step.+// An air particle inside a front or a wake this step moves with it, so the cells the air lays under+// it (AirTakeUp) follow the push instead of pulling the smoke back where it was: out along a front's+// radius; down a rotor's column and out along the ground under it, and off a jet's path and down with+// its vortex pair, at WakeNudge of the wake's speed there (stand-ins for MoverPass's fields, not+// copies). A client particle: nothing in the logic reads where one is. At most three quarters of an+// air cell a step.+std::vector<const Mover *> wakers; // the jets and rotors among the movers this step (stepAir)void nudge(Particle *p, float dt, float cell){Coord3D &at = p->m_pos;@@ -3483,6 +3554,51 @@ void nudge(Particle *p, float dt, float cell)const float move = front.speed * VolumeShock::profile(r, front.radius, front.width) * dt / (std::max)(r, 1.0f);for (unsigned k = 0; k < 3; ++k) shift[k] += d[k] * move;}+ for (const Mover *mover : wakers) {+ const float (&m)[4][4] = mover->m;+ if (int(m[1][3] + 0.5f) == MoverRotor) {+ const float R = m[0][3], below = m[0][2] - at.z;+ const float dx = at.x - m[0][0], dy = at.y - m[0][1], rho2 = dx * dx + dy * dy;+ if (below <= 0 || rho2 >= 25.0f * R * R) continue;+ const float rho = std::sqrt(rho2), columnR = (std::max)(R * 1.2f + below * 0.15f, 1.5f * cell);+ if (rho < columnR) {+ const float narrow = R * 1.2f / columnR;+ shift[2] -= WakeNudge * m[3][0] * narrow * narrow * (1 - rho / columnR) * dt;+ }+ // as close as the ground is, the column turns there into a sheet running outwards, out to+ // five radii. Without it smoke under a hover only sank to the floor below and stayed: the+ // particles the air lays its cells under never left the column.+ if (m[3][1] > 0 && rho > R * 0.3f) {+ const float over = at.z - TheTerrainRenderObject->getHeightMapHeight(at.x, at.y, NULL);+ const float sheet = 1 - smoothstep01(over, cell, cell * 3 + 8), reach = 1 - smoothstep01(rho, R * 3, R * 5);+ const float out = WakeNudge * m[3][0] * m[3][1] * (std::min)(1.6f, R * 1.2f / rho) * sheet * reach * dt / rho;+ shift[0] += dx * out;+ shift[1] += dy * out;+ }+ } else {+ const float path[3] = { m[1][0] * JetWake, m[1][1] * JetWake, m[1][2] * JetWake };+ const float length2 = path[0] * path[0] + path[1] * path[1] + path[2] * path[2];+ if (length2 < 1.0f) continue;+ const float s = ((m[0][0] - at.x) * path[0] + (m[0][1] - at.y) * path[1] + (m[0][2] - at.z) * path[2]) / length2;+ if (s < 0 || s > 1) continue;+ const float r[3] = { at.x - (m[0][0] - path[0] * s), at.y - (m[0][1] - path[1] * s), at.z - (m[0][2] - path[2] * s) };+ const float tube = (std::max)(m[0][3], 1.5f * cell) * (1 + 2 * s); // MoverPass's wakeCore+ const float core = std::exp(-(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]) / (tube * tube)) * (1 - s);+ if (core < 0.01f) continue;+ // the vortex speed MoverPass gives it, 0.12 of the jet's+ const float push = WakeNudge * 0.12f * std::sqrt(length2) / JetWake * core * dt;+ const float across = std::sqrt(r[0] * r[0] + r[1] * r[1]);+ if (across > 0.01f) {+ shift[0] += r[0] / across * push;+ shift[1] += r[1] / across * push;+ }+ shift[2] -= push;+ }+ }+ // Nothing pushed down past 1.5 cells over the ground (MoverPass's column stops there too): a cell+ // laid in the terrain is solid and zeroed, so smoke sunk under a hovering helicopter was gone.+ if (shift[2] < 0)+ shift[2] = (std::max)(shift[2], (std::min)(TheTerrainRenderObject->getHeightMapHeight(at.x, at.y, NULL) + 1.5f * cell - at.z, 0.0f));const float moved = std::sqrt(shift[0] * shift[0] + shift[1] * shift[1] + shift[2] * shift[2]), most = 0.75f * cell;const float scale = moved > most ? most / moved : 1.0f;at.x += shift[0] * scale;@@ -3580,13 +3696,13 @@ void collectMovers(int now)// rotor bone would give the real discif (drawable->isKindOf(KINDOF_PRODUCED_AT_HELIPAD) || speed < 60.0f) {const float radius = (std::max)(major, 15.0f) * 1.1f;- const float close = (std::min)(1.0f, 1.6f - height / (6.0f * radius));- if (close <= 0.0f) continue;m[0][2] = at.z + tall * 0.8f;m[0][3] = radius;m[1][3] = MoverRotor;m[2][2] = height;- m[3][1] = close;+ // its column at any height; the sheet and the dust ring along the ground as close as it is+ m[3][0] = RotorWash;+ m[3][1] = (std::max)((std::min)(1.0f, 1.6f - height / (6.0f * radius)), 0.0f);priority = 0.25f; // the one that shows most: kept before the rest} else {m[0][3] = (std::max)(major * 0.8f, 12.0f);@@ -3922,6 +4038,11 @@ void stepAir(ID3D11DeviceContext *context, unsigned g, int now, float dt, floatfound.clear();float low[3], high[3];boxOf(volume, shape, low, high);+ wakers.clear();+ for (const Mover &mover : movers) {+ const int kind = int(mover.m[1][3] + 0.5f);+ if (kind == MoverJet || kind == MoverRotor) wakers.push_back(&mover);+ }for (auto it = systems.begin(); it != systems.end();) {const int id = *it;ParticleSystem *system = TheParticleSystemManager->findParticleSystem((ParticleSystemID)id);@@ -3957,8 +4078,8 @@ void stepAir(ID3D11DeviceContext *context, unsigned g, int now, float dt, float// a ballistic or cruise missile's exhaust is a white billowing plume; a rocket's, a thin grey trailconst bool plume = trail && (std::strstr(named, "Scud") || std::strstr(named, "Neutron") || std::strstr(named, "Tomahawk"));bool chained = false;- // the blast fronts passing its particles move them (nudge)- if (!fronts.empty())+ // the blast fronts and the wakes passing its particles move them (nudge)+ if (!fronts.empty() || !wakers.empty())for (Particle *p = system->getFirstParticle(); p; p = p->m_systemNext) nudge(p, dt, cell);// A rocket's ribbon is laid straight: its points scatter off the fire line (EA's MissileExhaust,// which feeds it, throws each point sideways at up to 0.2 a frame), so the ribbon drew a regular@@ -4147,11 +4268,29 @@ void stepAir(ID3D11DeviceContext *context, unsigned g, int now, float dt, floatif (!smokeBoxes.empty()) { // only where the air already holds smokefor (const Mover &mover : movers) {const float (&m)[4][4] = mover.m;- if (int(m[1][3] + 0.5f) != MoverRotor) continue;- const float reach = m[0][3] * 3.0f;- const float a[3] = { m[0][0] - reach, m[0][1] - reach, m[0][2] - m[2][2] };- const float b[3] = { m[0][0] + reach, m[0][1] + reach, m[0][2] + 20.0f };- grow(a, b);+ const int kind = int(m[1][3] + 0.5f);+ if (kind == MoverRotor) {+ const float reach = m[0][3] * 3.0f;+ const float a[3] = { m[0][0] - reach, m[0][1] - reach, m[0][2] - m[2][2] };+ const float b[3] = { m[0][0] + reach, m[0][1] + reach, m[0][2] + 20.0f };+ grow(a, b);+ } else if (kind == MoverJet) {+ // its wake over the last JetWake s of its path, down to the ground under it, where that+ // meets smoke: a whole pass grown into the box widened the march for nothing+ const float reach = 3.0f * (std::max)(m[0][3], 1.5f * cell);+ float a[3], b[3];+ for (unsigned i = 0; i < 3; ++i) {+ const float tail = m[0][i] - m[1][i] * JetWake;+ a[i] = (std::min)(m[0][i], tail) - reach;+ b[i] = (std::max)(m[0][i], tail) + reach;+ }+ a[2] = (std::min)(a[2], m[0][2] - m[2][2]);+ bool meets = false;+ for (const WorldBox &box : smokeBoxes)+ meets = meets || (a[0] <= box.high[0] && b[0] >= box.low[0] && a[1] <= box.high[1] && b[1] >= box.low[1]+ && a[2] <= box.high[2] && b[2] >= box.low[2]);+ if (meets) grow(a, b);+ }}// a front carries smoke out to its shell's far sidefor (const Front &front : fronts) {