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): every tree sways
Olcay Seygandd65c2a8a454
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bb4c722d5..d077bec69 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -383,6 +383,7 @@ found and fixed — EA's own, not port damage.**- A mission script that waits for a line of speech to finish waits the same length of time on every machine. It used to ask the sound hardware how long the file was, so a player whose sound card was not working, or was turned off, got the answer zero and walked straight through waits that everyone else sat out. That is a different game on two screens, and a replay that stops matching the machine that recorded it. The length now comes out of the file itself: measured on one line of speech, a silent machine said 0 milliseconds and a machine with sound said 3,285. Both say 3,285 now.- Laying a foundation costs less the further up the map you build. Flattening the ground under a new building scanned every row of the map from the bottom edge up to the building, threw all of them away bar the ones actually under it, and did that once per column. It works out the rows it needs now. The ground comes out identical, down to the last unit of height.- EVA announcements that were queued behind another one no longer go quiet. A request waits its turn and expires if its turn never comes, and the sum that worked out when that was could wrap round to zero, retiring the announcement on the frame it was asked for.+- One tree in ten stood dead still in the breeze. The number that picks which way a tree sways was drawn from a range one short at the bottom, and the bottom of that range is the slot meaning "no sway at all".- Police car lights flash at their own speed instead of your monitor's. On a fast screen with the frame cap off they were cycling five and a half times too quickly.- Ten more places that wrote terrain, roads, bridges, trees, foundations and scorch marks into a buffer the graphics card had refused to hand over. Every one of them wrote to address zero instead, and a graphics device pulled out from under the game is all it takes; the frame is simply skipped now.- Tank tracks no longer crash the game. The renderer has to borrow the buffer it writes them into, and when that request failed, which is what a graphics device pulled out from under the game does, the tracks were written to address zero anyway. Two more of the same shape went with it: the screenshot path and the texture size lookup both used a pointer that the failing call had never filled in. Three of those texture lookups also leaked the surface they asked about, once per procedural texture, for the life of the process.diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cppindex d2f3c82d2..1e1e2154b 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp@@ -1475,7 +1475,13 @@ void W3DTreeBuffer::addTree(DrawableID id, Coord3D location, Real scale, Real anm_trees[m_numTrees].firstIndex = 0;m_trees[m_numTrees].bufferNdx = -1;- m_trees[m_numTrees].swayType = GameClientRandomValue(0, MAX_SWAY_TYPES-1);+ //+ // swayType is a vertex shader constant index counted from c8, and c8 itself is the all-zero+ // "no sway" slot - the ten real ones are c9 to c18. So the range is 1..MAX_SWAY_TYPES, which+ // is what updateSway rolls when the breeze changes; this one rolled 0..MAX_SWAY_TYPES-1, and a+ // tree that drew a zero stood perfectly still. One tree in ten, until the next breeze change.+ //+ m_trees[m_numTrees].swayType = 1+GameClientRandomValue(0, MAX_SWAY_TYPES-1);m_trees[m_numTrees].pushAside = 0;m_trees[m_numTrees].lastFrameUpdated = 0;m_trees[m_numTrees].pushAsideSource = INVALID_ID;