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): zoom to cursor in both interfaces, off by default

Olcay Seyganf99bc9ccef40
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1da1ed4d..c79c47233 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1087,9 +1087,9 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
## The options screen has pages
- Display, graphics, effects, audio, controls, interface 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.
-- Every setting sits with the ones that do the same kind of job. Display is the screen and its brightness. Graphics is what the picture costs and how sharp it is, with the glow and the lighting in a group of their own instead of mixed in with the anti-aliasing. Effects is what stands in the world: all seven shadow boxes together, cloud shadows included, then the scenery, then smoke. Controls splits the camera, the orders, building placement and the mouse into four groups, and Interface holds the command bar size, the income readout, the health bars, the colours, the order lines and the language. In Classic the screen leaves out the twelve boxes Classic ignores anyway, from zoom to cursor and grid placement to the HUD size and the health bar choice, and closes the gaps they leave, so a box on that screen always does something.
+- Every setting sits with the ones that do the same kind of job. Display is the screen and its brightness. Graphics is what the picture costs and how sharp it is, with the glow and the lighting in a group of their own instead of mixed in with the anti-aliasing. Effects is what stands in the world: all seven shadow boxes together, cloud shadows included, then the scenery, then smoke. Controls splits the camera, the orders, building placement and the mouse into four groups, and Interface holds the command bar size, the income readout, the health bars, the colours, the order lines and the language. In Classic the screen leaves out the few boxes Classic ignores anyway, from smooth motion to the HUD size and the order lines, and closes the gaps they leave, so a box on that screen always does something.
- Classic Graphics, on 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, 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, in the launcher, 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, and a game started without the launcher is Classic too. 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. On a 16:9 or 21:9 screen every menu outside a match sits in a 4:3 frame in the middle at its drawn shape, backdrop and border included, with black down both sides the way a 4:3 game looks on a wide monitor; in a match the options and save screens keep that 4:3 frame over the battlefield. The command bar runs edge to edge up to 16:9, as it always did. Past that, on 21:9 or 32:9, the match's own furniture keeps the 16:9 layout in the middle of the screen: the bar, your general's powers beside it, the build tooltip over it, the promotion screen, the superweapon countdowns, the messages, the chat line, the quit menu and diplomacy sit where a 16:9 screen has them, and the battlefield runs on past both ends, 320 pixels either side at 2560x1080. On 16:10 and anything wider the bar is one painted for 16:9, so it is not pulled out of shape the way EA's 4:3 one was: the radar and your selection sit at its two ends, the build grid has a longer field, the money box is in the middle and the power bar is nearly twice as long. A 4:3 or 5:4 screen keeps EA's bar as it was. The wide bar is the work of moddb_dev, from the "C&C Generals HD User Interface" mod on ModDB, itself built on pWn3d_1337's Operation Firestorm interface, and it is here with its author's permission. 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, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on, in the middle of a square plate the same size for every letter, larger than Reforged's and in gold while the button can be pressed; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms on the middle of the screen ten units a notch, as near and as far as Reforged's camera goes, turns without snapping unless you tick Snap Camera Rotation, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. It runs past the edge of the map as far as Reforged's camera does, 200 units unless `CameraBoundaryMargin` says otherwise, so a base in a corner comes to the middle of the screen in either interface. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. 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.
+- Interface, in the launcher, 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, and a game started without the launcher is Classic too. 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. On a 16:9 or 21:9 screen every menu outside a match sits in a 4:3 frame in the middle at its drawn shape, backdrop and border included, with black down both sides the way a 4:3 game looks on a wide monitor; in a match the options and save screens keep that 4:3 frame over the battlefield. The command bar runs edge to edge up to 16:9, as it always did. Past that, on 21:9 or 32:9, the match's own furniture keeps the 16:9 layout in the middle of the screen: the bar, your general's powers beside it, the build tooltip over it, the promotion screen, the superweapon countdowns, the messages, the chat line, the quit menu and diplomacy sit where a 16:9 screen has them, and the battlefield runs on past both ends, 320 pixels either side at 2560x1080. On 16:10 and anything wider the bar is one painted for 16:9, so it is not pulled out of shape the way EA's 4:3 one was: the radar and your selection sit at its two ends, the build grid has a longer field, the money box is in the middle and the power bar is nearly twice as long. A 4:3 or 5:4 screen keeps EA's bar as it was. The wide bar is the work of moddb_dev, from the "C&C Generals HD User Interface" mod on ModDB, itself built on pWn3d_1337's Operation Firestorm interface, and it is here with its author's permission. 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, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on, in the middle of a square plate the same size for every letter, larger than Reforged's and in gold while the button can be pressed; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms ten units a notch, on the middle of the screen unless you tick Zoom to Cursor, as near and as far as Reforged's camera goes, turns without snapping unless you tick Snap Camera Rotation, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. It runs past the edge of the map as far as Reforged's camera does, 200 units unless `CameraBoundaryMargin` says otherwise, so a base in a corner comes to the middle of the screen in either interface. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. 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.
- Classic shows what a factory is building again. Select one with anything queued and its queue takes the portrait's place, the unit in production wearing its build clock, and a click on any entry cancels it; the portrait comes back when the queue runs dry. Until now a Classic factory could queue a hundred units with nothing on screen to count them by. The queue stops at nine, the number of slots that show it, and the build buttons grey out at nine as they did in 1.04. Your general's powers climb the right edge of the screen from the top of the bar, one over the other, as they did in 1.04, and the empty strip above them no longer swallows clicks on the battlefield. They carry how many are ready, with no key letter and no recharge seconds, and the promotion screen carries no number keys either, since Classic's number keys pick teams. Every button on that screen takes its click again: the right half used to sit under the powers bar's empty frame and the bottom row under the command bar's top edge, and a click there went nowhere.
- Supply piles stop shouting their cash over the whole map. A small pile shows its amount only while your cursor is on it or close by, in a smaller font; a big supply dock keeps its label all the time. Classic has the same labels now, with the radar still leaving the piles off.
- The Esc menu and the general's promotion screen close the way they open, in both interfaces. Both used to vanish in a single frame, and Classic's Esc menu had lost its opening flash as well. Classic plays 1.04's flash and fade, forwards to open and backwards to close; Reforged fades its pages out over a little more than a tenth of a second, as fast as they fade in.
@@ -1162,7 +1162,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- The command bar stops changing under you while you are using it. With nothing selected the bar shows one of your builders so you can place a structure without picking a dozer first, and it showed whichever one happened to be idle - so a dozer finishing a building on the far side of the base took the bar over, dropping a half-typed build hotkey and taking the structure off your cursor. The builder you are working with keeps the bar.
- The command bar's artwork moves with the command bar. Minimising it slid the buttons off the bottom of the screen and left the metal they sit on painted over the battlefield; the same painting stood still through the slide the bar makes when a match opens. It travels with the bar and goes with it.
- The lines from your selection to where it is headed can be switched off. Options > Interface has an Order Lines box, on by default. Off, a selected unit shows no line to its goal and none through its queue, but the marker on every point it is headed for stays, so an attack move or a string of waypoints is still there to see. The line you draw while dragging a formation still shows, because that one is the order being given. It changes the moment you press Accept.
-- Zoom to cursor is a box on Options > Controls again, on by default, for anyone who would rather the wheel zoomed on the middle of the screen. It also stopped fighting you. The camera corrected itself a frame after each step of the zoom, so the ground slid off the cursor and was pulled back the whole way in, and the last pull landed after the zoom had finished, as a small jump towards the cursor. And a wheel spun over a spot with no ground under it, out past the edge of the map, threw the camera to the corner of the map. The ground under the cursor stays under it on every frame now, and a spot with no ground zooms on the middle of the screen.
+- Zoom to cursor is a box on Options > Controls again, in Classic and Reforged, and starts unticked: the wheel zooms on the middle of the screen, as it did in 1.04, until you ask for the cursor. A tick saved while it defaulted on does not carry over. It also stopped fighting you. The camera corrected itself a frame after each step of the zoom, so the ground slid off the cursor and was pulled back the whole way in, and the last pull landed after the zoom had finished, as a small jump towards the cursor. And a wheel spun over a spot with no ground under it, out past the edge of the map, threw the camera to the corner of the map. The ground under the cursor stays under it on every frame now, and a spot with no ground zooms on the middle of the screen.
- Scrolling keeps up with the zoom. The camera moved the same distance over the ground at every height, so right down on the ground the map flew past and from the farthest zoom it crawled, ten times slower across the screen, and turning the scroll speed up hardly showed. The pace now follows the zoom: where a map opens it is exactly what it was, zoomed out it covers ground as fast as the picture shows it, and the scroll speed slider sets that pace at every height. Arrow keys, the screen's edges and a right drag all go by it, in Classic and Reforged alike.
- Orders land where you clicked when the camera is right down on the ground. Zoomed all the way in, a right click sent the units to the corner of the map instead of to the spot under the pointer, and the marker and the line went there with them. The game works out what you clicked on by firing a line from the camera at the ground, and that line was thrown away whenever the camera itself had dropped below the height of the tallest hill on the map - so it went wrong on hilly maps first and stayed fine on flat ones, which is why it looked random.
- Click through the command bar wherever its metal is not. The bar is three shaped plates with sloped tops and cut corners, but it caught clicks over the whole rectangle each plate sits in, so a unit standing in the sky above the radar's slope, or in the notch beside the command grid, could not be clicked or ordered to. Between 3 and 22 percent of each plate's rectangle is empty, depending on the side and the panel. Those parts belong to the battlefield now, and the buttons and metal still take every click they did.
diff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.str
index fb0a1b25a..fabd5c228 100644
--- a/GeneralsMD/Code/Data/German/Generals.str
+++ b/GeneralsMD/Code/Data/German/Generals.str
@@ -14706,7 +14706,7 @@ GUI:ZoomToCursor
END
TOOLTIP:ZoomToCursor
-"Das Rad zoomt auf das, worüber der Cursor steht, statt auf die Bildschirmmitte. Nur bei moderner Steuerung."
+"Das Rad zoomt auf das, worüber der Cursor steht, statt auf die Bildschirmmitte."
END
GUI:StartAtMaxZoom
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 60a7ac954..b5112bc3e 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -862,7 +862,7 @@ GUI:ZoomToCursor
END
TOOLTIP:ZoomToCursor
-"The wheel zooms towards whatever the cursor is over instead of the middle of the screen. Modern controls only."
+"The wheel zooms towards whatever the cursor is over instead of the middle of the screen."
END
GUI:StartAtMaxZoom
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index bd4747e02..0d3d8527a 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15350,7 +15350,7 @@ GUI:ZoomToCursor
END
TOOLTIP:ZoomToCursor
-"Tekerlek, ekranın ortası yerine imlecin üzerinde durduğu yere doğru yakınlaştırır. Yalnızca Modern kontrollerde."
+"Tekerlek, ekranın ortası yerine imlecin üzerinde durduğu yere doğru yakınlaştırır."
END
GUI:StartAtMaxZoom
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index 7975ea9f6..ca8c0d11c 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -7049,6 +7049,53 @@ WINDOW
WINDOW
WINDOWTYPE = CHECKBOX;
SCREENRECT = UPPERLEFT: 40 266, BOTTOMRIGHT: 264 290, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:CheckZoomToCursor";
+ STATUS = ENABLED+IMAGE+BORDER;
+ STYLE = CHECKBOX+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPTEXT = "TOOLTIP:ZoomToCursor";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:ZoomToCursor";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = CHECKBOX;
+ SCREENRECT = UPPERLEFT: 40 294, BOTTOMRIGHT: 264 318, CREATIONRESOLUTION: 800 600;
NAME = "OptionsMenu.wnd:CheckStartAtMaxZoom";
STATUS = ENABLED+IMAGE+BORDER;
STYLE = CHECKBOX+MOUSETRACK;
@@ -7095,7 +7142,7 @@ WINDOW
CHILD
WINDOW
WINDOWTYPE = CHECKBOX;
- SCREENRECT = UPPERLEFT: 40 294, BOTTOMRIGHT: 264 318, CREATIONRESOLUTION: 800 600;
+ SCREENRECT = UPPERLEFT: 40 322, BOTTOMRIGHT: 264 346, CREATIONRESOLUTION: 800 600;
NAME = "OptionsMenu.wnd:CheckSnapCamera45";
STATUS = ENABLED+IMAGE+BORDER;
STYLE = CHECKBOX+MOUSETRACK;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 010356e93..7126a2982 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1148,7 +1148,7 @@ GlobalData::GlobalData()
m_cameraBoundaryMargin = 200;
m_edgeScrollInWindowedMode = TRUE;
m_snapCameraRotateTo45 = FALSE;
- m_zoomToCursor = TRUE;
+ m_zoomToCursor = FALSE; // the wheel zooms on the middle of the screen, as 1.04 did, until ticked
m_isometricCamera = FALSE;
// R1, smooth motion: the picture only, one logic tick behind, and never the game (W3DSmoothMotion.h).
// On by default off Windows, where 120 and 144 Hz panels are the common case; Windows keeps its
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
index 4ee58d11b..67cb89b98 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -264,8 +264,10 @@ const OptionDef TheOptionCatalog[] =
// MiddleMousePans used to sit here. There is nothing left to choose: a right drag pans and a
// middle drag turns the camera.
- // Back on Options > Controls: players split on whether the wheel should chase the cursor.
- { "ZoomToCursor", OPT_WND( "CheckZoomToCursor" ), "GUI:ZoomToCursor",
+ // On Options > Controls in both interfaces, off until ticked: players split on whether the wheel
+ // should chase the cursor. A new key for the snaps' reason above: ZoomToCursor is a "yes" in
+ // every Options.ini saved while it defaulted on.
+ { "WheelZoomToCursor", OPT_WND( "CheckZoomToCursor" ), "GUI:ZoomToCursor",
OPTION_BOOL, APPLY_LIVE, 0, 1,
get_m_zoomToCursor, set_m_zoomToCursor },
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
index bb0fd7433..6bda188bc 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp
@@ -507,7 +507,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
// 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 && !classic && TheInGameUI->getInputEnabled())
+ if (TheGlobalData->m_zoomToCursor && TheInGameUI->getInputEnabled())
TheTacticalView->anchorZoomAt( &msg->getArgument( 0 )->pixel );
// Ctrl+wheel with nothing to place crosses the zoom range in three notches instead of
diff --git a/GeneralsMD/Code/Tests/test_camera_behavior.inc b/GeneralsMD/Code/Tests/test_camera_behavior.inc
index b9c7a80ee..c3a74ad9b 100644
--- a/GeneralsMD/Code/Tests/test_camera_behavior.inc
+++ b/GeneralsMD/Code/Tests/test_camera_behavior.inc
@@ -209,7 +209,7 @@ TEST(camera_margin_preferences_load_and_rebuild_constraints)
TEST(camera_wheel_anchors_zoom_to_cursor_only_with_the_box_ticked)
{
// Pull request 5 asked for zoom to cursor to go; it stayed as a menu box instead.
- const OptionDef *def = findOptionDef("ZoomToCursor");
+ const OptionDef *def = findOptionDef("WheelZoomToCursor");
CHECK(def != NULL);
if (def == NULL)
return;
@@ -229,21 +229,24 @@ TEST(camera_wheel_anchors_zoom_to_cursor_only_with_the_box_ticked)
message->deleteInstance();
};
- CHECK(f.global->m_zoomToCursor);
+ // off by default: the wheel zooms on the middle of the screen, as the game shipped
+ CHECK(!f.global->m_zoomToCursor);
spinWheel();
- CHECK_EQ(f.view.zoomAnchors, 1);
- CHECK_EQ(f.view.zoomAnchor.x, cursor.x);
- CHECK_EQ(f.view.zoomAnchor.y, cursor.y);
+ CHECK_EQ(f.view.zoomAnchors, 0);
- f.global->m_zoomToCursor = FALSE;
+ f.global->m_zoomToCursor = TRUE;
spinWheel();
CHECK_EQ(f.view.zoomAnchors, 1);
+ CHECK_EQ(f.view.zoomAnchor.x, cursor.x);
+ CHECK_EQ(f.view.zoomAnchor.y, cursor.y);
- // Classic zooms on the screen's middle whatever the box says, as the game shipped
- f.global->m_zoomToCursor = TRUE;
+ // Classic honours the box too
f.global->m_interfaceStyle = INTERFACE_STYLE_CLASSIC;
spinWheel();
- CHECK_EQ(f.view.zoomAnchors, 1);
+ CHECK_EQ(f.view.zoomAnchors, 2);
+ f.global->m_zoomToCursor = FALSE;
+ spinWheel();
+ CHECK_EQ(f.view.zoomAnchors, 2);
}
TEST(ctrl_wheel_zooms_five_notches_for_one)
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index e30bfd567..29b887fa5 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -12715,7 +12715,8 @@ TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog)
keys of their own: the old ones are a "yes" in every Options.ini saved while they defaulted on. */
static const char *const menu[] =
{
- "CameraSnapTo45", "BuildGrid", "BuildSnapTo45", "BuildSnapToNeighbour", "OpenAtMaxZoom", NULL
+ "CameraSnapTo45", "BuildGrid", "BuildSnapTo45", "BuildSnapToNeighbour", "OpenAtMaxZoom",
+ "WheelZoomToCursor", NULL
};
for( Int i = 0; menu[ i ] != NULL; ++i )
{
@@ -12729,7 +12730,8 @@ TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog)
}
static const char *const retired[] =
{
- "SnapCameraRotateTo45", "GridBuildPlacement", "SnapBuildPlacementTo45", "StartAtMaxZoom", NULL
+ "SnapCameraRotateTo45", "GridBuildPlacement", "SnapBuildPlacementTo45", "StartAtMaxZoom",
+ "ZoomToCursor", NULL
};
for( Int i = 0; retired[ i ] != NULL; ++i )
CHECK( findOptionDef( retired[ i ] ) == NULL );
@@ -12752,7 +12754,7 @@ TEST(an_options_ini_naming_the_removed_input_scheme_and_wasd_keys_still_loads)
TheWritableGlobalData = scratch;
const OptionDef *orderLines = findOptionDef( "OrderLines" );
- const OptionDef *zoom = findOptionDef( "ZoomToCursor" );
+ const OptionDef *zoom = findOptionDef( "WheelZoomToCursor" );
CHECK( orderLines != NULL && zoom != NULL );
orderLines->set( 1 );
zoom->set( 1 );
@@ -12761,7 +12763,7 @@ TEST(an_options_ini_naming_the_removed_input_scheme_and_wasd_keys_still_loads)
pref[ AsciiString( "InputScheme" ) ] = AsciiString( "1" );
pref[ AsciiString( "WasdCamera" ) ] = AsciiString( "yes" );
pref[ AsciiString( "OrderLines" ) ] = AsciiString( "no" );
- pref[ AsciiString( "ZoomToCursor" ) ] = AsciiString( "no" );
+ pref[ AsciiString( "WheelZoomToCursor" ) ] = AsciiString( "no" );
loadOptionsFromPreferences( pref );
CHECK_EQ( orderLines->get(), 0 );
@@ -12844,30 +12846,30 @@ TEST(option_catalog_writes_bools_as_yes_and_no)
TheWritableGlobalData = scratch;
UserPreferences pref;
- const OptionDef *zoom = findOptionDef( "ZoomToCursor" );
+ const OptionDef *zoom = findOptionDef( "WheelZoomToCursor" );
CHECK( zoom != NULL );
zoom->set( 1 );
saveOptionsToPreferences( pref );
- CHECK_STR( pref[ AsciiString( "ZoomToCursor" ) ].str(), "yes" );
+ CHECK_STR( pref[ AsciiString( "WheelZoomToCursor" ) ].str(), "yes" );
zoom->set( 0 );
saveOptionsToPreferences( pref );
- CHECK_STR( pref[ AsciiString( "ZoomToCursor" ) ].str(), "no" );
+ CHECK_STR( pref[ AsciiString( "WheelZoomToCursor" ) ].str(), "no" );
/* Reading is deliberately more forgiving than writing. The getters this replaces accepted the
single string "yes", so a file hand-edited to "true" read as off - which looks like the
setting not working rather than like the file being spelled wrong. */
- pref[ AsciiString( "ZoomToCursor" ) ] = AsciiString( "true" );
+ pref[ AsciiString( "WheelZoomToCursor" ) ] = AsciiString( "true" );
loadOptionsFromPreferences( pref );
CHECK_EQ( zoom->get(), 1 );
zoom->set( 0 );
- pref[ AsciiString( "ZoomToCursor" ) ] = AsciiString( "1" );
+ pref[ AsciiString( "WheelZoomToCursor" ) ] = AsciiString( "1" );
loadOptionsFromPreferences( pref );
CHECK_EQ( zoom->get(), 1 );
- pref[ AsciiString( "ZoomToCursor" ) ] = AsciiString( "no" );
+ pref[ AsciiString( "WheelZoomToCursor" ) ] = AsciiString( "no" );
loadOptionsFromPreferences( pref );
CHECK_EQ( zoom->get(), 0 );
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index d47a6b3b5..666c19a0a 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -343,16 +343,15 @@ GROUP_LAYOUT = [
]
# Settings the Classic interface overrules whatever Options.ini says, each behind an isClassicUI()
-# gate where the value is read: smooth motion (W3DDisplay.cpp), zoom to cursor (LookAtXlat.cpp), the
-# HUD scale (ControlBar.cpp), the corner net box (InGameUI.cpp, no HTML pages in Classic), the income
-# beside the money (InGameUI.cpp), health bar mode and empty garrison pips (Drawable.cpp) and order
-# lines (W3DInGameUI.cpp). Every one is a catalog row, whose menu passes skip a control the layout
-# does not carry, so the Classic layout leaves them out and keeps the value. The opening zoom, the
-# camera's 45 degree steps and the three placement snaps are not here: they start off, which is how
-# 1.04 played, and Classic honours them once ticked.
+# gate where the value is read: smooth motion (W3DDisplay.cpp), the HUD scale (ControlBar.cpp), the
+# corner net box (InGameUI.cpp, no HTML pages in Classic), the income beside the money (InGameUI.cpp),
+# health bar mode and empty garrison pips (Drawable.cpp) and order lines (W3DInGameUI.cpp). Every one
+# is a catalog row, whose menu passes skip a control the layout does not carry, so the Classic layout
+# leaves them out and keeps the value. Zoom to cursor, the opening zoom, the camera's 45 degree steps
+# and the three placement snaps are not here: they start off, which is how 1.04 played, and Classic
+# honours them once ticked.
REFORGED_ONLY = [
- "CheckSmoothMotion", "CheckZoomToCursor", "ComboBoxHudScale", "CheckNetBox", "ComboBoxIncomeRate",
- "CheckOrderLines",
+ "CheckSmoothMotion", "ComboBoxHudScale", "CheckNetBox", "ComboBoxIncomeRate", "CheckOrderLines",
]