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): read a jet's wake speed over logic frames, not the haze clock
Olcay Seygane944cdbd74a8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6e8609504..bd38fffb1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -198,6 +198,7 @@ found and fixed, EA's own, not port damage.**- The Raptor, King Raptor, MiG, Aurora and Stealth Fighter turn the way a plane turns. The faster a jet flies, the slower it comes round, so at cruise it sweeps a wide arc and only a slow jet turns tight. It no longer slides sideways through a turn. A Raptor's half circle at cruise takes about 3.2 seconds, where it took about 1.7.- A jet banks into every turn and rolls through level when it swings from one turn into the opposite one, so you can read where it is going from its wings.- Jets no longer rock their wings. A 2 degree nudge on a chase or a path corner flicked the wings 15 degrees over and back inside a third of a second, and a fighter did that every few seconds, so it looked like it was shaking the whole way. Measured over a four-player Hard match, flicks of 8 degrees or more that barely turned the nose came 1.8 times a minute per jet; now 0.2. A full turn still reaches the full bank. A jet that flies into view mid-turn also shows its bank straight away, where it used to snap level and roll back in, up to 42 degrees out.+- With Map Light on, the haze a low jet parts on the ground no longer flickers. The wake's length and spread follow the plane's speed, and that speed was read off a clock that runs smoothly against a plane that moves a whole frame at a time, so a Raptor holding 170 read anywhere from 126 to 239 and the whole wake pulsed thirty times a second. Step to step the reading now moves under 5% in nineteen cases of twenty, where it moved up to 46%, and the wake's point stays under the plane.- Attack runs take longer, and against a target that moves that is a real nerf. A jet cannot snap round onto a tank that drives out from under it, so it flies a wider loop to come back for another pass. In a test a Raptor's pass on a moving Overlord took about 14 seconds where it took about 4. That is the price of a plane that turns like one.- Takeoff has a runway in it. The jet rolls at full throttle, rotates its nose up, lifts its wheels off the tarmac and climbs out at a steady angle, where it used to hop off the end of the runway.- Landing has a circuit in it. The jet turns down in a descending curve onto a straight final, glides in, flares and touches down on the centreline, then rolls out and slows. It used to corkscrew down and stop dead.diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cppindex 547732a8f..e64e45442 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp@@ -394,6 +394,7 @@ struct ProtoHazeSeenReal velX;Real velY;Real seenAt;+ UnsignedInt frame; // the logic frame pos is fromReal wake;Real wakeWidth;Real trail[PROTO_TRAIL_POINTS][PROTO_POINT_FIELDS];@@ -417,6 +418,7 @@ static Real protoWakeWidth(Real over)static std::map<DrawableID, ProtoHazeSeen> s_hazeLastSeen;static Int s_hazeStepNumber = 0;static Real s_hazeLastClock = -1.0f;+static Real s_hazeClockLead = 0.0f; // how far the clock is past the logic frame the drawables stand on, in secondsstatic Real s_hazeSeconds = 0.0f;static Real s_hazeStepDue = 0.0f;@@ -647,7 +649,10 @@ static void stepProtoHaze(Real top, Real dt)now.pos = pos;now.velX = 0.0f;now.velY = 0.0f;- now.seenAt = s_hazeSeconds;+ // pos is where the drawable stood at the start of its logic frame, not at the clock's fraction+ // of the way into the next one+ now.seenAt = s_hazeSeconds - s_hazeClockLead;+ now.frame = TheGameClient->getFrame();now.wake = 0.0f;now.trailCount = fresh ? 0 : keepProtoTrail(before.trail, before.trailCount, now.trail, 0);now.step = s_hazeStepNumber;@@ -662,8 +667,13 @@ static void stepProtoHaze(Real top, Real dt)if (air){- now.velX = moveX / dt;- now.velY = moveY / dt;+ /* The speed is the move over the logic frames it took. Over the step's time it came out 126 to+ 239 a second for a Raptor holding 170: the position moves a whole frame at a time and the+ step falls anywhere inside one, and the wake's length and opening follow the speed, so the+ whole wake pulsed thirty times a second. */+ const UnsignedInt frames = now.frame - before.frame;+ now.velX = (frames > 0) ? moveX * LOGICFRAMES_PER_SECOND / (Real)frames : before.velX;+ now.velY = (frames > 0) ? moveY * LOGICFRAMES_PER_SECOND / (Real)frames : before.velY;const Real ground = TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL);const Real over = pos.z - top;// one parked on a runway or a pad is no wake; a base's planes took every slot@@ -754,6 +764,7 @@ static void stirProtoHaze(Real top)const Real now = protoHazeClock();Real elapsed = now - s_hazeLastClock;s_hazeLastClock = now;+ s_hazeClockLead = now - (Real)TheGameClient->getFrame() / (Real)LOGICFRAMES_PER_SECOND;// the first frame, a new match (the clock starts again) or a long hitch moves nothing; a pause// is no time at allif (elapsed < 0.0f || elapsed > 0.25f)@@ -813,7 +824,8 @@ static void stirProtoHaze(Real top)const Real newestAge = max(s_hazeSeconds - newest[PROTO_POINT_AT], 0.0f);const Real strength = laying ? flyer.wake : newest[PROTO_POINT_STRENGTH];const Real width = laying ? flyer.wakeWidth : newest[PROTO_POINT_WIDTH];- const Real since = min(max(s_hazeSeconds - flyer.seenAt, 0.0f), 0.1f);+ // behind the step's frame under -video, whose pictures fall between two logic frames+ const Real since = min(max(s_hazeSeconds - flyer.seenAt, -0.1f), 0.1f);// straight under the aircraft (the last step's place moved on by its speed), the haze being// on the ground; every trail point keeps the place it was laid at, so the wake stays where it// was left and the aircraft moves on