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(gameclient): drop formation line points that miss the ground
Olcay Seygan6f9b1d2ac4d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8b1151299..5f2cc3dd3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -286,7 +286,7 @@ found and fixed — EA's own, not port damage.**- The three buttons are split cleanly now. Left selects, and only selects. A right click gives the order, and a right drag scrolls the map the way it did in 2003: the spot you pressed on stays put, and the further you pull away from it the faster the map runs. The drag only starts once the pointer has really travelled, so a click your hand wobbles a pixel or two is still an order and the camera does not twitch. A pan never throws away the building on your cursor or the power you were about to aim. The middle button turns the view, with no key held, and a middle click without a drag puts the camera back where it started. The wheel zooms toward whatever the cursor is over and the screen edges still scroll. The classic scheme, where left both selected and commanded and right scrolled and deselected, is gone rather than switched off, and the two checkboxes that used to choose between them are out of the options screen.- How far the pointer travels before a click becomes a drag is yours to set. Drag Threshold on Options > Controls runs from 2 to 50 pixels, and the game's own value was 25. Raise it if selection boxes start by accident, lower it if your drags are read as clicks.- An isometric camera, on Options > Controls. It looks at the battlefield from far off through a narrow lens, so a tank at the top of the screen is drawn the same size as one at the bottom and a base reads like a city-builder's plan instead of shrinking into the distance. It buys no extra sight. The normal camera's corners, edges and centre are laid over the isometric screen as closely as a flat picture allows, hills and ultrawide screens included: the normal camera still sees a little more at the far corners and the isometric one the same amount more at the near corners, because a perspective view is wider at the back than at the front and an isometric one is not. Pan across a ridge and the picture holds its size and its angle; it does not rise and dip with the ground under it. Campaign cinematics are filmed with the normal camera whatever the box says, and the isometric view comes back when the black bars go. They are shot from ten feet off the ground looking up at a rocket leaving its pad or a skyline, and the isometric camera turned each of those shots into a view from above of somewhere else: the picture lurched sideways every time the shot tilted, and a low shot ran off the edge of the map into a white screen. With the box ticked, USA 1's opening now plays the way it does without it. You still turn and zoom it the way you always did, and the box takes effect the moment you tick it, mid-match included.-- Press V, or the move button, then drag the left button and you draw a line: the selection spreads itself evenly along it, in the order the units already stand, so a column arrives as a firing line instead of a queue. It is the line you actually drew, curves and all, however far you keep drawing it: a long sweep used to give up partway through and finish as one straight run to the cursor, and now it holds its shape to the end. Letting go over the sidebar finishes the order rather than leaving the line stuck to the cursor. Draw the line with the left button while attack move is armed and the whole line is an attack move: artillery spread across a front, each gun firing on what walks into it, instead of one clump on one spot. Guard draws the same way. Every line is drawn with the left button, the one armed orders are aimed with, and the right button never draws one: its drag is the camera. Without an order armed a left drag is the selection box it always was. Armed with attack instead, every unit fires on its own station along the line, which is a barrage laid across a ridge in one drag. `FormationDrag = no` in Options.ini turns the line off if you would rather an armed drag did nothing.+- Press V, or the move button, then drag the left button and you draw a line: the selection spreads itself evenly along it, in the order the units already stand, so a column arrives as a firing line instead of a queue. It is the line you actually drew, curves and all, however far you keep drawing it: a long sweep used to give up partway through and finish as one straight run to the cursor, and now it holds its shape to the end. Letting go over the sidebar finishes the order rather than leaving the line stuck to the cursor. A line pulled up past the horizon into the sky ends where the ground does: the stretch over the sky used to land in one corner of the map, and the units whose stations fell on it walked off there. Draw the line with the left button while attack move is armed and the whole line is an attack move: artillery spread across a front, each gun firing on what walks into it, instead of one clump on one spot. Guard draws the same way. Every line is drawn with the left button, the one armed orders are aimed with, and the right button never draws one: its drag is the camera. Without an order armed a left drag is the selection box it always was. Armed with attack instead, every unit fires on its own station along the line, which is a barrage laid across a ridge in one drag. `FormationDrag = no` in Options.ini turns the line off if you would rather an armed drag did nothing.- Selected units draw a line to wherever they are going, and it looks like a building's rally point: EA's blue rally line, with the rally flag in your colour planted on the ground they are headed for. Every order draws one: move, attack move, attack, force fire, ground fire, enter, dock, repair, heal, capture, hack, guard, a waypoint path. An order aimed at something rather than somewhere, a tank to kill, a building to shoot, take or climb into, a unit to guard, ends on the line's joint instead of a flag, a small disc sitting just over the target and riding along with it while it drives, so a flag never stands on a tank. A shift list runs one line through all its stops, a joint on each and the flag on the last bit of ground. Units standing together and headed the same way share one thread, from the middle of the knot to the middle of where they are going, so twenty tanks sent across the map draw one line instead of twenty laid on top of each other; a selection spread over the map draws one per knot, and a flank sent on its own still shows. An angry mob draws one thread for the whole mob, not one per rioter. An attack move and a shot at the ground both point at the spot you clicked: the attack move's thread used to wander off to whichever free ground each unit was steering for, and ground fire pointed at the middle of the nearest map cell. An attack move stays pink from start to finish, too. A unit that stopped to fight used to swing its thread onto the enemy it was fighting, and only swung it back to your destination once the enemy was dead. It is not a flash at the moment of the order: the line is asked of the unit every frame, so it lasts until the unit gets there, changes its mind or leaves your selection, and it shows on the formation line while you are still drawing it. A unit that has walked off the edge of the screen still draws its line, which is how you see where the half of your army you cannot see is headed. The animated ring the ground used to sprout wherever you clicked is gone: it flashed for a second and told you nothing the flag on the destination does not, and the flag stays for as long as the order does. Aircraft draw their thread from the click, not from the moment they leave the runway. A plane parked on its airfield answers an order by starting its takeoff and puts the order itself aside until the wheels are up, so the taxi and the climb, which is exactly the stretch where you are wondering whether the strike went out at all, used to show nothing.- A unit standing guard draws its marker on the ground it is guarding. A guard order clears the unit's goal on the way in, so every guard marker used to sit in the bottom left corner of the map with a thread running the whole way across it, whatever the unit was actually watching.- A is attack and D is attack move, each arming the next order click. A click on the ground with A held down is a shot at that ground, on your own tank a shot at your own tank, and the mode drops again the moment the order goes out, so nothing stays armed behind your back. The click keeps your group, too: an attack click that was not a drag used to run the same deselect an ordinary left click runs, so the order arrived a moment after the units it was meant for had been dropped. Both orders are aimed with the left button, the way a special power is, and a right click puts the key down again without giving any order. Holding ctrl no longer forces fire: A is the one way to shoot the ground, and ctrl on a move is only the shared pace. The two keys turn each other off, and the letters they took were sitting on grid commands that moved. With A armed, pointing at something nothing in your selection can shoot shows the game's can't-do-that pointer: a Sentry Drone before its gun is researched has no weapon at all, and the pointer used to look ready while the click did nothing.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 64f4f448b..31b38bb97 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -5395,11 +5395,15 @@ void InGameUI::updateFormationHints( void )for( std::vector<ICoord2D>::const_iterator pt = m_formationDragPoints.begin();pt != m_formationDragPoints.end(); ++pt ){+ // past the horizon there is no ground, the same points finishFormationDrag leaves outCoord3D world;- TheTacticalView->screenToTerrain( &(*pt), &world );- path.push_back( world );+ if( TheTacticalView->screenToTerrain( &(*pt), &world ) )+ path.push_back( world );}+ if( path.size() < 2 )+ return;+std::vector<Real> arc;buildPathArcLengths( path, arc );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cppindex 0150cf3e5..e9955776d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp@@ -1492,15 +1492,19 @@ void CommandTranslator::finishFormationDrag( const ICoord2D& lift )TheInGameUI->isGuardArmed() );// the traced curve becomes world points; who stands where along it is decided on- // the logic side, where every machine decides it the same way+ // the logic side, where every machine decides it the same way. A point past the horizon+ // reaches no ground and comes back as the map's corner, so it is left outstd::vector<Coord3D> line;for( std::vector<ICoord2D>::const_iterator it = curve.begin(); it != curve.end(); ++it ){Coord3D world;- TheTacticalView->screenToTerrain( &(*it), &world );- line.push_back( world );+ if( TheTacticalView->screenToTerrain( &(*it), &world ) )+ line.push_back( world );}+ if( line.size() < 2 )+ return;+// a line drawn with the attack key across enemies is aimed at them: the units that can shoot// share those enemies along the stroke, and the ground under the line is not shot at. Only a// line that crosses nobody fires on the ground along it