Skip to content

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.

feat(gameclient): Classic camera and placement keep retail's rules

Olcay Seygan9dc12ae6216f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 74574f333..c0ce98604 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1087,7 +1087,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- Display, graphics, effects, audio, controls, gameplay and network, behind seven buttons across the top. The original screen was one panel with everything on it at once, and it was already full the day it shipped: the language filter, the keyboard button and four camera checkboxes are all still in there, parked off the right edge where nobody can reach them, because there was nowhere left to put them.
- Classic Graphics, at the top of the Graphics page, puts the game back the way it looked in 2003 in one click: its own textures and ground in place of the upscaled ones, the old hard shadows, the round dark patch under every tree where Reforged lays the tree's own outline on the ground, no bump detail on the models and no glow or sharpening over the picture. Leave it off and you have Reforged. The rest of the options stay yours either way, and the box takes effect the next time the game starts.
-- Interface, at the top of the HUD group on the Gameplay page, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, including anyone updating whose settings never named it. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the one-piece command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. The mouse and hotkeys are still Reforged's for now and come back in a later update.
+- Interface, at the top of the HUD group on the Gameplay page, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, including anyone updating whose settings never named it. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the one-piece command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. The mouse and keys are 1.04's as well. The left button selects and gives the order, so an enemy under it is an attack and a bunker under your infantry is a way in; the right button drops your selection or takes back a half-given order, and a right drag scrolls the map. Ctrl held is force fire. Alt held lays waypoints, and the white path joining them is drawn again. A guard order holds the range it always held, Shift and a number adds that group to what you have selected, and a build button is one unit a click. The keys are your language's own key map from the game's files, with nothing of Reforged's grid laid over it. The camera zooms on the middle of the screen, turns without snapping, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. None of it reaches the battle itself: Classic sends the game only the orders 1.04 sent, so a Classic player and a Reforged one share a match, and a replay plays back the same in either.
- Every graphics setting is on the Graphics and Effects pages. Shadows, clouds, ground lighting, soft water edges, trees, extra animations, heat haze, texture resolution and the particle limit used to hide in a popup that only opened if you picked Custom from the detail box on another page, so choosing High never showed you what High turns on. Pick a preset now and its settings change in front of you; touch any one of them and the box reads Custom. Texture filtering and the number of anisotropic samples, which needed a text editor, sit there too.
- Every page is sorted into titled groups by what the settings do, and the groups sit in the same three columns on every tab. On Graphics the detail preset heads the first column with the texture and particle sliders under it, the picture settings take the second and the terrain the third. The framed boxes the original drew inside each page are gone. They were sized for headings that no longer exist, which is why no two pages started their first setting at the same height.
- The detail box has Ultra above High, and a preset now sets everything it is responsible for. Picking High used to leave antialiasing and texture filtering wherever they happened to be; High now brings 4x antialiasing and 8 anisotropic samples with it, and Low turns both down for the machines that need it. Ultra is High with the particle limit at the top of its slider, 5,000 against High's 3,000, detail that is never dropped when the frame rate dips, 8x antialiasing, 16 anisotropic samples, thick smoke and every new shadow and effect switched on. Glow stays yours whichever you pick: the artwork was painted without it.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h
index c963a582d..ade073bd9 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/View.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/View.h
@@ -191,6 +191,7 @@ public:
virtual void anchorZoomAt( const ICoord2D *pixel ) { } ///< ZoomToCursor: hold the ground under this pixel there while the zoom settles
virtual void setZoomToDefault( void ) { } ///< Set zoom to default value
virtual void setZoomToMax( void ) { } ///< Set zoom as far out as the player may zoom by hand
+ void setZoomToStart( Bool shellMap ); ///< the zoom a match opens at: max under StartAtMaxZoom, else default
virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height
// for debugging
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
index fffad475e..5faccfc64 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
@@ -821,7 +821,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
// Append build time, health, and the best weapon's range and damage, all read off the
// template - there is no Object yet to ask.
//
- if( TheGlobalData->m_detailedBuildTooltips )
+ if( TheGlobalData->m_detailedBuildTooltips && !TheGlobalData->isClassicUI() )
{
card.hasStats = TRUE;
card.buildSeconds = ControlBar_secondsFromFrames( (Real)thingTemplate->calcTimeToBuild( player ) );
@@ -849,7 +849,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
}
else if( upgradeTemplate )
{
- if( TheGlobalData->m_detailedBuildTooltips )
+ if( TheGlobalData->m_detailedBuildTooltips && !TheGlobalData->isClassicUI() )
putUpgradeTargets( card, upgradeTemplate, player );
//We are looking at an upgrade purchase icon. Maybe we already purchased it?
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 317ff4bb8..ceeb879b4 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -3260,7 +3260,7 @@ void InGameUI::drawBlindSpots( void )
fillBlindSpotShade( pending );
}
- if( !TheGlobalData->m_showPlacementRangeRing )
+ if( !TheGlobalData->m_showPlacementRangeRing || TheGlobalData->isClassicUI() )
return;
// a selected defence shows its own blind spots only, not what its neighbours cover for it
@@ -3471,7 +3471,7 @@ static void drawReachSegment( const ReachSegment &segment, const Player *owner )
//-------------------------------------------------------------------------------------------------
void InGameUI::drawPlacementReach( void )
{
- if( !TheGlobalData->m_showPlacementRangeRing )
+ if( !TheGlobalData->m_showPlacementRangeRing || TheGlobalData->isClassicUI() )
return;
// on the cursor, or clicked: a selected armed building brings the circles up just the same
@@ -3550,7 +3550,7 @@ void InGameUI::handleBuildPlacements( void )
// so a defense can be sited against what it actually covers. The radius comes off the
// template - there is no Object yet - and drawPlacementReach draws it under the cursor.
//
- if( TheGlobalData->m_showPlacementRangeRing )
+ if( TheGlobalData->m_showPlacementRangeRing && !TheGlobalData->isClassicUI() )
{
m_placementRingRadius = templateReach( m_pendingPlaceType );
m_placementRangeRingUp = ( m_placementRingRadius > 0.0f );
@@ -4163,7 +4163,7 @@ void InGameUI::update( void )
// interval, which is what the rotate keys do in Stronghold.
//
const UnsignedInt CAMERA_SNAP_REPEAT_MS = 250;
- if( TheGlobalData->m_snapCameraRotateTo45 )
+ if( TheGlobalData->m_snapCameraRotateTo45 && !TheGlobalData->isClassicUI() )
{
if( (m_cameraRotatingLeft || m_cameraRotatingRight) && m_cameraRotatingLeft != m_cameraRotatingRight
&& cameraNowMs - m_cameraSnapRepeatMs >= CAMERA_SNAP_REPEAT_MS )
@@ -5266,7 +5266,8 @@ Int InGameUI::allyPlayerMask( void ) const
//-------------------------------------------------------------------------------------------------
void InGameUI::sendLocalAllyCursor( void )
{
- if( !TheGlobalData->m_showAllyCursors )
+ // the game as shipped sent no cursor to anybody
+ if( !TheGlobalData->m_showAllyCursors || TheGlobalData->isClassicUI() )
return;
// TheNetwork is the whole test for "is this a game with other people in it"
@@ -7510,7 +7511,7 @@ Real InGameUI::computePlacementAngle( const ICoord2D *start, const ICoord2D *end
// optional 45 degree snap (SnapBuildPlacementTo45 in Options.ini) - lines walls and
// defenses up with the base instead of leaving them at whatever the drag produced.
- if( TheGlobalData->m_snapBuildPlacementTo45 )
+ if( TheGlobalData->m_snapBuildPlacementTo45 && !TheGlobalData->isClassicUI() )
angle = snapAngleTo45( angle );
return angle;
@@ -7560,7 +7561,7 @@ static void placementHalfExtents( const ThingTemplate *what, Real angle, Real *h
void InGameUI::snapPlacementToGrid( Coord3D *world, const ThingTemplate *what, Real angle ) const
{
- if( world == NULL || what == NULL || TheGlobalData->m_gridBuildPlacement == FALSE )
+ if( world == NULL || what == NULL || TheGlobalData->m_gridBuildPlacement == FALSE || TheGlobalData->isClassicUI() )
return;
Real halfX, halfY;
@@ -7578,7 +7579,8 @@ void InGameUI::snapPlacementToGrid( Coord3D *world, const ThingTemplate *what, R
//-------------------------------------------------------------------------------------------------
Bool InGameUI::placesRow( void )
{
- return m_pendingPlaceType != NULL && TheKeyboard &&
+ // Classic places one structure a click, as the game shipped
+ return m_pendingPlaceType != NULL && TheKeyboard && !TheGlobalData->isClassicUI() &&
( TheKeyboard->isShift() || TheKeyboard->isAlt() ) &&
!TheBuildAssistant->isLineBuildTemplate( m_pendingPlaceType );
}
@@ -7934,7 +7936,7 @@ Bool InGameUI::overlapsPendingPlacement( const Coord3D *world, const ThingTempla
//-------------------------------------------------------------------------------------------------
void InGameUI::snapPlacementToNeighbour( Coord3D *world, const ThingTemplate *what, Real angle ) const
{
- if( TheBuildAssistant->isLineBuildTemplate( what ) )
+ if( TheBuildAssistant->isLineBuildTemplate( what ) || TheGlobalData->isClassicUI() )
return;
const Real largestFootprint = 150.0f; // half-diagonal of the biggest structure it may lean on
@@ -8030,7 +8032,7 @@ void InGameUI::forgetPendingPlacements( void )
Bool InGameUI::nudgePlacementToLegal( Coord3D *world, const ThingTemplate *what, Real angle,
Object *builderObject ) const
{
- if( world == NULL || what == NULL || TheGlobalData->m_nudgeBuildPlacement == FALSE )
+ if( world == NULL || what == NULL || TheGlobalData->m_nudgeBuildPlacement == FALSE || TheGlobalData->isClassicUI() )
return FALSE;
// a wall tiles from the two points you dragged between; sliding one end off that line is not help
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
index ac6f45f85..c82e1ae5a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
@@ -123,7 +123,8 @@ static Coord2D edgeScrollPull( const ICoord2D& pos )
{
const Int width = (Int)TheDisplay->getWidth();
const Int height = (Int)TheDisplay->getHeight();
- const Int band = isOverWindow( pos ) ? edgeScrollSize : EdgeScroll_bandForHeight( height );
+ // Classic is the game as shipped: the last three pixels, at full speed, and nothing deeper
+ const Int band = ( TheGlobalData->isClassicUI() || isOverWindow( pos ) ) ? edgeScrollSize : EdgeScroll_bandForHeight( height );
Coord2D pull;
pull.x = EdgeScroll_strength( width - 1 - pos.x, band ) - EdgeScroll_strength( pos.x, band );
@@ -151,7 +152,7 @@ void LookAtTranslator::setScrolling(Int x)
TheTacticalView->setMouseLock( TRUE );
m_scrollType = x;
// A manual pan restores map constraints widened by scripted camera paths.
- if (TheGlobalData->m_useCameraConstraints && TheGlobalData->m_cameraBoundaryMargin > 0)
+ if (TheGlobalData->m_useCameraConstraints && TheGlobalData->m_cameraBoundaryMargin > 0 && !TheGlobalData->isClassicUI())
TheTacticalView->forceCameraConstraintRecalc();
if(TheStatsCollector)
TheStatsCollector->startScrollTime();
@@ -417,7 +418,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
// edge, so believing it would scroll the map for as long as the mouse sat on the desktop.
// Nor while a watcher's director or player camera drives: the spectator page stands on the
// top and right edges, and the pointer on its way to it took the camera away (ObserverCamera.h).
- const Bool edgeScrollAllowed = (!TheGlobalData->m_windowed || TheGlobalData->m_edgeScrollInWindowedMode)
+ // Classic keeps retail's rule whatever Options.ini says.
+ const Bool edgeScrollAllowed = (!TheGlobalData->m_windowed || (TheGlobalData->m_edgeScrollInWindowedMode && !TheGlobalData->isClassicUI()))
&& TheMouse->isCursorInWindow() && !TheObserverCamera.isDriving();
if (m_isScrolling)
@@ -439,7 +441,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
Real angle = FACTOR * (m_currentPos.x - m_anchor.x);
- if (TheGlobalData->m_snapCameraRotateTo45)
+ if (TheGlobalData->m_snapCameraRotateTo45 && !TheGlobalData->isClassicUI())
{
// discrete heading: the drag turns an angle we keep to ourselves and the camera
// jumps to the eighth it is nearest, as the mouse crosses each halfway point.
@@ -494,21 +496,23 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
// cannot hit an exact eighth of a turn. Eaten so the same notch does not also zoom.
//
// Whole notches only: half a touchpad swipe is not a 45 degree turn.
+ // Classic's wheel only ever zooms, as the game shipped, so none of the Ctrl uses below.
+ const Bool classic = TheGlobalData->isClassicUI();
const Int rotateSteps = (Int)spin;
- if (TheKeyboard->isCtrl() && rotateSteps != 0 &&
+ if (!classic && TheKeyboard->isCtrl() && rotateSteps != 0 &&
TheInGameUI->rotatePendingPlacement( rotateSteps ))
return DESTROY_MESSAGE;
// ZoomToCursor: the view holds the ground under the cursor while the zoom eases in. It does
// it inside its own update, between the zoom moving and the frame being drawn; held from
// here, the correction always landed a frame late.
- if (TheGlobalData->m_zoomToCursor && TheInGameUI->getInputEnabled())
+ if (TheGlobalData->m_zoomToCursor && !classic && TheInGameUI->getInputEnabled())
TheTacticalView->anchorZoomAt( &msg->getArgument( 0 )->pixel );
// Ctrl+wheel with nothing to place crosses the zoom range in three notches instead of
// fifteen. Ctrl and not Shift: Shift is what lays a row of structures, and the wheel
// under it sets that row's gap (PlaceEventTranslator).
- if (TheKeyboard->isCtrl() && TheInGameUI->getPendingPlaceType() == NULL)
+ if (!classic && TheKeyboard->isCtrl() && TheInGameUI->getPendingPlaceType() == NULL)
spin *= CTRL_WHEEL_ZOOM_NOTCHES;
if (spin > 0.0f)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
index 1142aad0f..344bcbad2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
@@ -534,7 +534,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
Drawable *nextBuilder = builderObj ? builderObj->getDrawable() : NULL;
if( row )
TheInGameUI->placeBuildAvailable( NULL, NULL );
- else if( TheKeyboard && TheKeyboard->isShift() && nextBuilder )
+ else if( TheKeyboard && TheKeyboard->isShift() && nextBuilder && !TheGlobalData->isClassicUI() )
TheInGameUI->placeBuildAvailable( build, nextBuilder );
else
TheInGameUI->placeBuildAvailable( NULL, NULL );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp
index a86159298..806e3d9d2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp
@@ -137,7 +137,8 @@ void View::init( void )
m_zoom = 1.0f;
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight;
- m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * CLOSEST_ZOOM_FACTOR;
+ // Classic stops at GameData.ini's own MinCameraHeight, as the game shipped
+ m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * ( TheGlobalData->isClassicUI() ? 1.0f : CLOSEST_ZOOM_FACTOR );
m_okToAdjustHeight = FALSE;
m_defaultAngle = 0.0f;
@@ -168,6 +169,20 @@ View *View::prependViewToList( View *list )
// notches - a whole wheel's travel to go from the ground to the whole map. 60 puts it at about 14.
#define ZOOM_STEP_HEIGHT (60.0f)
+//-------------------------------------------------------------------------------------------------
+/** The zoom a match opens at. StartAtMaxZoom opens it as far out as the wheel itself may go rather
+ * than at the map's own default height; Classic and the shell map behind the menus keep the map's
+ * framing. Here rather than in GameLogic, which calls it, because both answers are client
+ * settings. */
+//-------------------------------------------------------------------------------------------------
+void View::setZoomToStart( Bool shellMap )
+{
+ if( TheGlobalData->m_startAtMaxZoom && !TheGlobalData->isClassicUI() && !shellMap )
+ setZoomToMax();
+ else
+ setZoomToDefault();
+}
+
void View::zoomIn( Real steps )
{
setHeightAboveGround(getHeightAboveGround() - ZOOM_STEP_HEIGHT * steps);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index 11983c724..eb92714da 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -2143,13 +2143,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
updateLoadProgress(LOAD_PROGRESS_POST_PRELOAD_ASSETS);
TheTacticalView->setAngleAndPitchToDefault();
- //StartAtMaxZoom: open the map as far out as the wheel itself may go rather than at the map's
- //own default height, which is the tighter of the two. Not the shell map behind the menus:
- //that one is framed as a set piece and its own default framing is the point of it.
- if( TheGlobalData->m_startAtMaxZoom && !isInShellGame() )
- TheTacticalView->setZoomToMax();
- else
- TheTacticalView->setZoomToDefault();
+ // the opening zoom is the view's to pick from client settings (View::setZoomToStart)
+ TheTacticalView->setZoomToStart( isInShellGame() );
if( TheRecorder )
TheRecorder->initControls();
@@ -2207,13 +2202,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
// Set up the camera height based on the map height & globalData.
TheTacticalView->initHeightForMap();
TheTacticalView->setAngleAndPitchToDefault();
- //StartAtMaxZoom: open the map as far out as the wheel itself may go rather than at the map's
- //own default height, which is the tighter of the two. Not the shell map behind the menus:
- //that one is framed as a set piece and its own default framing is the point of it.
- if( TheGlobalData->m_startAtMaxZoom && !isInShellGame() )
- TheTacticalView->setZoomToMax();
- else
- TheTacticalView->setZoomToDefault();
+ // the opening zoom is the view's to pick from client settings (View::setZoomToStart)
+ TheTacticalView->setZoomToStart( isInShellGame() );
// update the loadscreen
updateLoadProgress(LOAD_PROGRESS_POST_STARTING_CAMERA_2);
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
index d7191a6b3..8ef213205 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
@@ -2186,7 +2186,7 @@ static Bool s_smoothApplied = FALSE;
static void smoothMotionBegin()
{
- TheSmoothMotionActive = TheGlobalData->m_smoothMotion && !TheGlobalData->m_headless;
+ TheSmoothMotionActive = TheGlobalData->m_smoothMotion && !TheGlobalData->m_headless && !TheGlobalData->isClassicUI();
TheSmoothMotionAlpha = TheSmoothMotionActive ? GameEngine_logicTickFraction() : 1.0f;
if (!TheSmoothMotionActive)
return;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index acfbf63f4..4af2b71ff 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -430,21 +430,29 @@ void W3DInGameUI::draw( void )
if( m_isFormationDragging )
drawFormationLine();
+ // Classic draws what the game as shipped drew: none of the threads, plan numbers, ally pointers
+ // or guard shields below, and its waypoint path is W3DWaypointBuffer's. It keeps the order
+ // markers, without their threads, in place of EA's ground ring, which is gone from this tree
+ const Bool classic = TheGlobalData->isClassicUI();
+
// and where everything selected is headed, drag or no drag
drawOrderHints();
// and which of the plans each builder puts up next
- drawBuildPlanNumbers();
+ if( !classic )
+ drawBuildPlanNumbers();
// where the allies are pointing, which is the one thing on this screen somebody else is doing
- drawAllyCursors();
+ if( !classic )
+ drawAllyCursors();
// the attack circle, while the left button is still sweeping it out
if( isAttackCircling() )
drawAttackCircle();
// which of the local player's units are holding a guard
- drawGuardMarkers();
+ if( !classic )
+ drawGuardMarkers();
// the circle an armed guard will hold, under the cursor, at the size the wheel left it. A drag
// is drawing a guard line instead, where every unit holds its own station. A search and
@@ -701,7 +709,7 @@ void W3DInGameUI::drawBuildGrid( void )
return;
// the grid you see is the grid you snap to: with the snap off the lines would mean nothing, but
// the cells nothing can stand on still do
- const Bool drawLines = TheGlobalData->m_gridBuildPlacement;
+ const Bool drawLines = TheGlobalData->m_gridBuildPlacement && !TheGlobalData->isClassicUI();
if( m_placeIcon == NULL || m_placeIcon[ 0 ] == NULL )
return;
if( TheTerrainLogic == NULL || TheAI == NULL )
@@ -1309,7 +1317,7 @@ void W3DInGameUI::drawOrderHints( void )
// Order Lines off in the options takes the lines away and leaves the markers: where a unit is
// going is still worth a glance when the thread across the map is not
- if( TheGlobalData->m_showOrderLines && !inPlace )
+ if( TheGlobalData->m_showOrderLines && !TheGlobalData->isClassicUI() && !inPlace )
TheDisplay->drawLine( from.x, from.y, to.x, to.y, width, lineColor );
// the marker is the plain pointer, tinted: its white body takes the order colour and the
@@ -1464,7 +1472,7 @@ void W3DInGameUI::drawGuardMarkers( void )
//-------------------------------------------------------------------------------------------------
void W3DInGameUI::drawAllyCursorLights( void )
{
- if( !TheGlobalData->m_showAllyCursors )
+ if( !TheGlobalData->m_showAllyCursors || TheGlobalData->isClassicUI() )
return;
enum { LIGHT_SEGMENTS = 20, LIGHT_RINGS = 5 };
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
index 1ca0904d8..0cee3406e 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
@@ -324,8 +324,9 @@ void W3DView::setOrigin( Int x, Int y)
// how far past the map's default max camera height the player may zoom out by hand.
// only the manual zoom limit is stretched - the default/scripted views still use
// m_maxHeightAboveGround, so a map still opens framed the way its author meant it to.
-// 2.9 puts the ceiling at 899 over GameData.ini's MaxCameraHeight of 310; it was 3.2 (992).
-#define ZOOM_OUT_LIMIT_FACTOR (2.9f)
+// 2.9 puts the ceiling at 899 over GameData.ini's MaxCameraHeight of 310; it was 3.2 (992), and
+// Classic keeps 3.2.
+#define ZOOM_OUT_LIMIT_FACTOR (TheGlobalData->isClassicUI() ? 3.2f : 2.9f)
void W3DView::buildCameraTransform( Matrix3D *transform )
{
Vector3 sourcePos, targetPos;
@@ -341,7 +342,8 @@ void W3DView::buildCameraTransform( Matrix3D *transform )
pos.x += m_shakeOffset.x;
pos.y += m_shakeOffset.y;
- if (TheGlobalData->m_useCameraConstraints && m_cameraConstraintValid)
+ // Classic keeps the game's own constraint whatever Options.ini says
+ if ((TheGlobalData->m_useCameraConstraints || TheGlobalData->isClassicUI()) && m_cameraConstraintValid)
{
pos = constrainCameraPosition(pos, m_cameraConstraint);
}
@@ -573,7 +575,7 @@ void W3DView::calcCameraConstraints()
{
Region3D mapRegion;
TheTerrainLogic->getExtent( &mapRegion );
- if (TheGlobalData->m_cameraBoundaryMargin > 0)
+ if (TheGlobalData->m_cameraBoundaryMargin > 0 && !TheGlobalData->isClassicUI())
{
// A fixed margin follows the map rather than shrinking with zoom or camera angle.
m_cameraConstraint = cameraBoundaryFromMap(mapRegion, (Real)TheGlobalData->m_cameraBoundaryMargin);
@@ -889,7 +891,7 @@ void W3DView::setCameraTransform( void )
}
m_3DCamera->Set_Clip_Planes(nearZ, farZ);
- if (TheGlobalData->m_useCameraConstraints)
+ if (TheGlobalData->m_useCameraConstraints || TheGlobalData->isClassicUI())
{
if (!m_cameraConstraintValid)
{
diff --git a/GeneralsMD/Code/Tests/test_camera_behavior.inc b/GeneralsMD/Code/Tests/test_camera_behavior.inc
index 3ef3fa457..6e44aa9d0 100644
--- a/GeneralsMD/Code/Tests/test_camera_behavior.inc
+++ b/GeneralsMD/Code/Tests/test_camera_behavior.inc
@@ -121,6 +121,8 @@ struct CameraInputFixture
static GameLogic *logic = NEW GameLogic;
TheGameLogic = logic;
global->m_saveCameraInReplay = FALSE;
+ // the tests below are Reforged's camera unless they switch to Classic themselves
+ global->m_interfaceStyleInUse = INTERFACE_STYLE_REFORGED;
}
~CameraInputFixture()
{
@@ -220,6 +222,12 @@ TEST(camera_wheel_anchors_zoom_to_cursor_only_with_the_box_ticked)
f.global->m_zoomToCursor = FALSE;
spinWheel();
CHECK_EQ(f.view.zoomAnchors, 1);
+
+ // Classic zooms on the screen's middle whatever the box says, as the game shipped
+ f.global->m_zoomToCursor = TRUE;
+ f.global->m_interfaceStyleInUse = INTERFACE_STYLE_CLASSIC;
+ spinWheel();
+ CHECK_EQ(f.view.zoomAnchors, 1);
}
TEST(ctrl_wheel_zooms_five_notches_for_one)
@@ -246,6 +254,11 @@ TEST(ctrl_wheel_zooms_five_notches_for_one)
// Shift is the row placement's key and changes nothing here
f.keyboard.modifiers(KEY_STATE_LSHIFT);
CHECK_NEAR(1000.0f - heightAfterOneNotch(), plain, 0.01f);
+
+ // Classic's Ctrl is force fire and its wheel is one notch a notch
+ f.global->m_interfaceStyleInUse = INTERFACE_STYLE_CLASSIC;
+ f.keyboard.modifiers(KEY_STATE_LCONTROL);
+ CHECK_NEAR(1000.0f - heightAfterOneNotch(), plain, 0.01f);
}
TEST(edge_scroll_ramps_from_the_band_to_the_old_three_pixels)
@@ -347,5 +360,13 @@ TEST(right_drag_pans_past_the_drag_tolerance_and_middle_drag_turns)
mouse(GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP, 350, 300);
CHECK(!f.camera.isMovingCamera());
+ // Classic's right drag is the same retail scroll
+ f.global->m_interfaceStyleInUse = INTERFACE_STYLE_CLASSIC;
+ mouse(GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN, 300, 300);
+ mouse(GameMessage::MSG_RAW_MOUSE_POSITION, 340, 300);
+ CHECK(f.camera.isRightDragPanning());
+ mouse(GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP, 340, 300);
+ CHECK(!f.camera.isRightDragPanning());
+
TheGameClient = savedClient;
}