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): film letterboxed cinematics with the perspective camera
Olcay Seyganbb547da2dd9b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 24891a22d..d21a74c82 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -175,7 +175,7 @@ found and fixed — EA's own, not port damage.**- A box drawn with Ctrl held takes those units back out of your selection instead of replacing it, so a group is trimmed by dragging over the corner of it rather than picked again from scratch. Held with Alt the box keeps only what can shoot: drag across your base and you get the tanks, not the dozers and supply trucks standing among them. Both are drag-only, and a single click still means exactly what it always did.- A box dragged over your army and your economy together takes the army. The dozers, workers, supply trucks and hackers standing among the tanks stay where they are, and ambulances and troop carriers go with the soldiers they look after. A box with nobody military in it takes the workers the way it always did.- 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.-- 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. You still turn and zoom it the way you always did, and the box takes effect the moment you tick it, mid-match included.+- 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.- Selected units draw a thread to wherever they are going, with the pointer, tinted, sitting on the spot. Every order draws one: move, attack move, attack, force fire, ground fire, enter, dock, repair, heal, capture, hack, guard, a waypoint path. Green for a move, pink for an attack-move, red for anything that shoots, so a group told three different things reads as three different colours. 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. A dot and a ring stood in for the pointer for a while, and players asked for the pointer back. 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 marker sitting on the destination does not, and that marker stays for as long as the order does. A marker that has just appeared slides the last few pixels up out of the bottom right and fades in as it lands, over about an eighth of a second, so a fresh order catches your eye without anything flashing. 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.diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.hindex 6a28a346e..3b62ec416 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h@@ -298,6 +298,7 @@ private:Bool isDoingScriptedCamera( void ) const; ///< True while any scripted camera movement owns the viewvoid stopDoingScriptedCamera( void ); ///< Hand the view back to the user, whatever the script was doingvoid setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle+ Bool wantsIsometric( void ) const; ///< the option is on and no cinematic has the cameravoid buildCameraTransform( Matrix3D *transform ) ; ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_anglevoid calcCameraConstraints() ; ///< recalc m_cameraConstraintvoid moveAlongWaypointPath(Int milliseconds); ///< Move camera along path.diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cppindex 78b7e0457..82ec55328 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp@@ -830,6 +830,19 @@ private:Real m_upCentre;};+//-------------------------------------------------------------------------------------------------+// The isometric camera is the player's. A cinematic is shot for the perspective lens: the scripts+// drop the eye to ten units off the ground and tilt it up at a rocket or the skyline (m_FXPitch+// runs from -1.5 to 52 in USA01's intro), and there is no ground in that frame for+// IsometricFrameFit to fit. Its elevation search then sits on one end of its range or the other,+// so each shot came out as a view from above of somewhere else, jumping as the pitch changed, and+// a shallow one looked past the edge of the map into white. So the letterbox, which a scripted+// cinematic puts up, hands the camera back to perspective until it comes down.+Bool W3DView::wantsIsometric( void ) const+{+ return TheGlobalData->m_isometricCamera && !(TheDisplay && TheDisplay->isLetterBoxed());+}+//-------------------------------------------------------------------------------------------------void W3DView::setCameraTransform( void ){@@ -898,7 +911,7 @@ void W3DView::setCameraTransform( void )// the perspective camera would, on any screen shape. Rotating and zooming work as they always// did, because the perspective camera they move is still built first.const Bool wasIsometric = m_isometricApplied;- m_isometricApplied = TheGlobalData->m_isometricCamera;+ m_isometricApplied = wantsIsometric();const Real perspectiveFov = perspectiveHorizontalFov(getWidth());if (m_isometricApplied){@@ -1715,7 +1728,7 @@ void W3DView::update(void)// The isometric camera holds its height over the view's ground level instead, for the reason// IsometricFrameFit gives: following the hills made the picture grow and shrink under the pan.//- if (TheGlobalData->m_isometricCamera)+ if (wantsIsometric())m_terrainHeightUnderCamera = m_groundLevel;elsem_terrainHeightUnderCamera = m_zoomAnchorValid ? m_zoomAnchorTerrainHeight : getHeightAroundPos(m_pos.x, m_pos.y);@@ -1791,7 +1804,7 @@ void W3DView::update(void)}// (gth) C&C3 if m_isCameraSlaved then force the camera to update each frame- if ((recalcCamera) || (m_isCameraSlaved) || TheGlobalData->m_isometricCamera != m_isometricApplied) {+ if ((recalcCamera) || (m_isCameraSlaved) || wantsIsometric() != m_isometricApplied) {setCameraTransform();}m_recalcCamera = false;