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(ww3d2): neutral glass cloak and heat look for stealth on d3d11
Olcay Seyganb2ee650e3b9f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 843ddf161..bcd936c63 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1457,7 +1457,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- Gunfire shows at the zoom you play at. A rifle's tracer was a third of a unit wide, about one pixel from the default camera, and a bullet hit nothing you could see. Tracers from rifles, Gattlings, Humvees, Technicals and Quad Cannons are now twice as wide and half again as long, the muzzle flash is half as big again, and every hit kicks up sparks and a puff of dirt where it lands. A tank shell burns a short hot streak behind it all the way to the target, where it used to be a grey sliver you could not pick out between the flash and the blast. A Crusader's, Battlemaster's, Scorpion's, Paladin's or Overlord's shot used to be a soft white glow drifting out in front of the gun, wider than the tank; it is now a short orange blast at the barrel tip, with a bigger flame and smoke puff behind it. A shell landing throws dirt and sparks around its blast. The colours are the ones the game always used, and no weapon does anything different.- A China mine field tells you what kind it is. EA's field had no model at all, only a soft white glint swelling and fading on each of its eight spots, so your own minefield looked like a patch of fireflies. Each mine is now marked by a small arming light that snaps on for a quarter of a second every second and a half, red on standard and cluster mines and blue on EMP mines, with a white-hot point and a dark rim that keep it readable on grass, sand or snow. No mine body is drawn on the ground, only the light. The enemy still sees nothing until he detects the field. A mine going off under a tank now throws a column of dark earth twice the tank's height, scatters clods round it and leaves a low black smoke and a scorch, with a short jolt of the screen; it used to puff a pale spray of specks that looked like dust kicked up. An EMP mine throws no earth, so you can tell which kind went off: it lights a blue ring across the ground, a crackle of blue sparks and a short blue flash at the spot; EA's flash grew until it washed the whole screen white for a fifth of a second. What a mine does is unchanged.- A base out of power looks out of power. A building that switches off when your power runs short, or one a hacker shut down, drains to a cold grey and sags darker, and its windows and lamps go out. Every few seconds it blinks dark for an instant or its lights catch again for a moment, and blue sparks jump on its walls where something shorts. A tank or building hit by an EMP crawls with thin blue arcs for as long as it stays dead, where it used to just turn dark grey.-- Your own stealthed units look cloaked instead of faded. What stands behind a Pathfinder, Colonel Burton or a stealthed GLA unit bends through its body in a slow ripple, under a cold edge you can still read the unit by. When an enemy detector has found him, that edge turns amber and flares with each sweep. On every renderer, a stealthed unit of yours no longer comes out solid whenever no building is on the screen: the game drew it a second time without its see-through. An enemy stealth unit your detector finds used to turn into a flat orange shape with no paint; now it keeps its own paint, drained of colour, under a burning red-orange outline with scan lines running up it, and all of it flares on every sweep of the detector. This is the default renderer; Classic and the old renderer keep the 2003 look for all of these.+- Your own stealthed units look like glass, not like ice. In 3.0 a camouflaged Rebel, a Pathfinder or Colonel Burton came out under a blue skin with bands running up it, which players rightly called ugly. The blue is gone: the ground behind him shows through his body in its own colours, bent by a slow, gentle shimmer that ripples along him and a little more at his outline, with his own paint muted inside it and a soft pale edge round him, so you do not lose him at the zoom you play at. He never turns solid, and the 2003 breathing of the fade is still there. The shimmer moves the same few pixels at any zoom, so a stealthed squad seen from far out does not fizz. When an enemy detector has found him, his body warms and an amber edge beats on him, plain enough to notice in a fight. On every renderer, a stealthed unit of yours no longer comes out solid whenever no building is on the screen: the game drew it a second time without its see-through. An enemy stealth unit your detector finds used to turn into a flat orange shape with no paint; now it shows as heat, its own shading run from dark red through orange to a pale yellow so you can still tell a tank from a soldier, with a burning outline and a slow glow climbing it that flares on every sweep of the detector. The fine scan lines of 3.0 are gone, since zoomed out they broke into stripes. This is the default renderer; Classic and the old renderer keep the 2003 look for all of these.- Effects fade out instead of blinking off. The rings a nuke sends across the ground, and any spark, flash or puff whose own colours never reached nothing, used to vanish at full strength on their last frame. Each one now dims away over its last quarter of a second, or over a quarter of its life when it lives shorter than that. One that was already fading looks the way it always did.- Toxin, anthrax and radiation pools lie on the ground. A pool is a carpet of puddle pictures spread up to 140 paces from where the shell or the spray came down, and every one of them was drawn dead flat at the height of that one spot: on a hillside the uphill half of the pool disappeared into the slope and the downhill half hung in the air above it. Each puddle now bends over the ground underneath it, on both renderers, and a pool on a bridge stays on the deck. The pool also holds still. It used to throb twice a second, because every half second the pool's poison fired a fresh batch of puddles that swelled out of black to full green and back to black in two seconds, each batch somewhere new. Now it comes up in half a second, stays one pool at full colour for as long as it does damage, and fades over its last three seconds, or over three seconds from the moment the fog of war closes over it. It is not frozen, though: each puddle fades down and back up on its own beat, so the surface shimmers like something liquid while the pool as a whole never pulses. Four Scud warheads landing on one spot used to stack into a white-hot blotch in the middle; overlapping pools now share their light and the middle stays toxin green. The ground under it takes on its colour, green for toxin and the anthrax colours for anthrax, so it looks spilled rather than shone onto the grass. China's radiation keeps its orange but glows instead of browning the grass, which made it look like a scorch mark, and small bubbles swell out of it and pop. A nuke's radiation lies on the hillside as a pool from three seconds after the blast, where its first ten seconds used to be flat squares cutting into the slope.- A Scud Storm or a carpet bomb shakes the screen as hard as it should. The game cut a pile of heavy shakes back to a mild one, so a run of missiles or bombs landing together shook less than one of them alone. Each now shakes a step lighter and the run builds up. Demo traps and Aurora bombs shake now, and a falling building shakes harder the bigger it was.diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.hindex ebde6d3cd..b2fb594a6 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h@@ -132,8 +132,8 @@ enumDRAW_EFFECT_NONE = 0,DRAW_EFFECT_OUTAGE = 1, ///< a building out of power: drained, cold, lights out, sparksDRAW_EFFECT_EMP = 2, ///< anything an EMP disabled: arcs crawling over it- DRAW_EFFECT_CLOAK = 3, ///< own stealthed unit: what is behind it bent through it, a rim- DRAW_EFFECT_REVEALED = 4, ///< enemy stealthed unit a detector found: hot edges, scan lines+ DRAW_EFFECT_CLOAK = 3, ///< own stealthed unit: what is behind it, gently bent, through its muted paint+ DRAW_EFFECT_REVEALED = 4, ///< enemy stealthed unit a detector found: seen as heatDRAW_EFFECT_COUNT = 5};@@ -560,49 +560,60 @@ const unsigned NORMAL_MAPPED_LIGHTS = 4;" return current;\n" \"}\n" \"\n" \- "/* Own stealthed unit. What is behind it shows through, bent by a slow ripple that swims over\n" \- " the body and bends harder towards the outline, with a little of the unit itself left in so\n" \- " its owner can still read what it is, and a cold rim. Detected, the rim pulses amber. The\n" \- " alpha goes back up to the texel's own, because the shade already holds the mix. */\n" \+ "/* Own stealthed unit, seen through like glass. What is behind it shows through its body,\n" \+ " bent a few pixels by a slow, broad ripple that swims along it and bends a little more\n" \+ " towards the outline. No tint: the scene keeps its colour, and the unit's own paint, drained\n" \+ " a little, sits in it at about half by the game's own stealth opacity, so the 2003 breathing\n" \+ " still shows; darker than that and a unit at play zoom was lost but for its shadow. A soft\n" \+ " near-white fresnel edge holds the silhouette. The ripple is measured in the world and moves\n" \+ " a fixed share of the screen, so a unit far out shimmers as gently as one up close and never\n" \+ " breaks into noise. Detected (the strength is never below 0.6 then), the body warms and an\n" \+ " amber edge beats. The alpha goes back up to the texel's own, because the shade already\n" \+ " holds the mix. */\n" \"float4 effect_cloak(float4 current, float4 position)\n" \"{\n" \" float3 world; float3 surface; float facing;\n" \" effect_surface(position, world, surface, facing);\n" \" float t = DrawEffectParameters.x;\n" \+ " float detected = DrawEffectParameters.y;\n" \" float opacity = max(DrawEffectParameters.w, 0.05);\n" \- " float rim = pow(1.0 - facing, 1.5);\n" \- " float swim_x = effect_noise(world * 0.6 + float3(t * 0.9, t * 0.5, t * 1.3)) - 0.5;\n" \- " float swim_y = effect_noise(world * 0.6 + float3(5.2 - t * 0.7, 1.3, t * 1.1)) - 0.5;\n" \+ " float rim = pow(1.0 - facing, 2.0);\n" \+ " float swim_x = effect_noise(world * 0.12 + float3(t * 0.35, t * 0.2, t * 0.45)) - 0.5;\n" \+ " float swim_y = effect_noise(world * 0.12 + float3(7.3 - t * 0.3, 2.1, t * 0.4)) - 0.5;\n" \" float2 screen = 1.0 / ShadowViewport.xy;\n" \- " float2 bend = float2(swim_x, swim_y) * (0.016 + 0.03 * rim) * screen.y + surface.xy * rim * 0.008 * screen.y;\n" \+ " float2 bend = float2(swim_x, swim_y) * (0.008 + 0.006 * rim) * screen.y;\n" \" int2 at = int2(clamp(position.xy + bend, float2(0.0, 0.0), screen - 1.0));\n" \" float3 behind = SceneColour.Load(int3(at, 0)).rgb;\n" \- " float band = smoothstep(0.85, 1.0, sin(world.z * 0.5 - t * 4.0)) * 0.35;\n" \- " float own = 0.4;\n" \- " float3 edge = lerp(float3(0.45, 0.85, 1.0), float3(1.0, 0.55, 0.15), DrawEffectParameters.y);\n" \- " float edge_gain = 0.9 + 0.6 * DrawEffectParameters.y * (0.5 + 0.5 * sin(t * 9.0));\n" \- " current.rgb = lerp(behind * float3(0.85, 0.95, 1.15), current.rgb, own)\n" \- " + (rim * edge_gain + band + 0.08) * edge;\n" \+ " float grey = dot(current.rgb, float3(0.299, 0.587, 0.114));\n" \+ " float3 own = lerp(grey.xxx, current.rgb, 0.7);\n" \+ " float3 glass = lerp(behind, own, 0.3 + 0.35 * opacity) + rim * 0.4 * float3(0.92, 0.96, 1.0) + 0.04;\n" \+ " float found = step(0.01, detected);\n" \+ " float beat = 0.55 + 0.45 * sin(t * 6.0);\n" \+ " float3 amber = float3(1.0, 0.55, 0.15);\n" \+ " glass = lerp(glass, glass * amber * 1.4, found * 0.35) + found * (rim * 1.2 + 0.08) * beat * amber;\n" \+ " current.rgb = glass;\n" \" current.a = saturate(current.a / opacity);\n" \" return current;\n" \"}\n" \"\n" \- "/* Enemy stealthed unit a detector found. The paint drains to a dull warm grey, the outline\n" \- " burns red-orange, scan lines run up it in world height, and each sweep of the detector\n" \- " (the strength, one at the sweep and falling after) brightens all of it. */\n" \+ "/* Enemy stealthed unit a detector found, seen as heat, the way the 2003 heat vision pass meant\n" \+ " it. The paint's own brightness runs up a thermal ramp, dark red through orange to a pale hot\n" \+ " yellow, so the shape still reads, the outline burns, and one slow broad sweep climbs it. Each\n" \+ " sweep of the detector (the strength, one at the sweep and falling after) brightens all of\n" \+ " it. No fine lines: drawn a few pixels high, a zoomed out unit turned them into stripes. */\n" \"float4 effect_revealed(float4 current, float4 position)\n" \"{\n" \" float3 world; float3 surface; float facing;\n" \" effect_surface(position, world, surface, facing);\n" \" float t = DrawEffectParameters.x;\n" \" float pulse = DrawEffectParameters.y;\n" \- " float grey = dot(current.rgb, float3(0.299, 0.587, 0.114));\n" \- " float3 heat = float3(1.0, 0.36, 0.10);\n" \+ " float heat = saturate(dot(current.rgb, float3(0.299, 0.587, 0.114)) * 1.3 + 0.1);\n" \+ " float3 ramp = lerp(float3(0.30, 0.04, 0.02), float3(1.0, 0.42, 0.08), smoothstep(0.0, 0.55, heat));\n" \+ " ramp = lerp(ramp, float3(1.0, 0.86, 0.55), smoothstep(0.55, 1.0, heat));\n" \" float rim = pow(1.0 - facing, 2.0);\n" \- " float scan = smoothstep(0.80, 1.0, frac(world.z * 0.4 - t * 1.5));\n" \- " float sweep = smoothstep(0.96, 1.0, sin(world.z * 0.08 - t * 2.2));\n" \- " float glow = (rim * 1.7 + scan * 0.35 + sweep * 0.6 + 0.12) * (0.55 + 0.75 * pulse);\n" \- " current.rgb = grey * float3(0.85, 0.62, 0.52) * 0.85 + heat * glow;\n" \+ " float sweep = smoothstep(0.9, 1.0, sin(world.z * 0.06 - t * 1.8));\n" \+ " float gain = 0.6 + 0.6 * pulse;\n" \+ " current.rgb = ramp * gain + float3(1.0, 0.40, 0.12) * (rim * 0.9 + sweep * 0.35) * gain;\n" \" return current;\n" \"}\n" \"\n"