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): eighteen-button command grid for mods that need it

Olcay Seygan7cf73858c5e3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9264e2dbf..c7d0effc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -297,6 +297,7 @@ found and fixed, EA's own, not port damage.**
- No empty slots in a mod general's power tray. Mods give unrelated powers the same few types, Contra's small Scud Storm counting as a carpet bomb, so a Contra Cybernetic player's tray picked up another faction's button for a power he only held one of the same type as, then hid it, and an empty frame stood where it had been. The tray offers a button now only for the very power you hold, and a slot whose button goes away takes its frame with it.
- A Paladin under Contra no longer crashes the game. Reforged gives every Paladin a second laser for infantry, and that laser borrowed a Zero Hour weapon nothing else fires. Contra deleted it, so the laser had no gun, and the game went down a moment after the first Paladin rolled out. The laser is Reforged's own weapon now and is there whatever mod you load. The same kind of gap took the guns off Contra's Toxin Tunnel Defender and Toxin Stinger soldier, the Chemical Suits off its Rangers, and the death blast off its Demolition Scud Launcher, Toxin demo trap and Toxin Tractors (ShockWave's trap too). Where Reforged names a weapon or armour the mod dropped, the unit now keeps the mod's own, and the death blasts carry Zero Hour's charge.
- Contra's units have their attack move, guard and stop buttons again, and A, G and S press them. Contra draws its command bar with eighteen buttons and keeps those three in the last row, which our fourteen-button bar does not have, so they went missing on every Contra unit, the Cybernetic general's cyborgs among them. A button a mod puts past the end of our bar now moves to an empty one, the three orders to the places Zero Hour gives them.
+- A mod with more than fourteen buttons on one unit or building gets all eighteen. The command bar grows a column at each end, nine across and two down, numbered the way Contra's own bar numbers them, and the steel plate behind it grows with it in your side's own paint, rail and toolbar buttons included. Before, there were only fourteen windows to move buttons into, so a set of sixteen lost two without a word. Without such a mod, or with a mod that brings a bar of its own, the bar is the fourteen-button one it always was. The nine-column layout follows Hojjat's edit of ControlBar Pro for Contra.
- Contra's Laser Turret draws its beam at aircraft again, and a Contra Toxin General can buy his Rebel Ambush without the game going down. Reforged's fixes for those two named a beam and an ambush of Zero Hour's own that Contra does not have, so the turret shot an invisible beam, and the moment the ambush was bought its button had no power behind it and the game crashed. Now the promotion screen sells it and the powers bar fires it: gas-masked rebels climb out of the ground where you click. Where a Reforged fix names a beam, a power, a science or a spawn list the mod lacks, the mod's own now stays.
- Contra's cyborgs no longer stand on black squares. Their little ground shadow is drawn the way Zero Hour draws it again, darkening the ground by the shape painted in the picture, so it comes out as a soft patch under the feet. We had been reading the shape from the picture's transparency instead, and Contra's shadow picture has none: it filled its whole square. Zero Hour's own shadows look as they did.
- A computer opponent on ShockWave's Armor, Special Weapons or Salvage general plays on every map now. Those are the three generals ShockWave adds to Zero Hour's nine, and Shockwave Chaos renames two of them the Scumbag Artillery and Bandana generals. A map made before they existed, every one Zero Hour ships among them, has no computer player for them, so the seat started with no AI at all: its base sat idle, and clicking it with nothing selected handed it to you, which is how a player found himself running the enemy's base. The seat now takes the mod's skirmish AI for that general and builds like any other; on Tournament Desert it had three buildings up in forty seconds where it used to have none.
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index 7cf657e7f..7273e15d9 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -16,13 +16,16 @@ Data/Art/Textures/ReforgedBarGLALeft.tga
Data/Art/Textures/ReforgedBarGLARight.tga
Data/Art/Textures/ReforgedForceAttack.tga
Data/Art/Textures/ReforgedHudAmericaCommandBar.dds
+Data/Art/Textures/ReforgedHudAmericaCommandBarWide.dds
Data/Art/Textures/ReforgedHudAmericaPowers.dds
Data/Art/Textures/ReforgedHudBlankTexture.tga
Data/Art/Textures/ReforgedHudChinaCommandBar.dds
+Data/Art/Textures/ReforgedHudChinaCommandBarWide.dds
Data/Art/Textures/ReforgedHudChinaPowers.dds
Data/Art/Textures/ReforgedHudControlButtons.dds
Data/Art/Textures/ReforgedHudDisconnectWindow.dds
Data/Art/Textures/ReforgedHudGlaCommandBar.dds
+Data/Art/Textures/ReforgedHudGlaCommandBarWide.dds
Data/Art/Textures/ReforgedHudGlaPowers.dds
Data/Art/Textures/ReforgedHudHelpbox.dds
Data/Art/Textures/ReforgedHudObsCommandBar.dds
@@ -4263,6 +4266,7 @@ Tools/versionUpdate/versionUpdate.dsp
Tools/vfx_tune.py
Tools/water_grid_oracle_extract.py
Tools/water_preview.cpp
+Tools/wide_command_bar.py
Tools/widechar_check.py
Tools/widechar_check_allow.txt
Tools/windows_view_diff.py
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedHudAmericaCommandBarWide.dds b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudAmericaCommandBarWide.dds
new file mode 100644
index 000000000..987789987
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudAmericaCommandBarWide.dds differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedHudChinaCommandBarWide.dds b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudChinaCommandBarWide.dds
new file mode 100644
index 000000000..a5e71c1ad
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudChinaCommandBarWide.dds differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedHudGlaCommandBarWide.dds b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudGlaCommandBarWide.dds
new file mode 100644
index 000000000..5f7257018
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedHudGlaCommandBarWide.dds differ
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudAmericaCommandBar.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudAmericaCommandBar.ini
index 2856c3c85..79ac5803a 100644
--- a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudAmericaCommandBar.ini
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudAmericaCommandBar.ini
@@ -5,3 +5,13 @@ MappedImage AmericaProCommandBar
Coords = Left:0 Top:0 Right:1920 Bottom:512
Status = NONE
End
+
+; the same plate two command columns wider, for a mod whose sets fill all eighteen slots
+; (Tools/wide_command_bar.py, ControlBar_needsWideCommandGrid)
+MappedImage AmericaProCommandBarWide
+ Texture = ReforgedHudAmericaCommandBarWide.tga
+ TextureWidth = 2048
+ TextureHeight = 512
+ Coords = Left:0 Top:0 Right:1920 Bottom:512
+ Status = NONE
+End
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudChinaCommandBar.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudChinaCommandBar.ini
index 6b951faea..0c73a21eb 100644
--- a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudChinaCommandBar.ini
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudChinaCommandBar.ini
@@ -5,3 +5,13 @@ MappedImage ChinaProCommandBar
Coords = Left:0 Top:0 Right:1920 Bottom:512
Status = NONE
End
+
+; the same plate two command columns wider, for a mod whose sets fill all eighteen slots
+; (Tools/wide_command_bar.py, ControlBar_needsWideCommandGrid)
+MappedImage ChinaProCommandBarWide
+ Texture = ReforgedHudChinaCommandBarWide.tga
+ TextureWidth = 2048
+ TextureHeight = 512
+ Coords = Left:0 Top:0 Right:1920 Bottom:512
+ Status = NONE
+End
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudGlaCommandBar.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudGlaCommandBar.ini
index 54083052e..e9809d22f 100644
--- a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudGlaCommandBar.ini
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedHudGlaCommandBar.ini
@@ -5,3 +5,13 @@ MappedImage GlaProCommandBar
Coords = Left:0 Top:0 Right:1920 Bottom:512
Status = NONE
End
+
+; the same plate two command columns wider, for a mod whose sets fill all eighteen slots
+; (Tools/wide_command_bar.py, ControlBar_needsWideCommandGrid)
+MappedImage GlaProCommandBarWide
+ Texture = ReforgedHudGlaCommandBarWide.tga
+ TextureWidth = 2048
+ TextureHeight = 512
+ Coords = Left:0 Top:0 Right:1920 Bottom:512
+ Status = NONE
+End
diff --git a/GeneralsMD/Code/Data/Window/ControlBar.wnd b/GeneralsMD/Code/Data/Window/ControlBar.wnd
index bc61f40a7..1bf10ac25 100644
--- a/GeneralsMD/Code/Data/Window/ControlBar.wnd
+++ b/GeneralsMD/Code/Data/Window/ControlBar.wnd
@@ -558,6 +558,194 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
CHILD
+ WINDOW
+ WINDOWTYPE = PUSHBUTTON;
+ SCREENRECT = UPPERLEFT: 1404 1000,
+ BOTTOMRIGHT: 1492 1070,
+ CREATIONRESOLUTION: 1920 1080;
+ NAME = "ControlBar.wnd:ButtonCommand18";
+ STATUS = ENABLED+HIDDEN+IMAGE+NOFOCUS+WRAP_CENTERED+ON_MOUSE_DOWN;
+ STYLE = PUSHBUTTON+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 8, BOLD: 0;
+ HEADERTEMPLATE = "[NONE]";
+ TOOLTIPDELAY = 1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = PUSHBUTTON;
+ SCREENRECT = UPPERLEFT: 1404 926,
+ BOTTOMRIGHT: 1492 996,
+ CREATIONRESOLUTION: 1920 1080;
+ NAME = "ControlBar.wnd:ButtonCommand17";
+ STATUS = ENABLED+HIDDEN+IMAGE+NOFOCUS+WRAP_CENTERED+ON_MOUSE_DOWN;
+ STYLE = PUSHBUTTON+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 8, BOLD: 0;
+ HEADERTEMPLATE = "[NONE]";
+ TOOLTIPDELAY = 1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = PUSHBUTTON;
+ SCREENRECT = UPPERLEFT: 1312 1000,
+ BOTTOMRIGHT: 1400 1070,
+ CREATIONRESOLUTION: 1920 1080;
+ NAME = "ControlBar.wnd:ButtonCommand16";
+ STATUS = ENABLED+HIDDEN+IMAGE+NOFOCUS+WRAP_CENTERED+ON_MOUSE_DOWN;
+ STYLE = PUSHBUTTON+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 8, BOLD: 0;
+ HEADERTEMPLATE = "[NONE]";
+ TOOLTIPDELAY = 1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = PUSHBUTTON;
+ SCREENRECT = UPPERLEFT: 1312 926,
+ BOTTOMRIGHT: 1400 996,
+ CREATIONRESOLUTION: 1920 1080;
+ NAME = "ControlBar.wnd:ButtonCommand15";
+ STATUS = ENABLED+HIDDEN+IMAGE+NOFOCUS+WRAP_CENTERED+ON_MOUSE_DOWN;
+ STYLE = PUSHBUTTON+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 8, BOLD: 0;
+ HEADERTEMPLATE = "[NONE]";
+ TOOLTIPDELAY = 1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ END
+ CHILD
WINDOW
WINDOWTYPE = PUSHBUTTON;
SCREENRECT = UPPERLEFT: 1220 1000,
diff --git a/GeneralsMD/Code/Data/Window/ControlBarPro.txt b/GeneralsMD/Code/Data/Window/ControlBarPro.txt
index 83fd81954..15fc92026 100644
--- a/GeneralsMD/Code/Data/Window/ControlBarPro.txt
+++ b/GeneralsMD/Code/Data/Window/ControlBarPro.txt
@@ -34,3 +34,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
+EIGHTEEN-BUTTON GRID:
+The nine-column command grid a mod with eighteen command slots gets (ButtonCommand15
+to 18, and the wider middle plate) follows Hojjat's edit of Control Bar Pro 2.1.1 for
+the Contra mod, under the same MIT License. The plate itself is cut from this bar's
+own art (Tools/wide_command_bar.py).
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h b/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
index eb61f5955..3b1306ecd 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
@@ -61,6 +61,7 @@ public:
const CommandButton *getCommandButtons( void ) { return m_commandButtons; }
CommandButton *friend_getCommandButtons( void ) { return m_commandButtons; } ///< for ControlBar::postProcessCommands' image cache
+ CommandSet *friend_getCommandSets( void ) { return m_commandSets; } ///< for ControlBar::initWindows' count of slots
static void parseCommandButtonDefinition( INI *ini );
static void parseCommandSetDefinition( INI *ini );
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 4f63e4d6b..1fd655a42 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -513,6 +513,18 @@ Bool ControlBar_commandPlaces( const Int *types, const Int *groups, const Int *p
* when free, anything else to the first empty one. */
void ControlBar_fitCommandSlots( const Int *types, const Bool *windowed, Int count, Int *shown );
+enum
+{
+ COMMAND_GRID_NARROW_SLOTS = 14, ///< ButtonCommand01 to 14, the bar every set of Zero Hour's fits
+ COMMAND_GRID_WIDE_STEP = 92, ///< one column of two cells, at the 1920x1080 the bar was drawn at
+};
+
+/** TRUE when one command set, `types` as ControlBar_fitCommandSlots takes them, shows more buttons
+ * than the fourteen-slot grid has windows for, so ControlBar_fitCommandSlots would have to drop
+ * some: a mod drawn for ControlBar Pro's eighteen (Contra's edit). A promotion screen's set, the
+ * only one of Zero Hour's with a slot past 14, is laid out on its own screen and never counts. */
+Bool ControlBar_needsWideCommandGrid( const Int *types, Int count );
+
/** Slot 12 (0-based 11) when the set already has Attack Move and that hole is empty: left of Stop,
* under Attack Move. An object ControlBar_forceFires names takes 12 too, or 11 above it when 12 is
* taken (Gattling Cannon's mines, Stinger Site's camo net, Fire Base's Sell). -1 when neither
@@ -1056,6 +1068,11 @@ public:
* set - because it remembers both the authored rectangle and the one it last handed out. */
void layoutPanels( void );
+ /** TRUE when the loaded command sets need all eighteen command windows and our ControlBar.wnd
+ * is the layout: the grid is then nine columns, one more at each end of the plate, and the
+ * scheme draws its painting's <name>Wide copy. Fixed when the windows are looked up. */
+ Bool isCommandGridWide( void ) const { return m_commandGridWide; }
+
/// top edge of the highest visible window the bar owns, and where MoneyDisplay is; see -uidrill
void forEachPlacedWindow( Int *topOut, Int *moneyOut );
ControlBarContext getCurrentContext( void ) const { return m_currContext; } ///< for -uidrill's log
@@ -1222,6 +1239,7 @@ protected:
IRegion2D m_panelRect[ CB_PANEL_COUNT ]; ///< screen rect of each panel, filled by layoutPanels()
ICoord2D m_panelOrigin; ///< where the frame was put, so the plates can follow it
+ Bool m_commandGridWide; ///< see isCommandGridWide
Bool m_UIDirty; ///< the context UI must be re-evaluated
ControlBarSchemeManager *m_controlBarSchemeManager; ///< The Scheme singleton
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
index 6cbee11ea..c6574f307 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
@@ -81,6 +81,7 @@ public:
ICoord2D m_position; ///< the position we'll draw it at
ICoord2D m_size; ///< the size of the image needed when we draw it
Image *m_image; ///< the actual pointer to the mapped image
+ const Image *m_wideImage; ///< "<image>Wide", drawn while the command grid is eighteen windows wide; NULL when none is mapped
// m_layer is where the image will get drawn, everything in layer 0-2 gets drawn during the forground draw
// the layers 3-5 gets drawn during the background draw
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index cc941f27c..d113e95d9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -472,6 +472,19 @@ void ControlBar_fitCommandSlots( const Int *types, const Bool *windowed, Int cou
}
}
+//-------------------------------------------------------------------------------------------------
+Bool ControlBar_needsWideCommandGrid( const Int *types, Int count )
+{
+ Int buttons = 0;
+ for( Int slot = 0; slot < count; slot++ )
+ {
+ if( types[ slot ] == GUI_COMMAND_PURCHASE_SCIENCE )
+ return FALSE;
+ buttons += types[ slot ] != GUI_COMMAND_NONE ? 1 : 0;
+ }
+ return buttons > COMMAND_GRID_NARROW_SLOTS;
+}
+
//-------------------------------------------------------------------------------------------------
Int ControlBar_forceAttackSlot( const Int *types, Int count, Bool forceFires )
{
@@ -1599,6 +1612,7 @@ ControlBar::ControlBar( void )
{
Int i;
m_controlBarSchemeManager = NULL;
+ m_commandGridWide = FALSE;
m_isObserverCommandBar = FALSE;
m_observerLookAtPlayer = NULL;
m_watchedSelection = NULL;
@@ -2684,6 +2698,49 @@ void ControlBar::shutdownWindows( void )
} // end shutdownWindows
+//-------------------------------------------------------------------------------------------------
+/** Widen 'win' by 'step' pixels at both ends. Its children stay where they stood on screen, or with
+ * 'carryChildren' move left with its left edge. */
+//-------------------------------------------------------------------------------------------------
+static void growSideways( GameWindow *win, Int step, Bool carryChildren )
+{
+ if( win == NULL )
+ return;
+ Int x, y, w, h;
+ win->winGetPosition( &x, &y );
+ win->winGetSize( &w, &h );
+ win->winSetPosition( x - step, y );
+ win->winSetSize( w + 2 * step, h );
+ if( carryChildren )
+ return;
+ for( GameWindow *child = win->winGetChild(); child; child = child->winGetNext() )
+ {
+ child->winGetPosition( &x, &y );
+ child->winSetPosition( x + step, y );
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The first loaded command set the fourteen-window grid cannot hold (ControlBar_needsWideCommandGrid),
+ * NULL when it holds them all. Every Zero Hour set fits, Reforged's and Turkiye's too. */
+//-------------------------------------------------------------------------------------------------
+static const CommandSet *commandSetPastNarrowGrid( void )
+{
+ for( CommandSet *each = TheCommandStore->friend_getCommandSets(); each; each = each->friend_getNext() )
+ {
+ const CommandSet *set = (const CommandSet *)each->friend_getFinalOverride();
+ Int types[ MAX_COMMANDS_PER_SET ];
+ for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ )
+ {
+ const CommandButton *button = set->getCommandButton( i );
+ types[ i ] = ( button && !BitTest( button->getOptions(), SCRIPT_ONLY ) ) ? button->getCommandType() : GUI_COMMAND_NONE;
+ }
+ if( ControlBar_needsWideCommandGrid( types, MAX_COMMANDS_PER_SET ) )
+ return set;
+ }
+ return NULL;
+}
+
//-------------------------------------------------------------------------------------------------
/** Look up every window the bar drives, and lay the bar out. Re-callable: a resolution change
* rebuilds ControlBar.wnd and then calls this instead of replacing the whole ControlBar. */
@@ -2695,13 +2752,59 @@ void ControlBar::initWindows( void )
//
// the control bar has several windows that make up our context sensitive interface, we
- // want those parent windows so that we can easily hide and show them to make the
+ // want those parent windows so that we can easily hide and show them to make the
// interface context sensitive
//
NameKeyType id;
id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" );
m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( NULL, id );
+ //
+ // A mod whose sets hold more than fourteen buttons gets all eighteen windows, nine columns
+ // of two, the plate one column longer at each end the way Contra's edit of ControlBar Pro
+ // draws it. Our layout keeps ButtonCommand15 to 18 hidden past the plate's right end, one
+ // and two columns on, so moving the whole grid a column left and widening what frames it puts
+ // 01 to 18 down the columns from the new left end. This is done in the loader's own
+ // stretched space before layoutPanels reads the authored rectangles, so the wide grid is the
+ // one it remembers. A mod's own ControlBar.wnd keeps its grid as it drew it: its button 15
+ // stands inside its CommandWindow.
+ //
+ m_commandGridWide = FALSE;
+ Bool spareWindows = FALSE;
+ {
+ GameWindow *grid = barWindow( "ControlBar.wnd:CommandWindow" );
+ GameWindow *first = barWindow( "ControlBar.wnd:ButtonCommand01" );
+ GameWindow *third = barWindow( "ControlBar.wnd:ButtonCommand03" );
+ GameWindow *spare = barWindow( "ControlBar.wnd:ButtonCommand15" );
+ if( grid && first && third && spare )
+ {
+ ICoord2D gridAt, gridSize, firstAt, thirdAt, spareAt, spareSize;
+ grid->winGetScreenPosition( &gridAt.x, &gridAt.y );
+ grid->winGetSize( &gridSize.x, &gridSize.y );
+ first->winGetScreenPosition( &firstAt.x, &firstAt.y );
+ third->winGetScreenPosition( &thirdAt.x, &thirdAt.y );
+ spare->winGetScreenPosition( &spareAt.x, &spareAt.y );
+ spare->winGetSize( &spareSize.x, &spareSize.y );
+ spareWindows = spareAt.x + spareSize.x > gridAt.x + gridSize.x;
+ const CommandSet *wideSet = spareWindows ? commandSetPastNarrowGrid() : NULL;
+ if( wideSet )
+ {
+ m_commandGridWide = TRUE;
+ const Int step = thirdAt.x - firstAt.x;
+ growSideways( grid, step, TRUE );
+ growSideways( barWindow( "ControlBar.wnd:ControlBarProBlockInputProduction" ), step, TRUE );
+ growSideways( barWindow( "ControlBar.wnd:UnderConstructionWindow" ), step, FALSE );
+ growSideways( barWindow( "ControlBar.wnd:OCLTimerWindow" ), step, FALSE );
+ growSideways( barWindow( "ControlBar.wnd:BeaconWindow" ), step, FALSE );
+ growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayConstruction" ), step, TRUE );
+ growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayOCLTimer" ), step, TRUE );
+ growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayBeacon" ), step, TRUE );
+ growSideways( barWindow( "ControlBar.wnd:ControlBarProBlockInputBeacon" ), step, TRUE );
+ DEBUG_LOG(( "COMMANDGRID: eighteen windows, %s holds more than fourteen buttons\n", wideSet->getName().str() ));
+ }
+ }
+ }
+
//
// These windows are new, so anything remembered about the last set of them is about
// addresses that may well have been handed back out. Re-anchor the bar as three uniformly
@@ -2786,11 +2889,20 @@ void ControlBar::initWindows( void )
// // set the size and position to make sure their in the same place as the buttons.
// m_commandMarkers[i]->winSetPosition(commandPos.x -2, commandPos.y - 2);
// m_commandMarkers[i]->winSetSize(commandSize.x + 2, commandSize.y + 2);
-
+
} // end for i
+ // the narrow grid leaves our spare four hidden and out of the bar's reach, the bar it always was
+ if( spareWindows && !m_commandGridWide )
+ for( i = COMMAND_GRID_NARROW_SLOTS; i < MAX_COMMANDS_PER_SET; i++ )
+ m_commandWindows[ i ] = NULL;
+ Int windowCount = 0;
+ for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
+ windowCount += m_commandWindows[ i ] ? 1 : 0;
+ DEBUG_LOG(( "COMMANDGRID: %d command windows, %s\n", windowCount, m_commandGridWide ? "nine columns" : "as laid out" ));
+
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
index fd6d8f158..ea8a1070f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
@@ -189,6 +189,7 @@ ControlBarSchemeImage::ControlBarSchemeImage( void )
m_position.x = m_position.y = 0;
m_size.x = m_size.y = 0;
m_image = NULL;
+ m_wideImage = NULL;
m_layer = 0;
}
@@ -478,6 +479,44 @@ void ControlBarScheme::init(void)
resMultiplier.x = TheDisplay->getWidth()/INT_TO_REAL(m_ScreenCreationRes.x) ;
resMultiplier.y = TheDisplay->getHeight()/INT_TO_REAL(m_ScreenCreationRes.y);
+ //
+ // The eighteen-window grid (ControlBar::isCommandGridWide) stands on a plate one command column
+ // longer at each end: the painting's "<name>Wide" copy (Tools/wide_command_bar.py). The toolbar
+ // column moves out with the left end and the power rail runs the plate's new length. A scheme
+ // whose painting has no wide copy, a mod's own, keeps its windows where it put them.
+ //
+ Bool wideCopy = FALSE;
+ for( Int layer = 0; layer < MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS; layer++ )
+ {
+ for( ControlBarSchemeImageList::iterator it = m_layer[ layer ].begin(); it != m_layer[ layer ].end(); ++it )
+ {
+ ControlBarSchemeImage *schemeImage = *it;
+ schemeImage->m_wideImage = NULL;
+ if( schemeImage->m_image && TheMappedImageCollection )
+ {
+ AsciiString wideName = schemeImage->m_image->getName();
+ wideName.concat( "Wide" );
+ schemeImage->m_wideImage = TheMappedImageCollection->findImageByName( wideName );
+ }
+ wideCopy = wideCopy || schemeImage->m_wideImage != NULL;
+ }
+ }
+ const Int wideStep = ( wideCopy && TheControlBar && TheControlBar->isCommandGridWide() )
+ ? COMMAND_GRID_WIDE_STEP * m_ScreenCreationRes.x / 1920 : 0;
+ ICoord2D chatUL = m_chatUL, chatLR = m_chatLR, workerUL = m_workerUL, workerLR = m_workerLR;
+ ICoord2D optionsUL = m_optionsUL, optionsLR = m_optionsLR, beaconUL = m_beaconUL, beaconLR = m_beaconLR;
+ ICoord2D powerBarUL = m_powerBarUL, powerBarLR = m_powerBarLR;
+ chatUL.x -= wideStep;
+ chatLR.x -= wideStep;
+ workerUL.x -= wideStep;
+ workerLR.x -= wideStep;
+ optionsUL.x -= wideStep;
+ optionsLR.x -= wideStep;
+ beaconUL.x -= wideStep;
+ beaconLR.x -= wideStep;
+ powerBarUL.x -= wideStep;
+ powerBarLR.x += wideStep;
+
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) );
if(win)
{
@@ -488,7 +527,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_buddyButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_buddyButtonPushed);
GadgetButtonSetDisabledImage(win, m_buddyButtonDisabled);
- placeSchemeWindow( win, m_chatUL, m_chatLR, resMultiplier );
+ placeSchemeWindow( win, chatUL, chatLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) );
if(win)
@@ -497,7 +536,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_idleWorkerButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_idleWorkerButtonPushed);
GadgetButtonSetDisabledImage(win, m_idleWorkerButtonDisabled);
- placeSchemeWindow( win, m_workerUL, m_workerLR, resMultiplier );
+ placeSchemeWindow( win, workerUL, workerLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) );
if(win)
@@ -511,7 +550,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_optionsButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_optionsButtonPushed);
GadgetButtonSetDisabledImage(win, m_optionsButtonDisabled);
- placeSchemeWindow( win, m_optionsUL, m_optionsLR, resMultiplier );
+ placeSchemeWindow( win, optionsUL, optionsLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) );
if(win)
@@ -520,7 +559,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_beaconButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_beaconButtonPushed);
GadgetButtonSetDisabledImage(win, m_beaconButtonDisabled);
- placeSchemeWindow( win, m_beaconUL, m_beaconLR, resMultiplier );
+ placeSchemeWindow( win, beaconUL, beaconLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) );
@@ -529,7 +568,7 @@ void ControlBarScheme::init(void)
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) );
if(win)
- placeSchemeWindow( win, m_powerBarUL, m_powerBarLR, resMultiplier );
+ placeSchemeWindow( win, powerBarUL, powerBarLR, resMultiplier );
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) );
if(win)
@@ -1122,6 +1161,7 @@ void ControlBarSchemeManager::drawPainting( ICoord2D offset, Bool foreground )
const Int last = foreground ? CONTROL_BAR_SCHEME_FOREGROUND_IMAGE_LAYERS : MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS;
const Int width = TheDisplay->getWidth();
const Int height = TheDisplay->getHeight();
+ const Bool wide = TheControlBar && TheControlBar->isCommandGridWide();
for( Int p = 0; p < ControlBar::CB_PANEL_COUNT; p++ )
{
@@ -1152,7 +1192,8 @@ void ControlBarSchemeManager::drawPainting( ICoord2D offset, Bool foreground )
design.hi.x = REAL_TO_INT_CEIL( ( schemeImage->m_position.x + schemeImage->m_size.x ) * toDesignX );
design.hi.y = REAL_TO_INT_CEIL( ( schemeImage->m_position.y + schemeImage->m_size.y ) * toDesignY );
ControlBarPanelDesignToScreen( p, &design, width, height, &rect );
- TheDisplay->drawImage( schemeImage->m_image, rect.lo.x + offset.x, rect.lo.y + offset.y,
+ const Image *image = ( wide && schemeImage->m_wideImage ) ? schemeImage->m_wideImage : schemeImage->m_image;
+ TheDisplay->drawImage( image, rect.lo.x + offset.x, rect.lo.y + offset.y,
rect.hi.x + offset.x, rect.hi.y + offset.y );
}
}
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index c9e59a116..6cac123a8 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -5290,6 +5290,30 @@ TEST(controlbar_mod_slots_past_the_bar_fit_its_windows)
CHECK_EQ( shown[ slot ], humvee[ slot ] != N && slot < WINDOWS ? slot : -1 );
}
+TEST(controlbar_wide_grid_only_for_a_set_past_fourteen)
+{
+ enum { SLOTS = MAX_COMMANDS_PER_SET };
+ const Int N = GUI_COMMAND_NONE, B = GUI_COMMAND_DOZER_CONSTRUCT, P = GUI_COMMAND_PURCHASE_SCIENCE;
+
+ /* Stealth's Arms Dealer: twelve buttons, one of them in 15, which the fourteen windows still hold */
+ const Int armsDealer[ SLOTS ] = { N, B, B, B, B, B, N, B, N, B, B, B, B, B, B, N, N, N };
+ CHECK( !ControlBar_needsWideCommandGrid( armsDealer, SLOTS ) );
+
+ /* a promotion screen's set has its own screen, however many slots it fills */
+ Int science[ SLOTS ];
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ science[ slot ] = P;
+ CHECK( !ControlBar_needsWideCommandGrid( science, SLOTS ) );
+
+ /* fourteen fit, fifteen do not */
+ Int full[ SLOTS ];
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ full[ slot ] = slot < 14 ? B : N;
+ CHECK( !ControlBar_needsWideCommandGrid( full, SLOTS ) );
+ full[ 16 ] = B;
+ CHECK( ControlBar_needsWideCommandGrid( full, SLOTS ) );
+}
+
TEST(controlbar_force_attack_slot_is_under_attack_move)
{
enum { SLOTS = MAX_COMMANDS_PER_SET, WINDOWS = 14 };
diff --git a/GeneralsMD/Code/Tools/wide_command_bar.py b/GeneralsMD/Code/Tools/wide_command_bar.py
new file mode 100644
index 000000000..14bf7b17b
--- /dev/null
+++ b/GeneralsMD/Code/Tools/wide_command_bar.py
@@ -0,0 +1,65 @@
+"""The command bar's middle plate two columns wider, for a mod whose CommandSets fill all eighteen slots.
+
+Our ControlBar Pro painting holds seven columns of two command cells, 92 pixels apart at 1920x1080.
+Contra's edit of ControlBar Pro (Hojjat, after EA, FAS and xezon, MIT) holds nine: the same plate one
+column longer at each end, cells from x 576 to 1400. This makes that plate out of our own art, so each
+side keeps its own steel: everything left of x 708 moves 92 to the left, everything from 1208 on moves
+92 to the right, and the 92 pixels before each cut are painted twice. Both cuts sit where the art
+repeats every 92 pixels (the cells, the rail, the shoulders beside the money box), so the joins do not
+show. Every offset is a multiple of four, so the DXT5 blocks are copied whole and nothing is
+recompressed. Only x 440 to 1476 changes, the middle piece drawPainting cuts out; the radar and the
+selection pieces are the narrow painting's own pixels.
+
+ControlBar::initWindows widens the grid to match (ControlBar_needsWideCommandGrid), and
+ControlBarScheme draws <image>Wide, mapped in ReforgedHud<Side>CommandBar.ini, while it does.
+
+ python Tools/wide_command_bar.py
+ writes Data/Art/Textures/ReforgedHud<Side>CommandBarWide.dds from ReforgedHud<Side>CommandBar.dds
+"""
+import os
+import struct
+
+TEXTURES = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures")
+SIDES = ("America", "China", "Gla")
+STEP = 92 # one command column at 1920x1080
+LEFT_CUT, RIGHT_CUT = 708, 1208
+BAND = (440, 1476) # the middle piece: drawPainting's seams at design 182 and 616, to a block
+HEADER = 128
+BLOCK = 16 # bytes in a DXT5 block of 4x4 texels
+
+
+def source_x(x):
+ if x < LEFT_CUT:
+ return x + STEP
+ if x >= RIGHT_CUT:
+ return x - STEP
+ return x
+
+
+def widen(data):
+ if data[:4] != b"DDS " or data[84:88] != b"DXT5":
+ raise SystemExit("not a DXT5 dds")
+ height, width = struct.unpack("<II", data[12:20])
+ blocks_x = width // 4
+ out = bytearray(data)
+ for by in range(height // 4):
+ row = HEADER + by * blocks_x * BLOCK
+ for bx in range(BAND[0] // 4, BAND[1] // 4):
+ src = row + (source_x(bx * 4) // 4) * BLOCK
+ dst = row + bx * BLOCK
+ out[dst:dst + BLOCK] = data[src:src + BLOCK]
+ return bytes(out)
+
+
+def main():
+ for side in SIDES:
+ with open(os.path.join(TEXTURES, "ReforgedHud%sCommandBar.dds" % side), "rb") as f:
+ data = f.read()
+ path = os.path.join(TEXTURES, "ReforgedHud%sCommandBarWide.dds" % side)
+ with open(path, "wb") as f:
+ f.write(widen(data))
+ print("wrote", os.path.normpath(path))
+
+
+if __name__ == "__main__":
+ main()