Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameclient): Classic interface draws EA's HUD in a centred 4:3 box
Olcay Seyganccdaa692dd43
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3c5bdb543..74574f333 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. The switch is in place now and the Classic side is being put back piece by piece, so for the moment both read the same.+- 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.- 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/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex 4b10407d4..dfb002855 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -348,7 +348,11 @@ public:Int m_hudScale; ///< HUD size step, 0 = 100%; see ControlBarHudScale (client only)Int m_menuLayout; ///< MENU_LAYOUT_STRETCH or MENU_LAYOUT_FIT, for the Menus/ layouts (client only)Int m_interfaceStyle; ///< INTERFACE_STYLE_CLASSIC or INTERFACE_STYLE_REFORGED (client only, never GameLogic)- Bool isClassicUI() const { return m_interfaceStyle == INTERFACE_STYLE_CLASSIC; }+ /// the style this run was started in: the row is APPLY_RESTART, but the options menu writes+ /// m_interfaceStyle on Accept, and half the HUD was already built in the old style by then+ Int m_interfaceStyleInUse;+ void latchInterfaceStyle() { m_interfaceStyleInUse = m_interfaceStyle; } ///< GameEngine::init, after the command line+ Bool isClassicUI() const { return m_interfaceStyleInUse == INTERFACE_STYLE_CLASSIC; }Int m_playerColorScheme; ///< PlayerColorSchemeType: whose colour the client draws (client only)Int m_textLanguage; ///< TextLanguageType: the translation GameText lays over the CSF, read once at startup (client only)Bool m_showOrderLines; ///< draw a line from each selected unit to where it is going, and its queue (client only)diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex 8e746da68..6e43a5470 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -1166,6 +1166,9 @@ public:* solid panel. */void setPageSolids( const std::vector< IRegion2D > *solids, const std::vector< IRegion2D > *holes = NULL );+ /// the radar's under-attack lamp, EA's: the Classic interface keeps it, Reforged hides the window+ void triggerRadarAttackGlow( void );+/** The HUD page's place for the general's powers: the first in `corner`, the bottom left of the* grid, each `cell` big with `gap` between them, a group of SPECIAL_POWER_SHORTCUT_COLS going* up from it as a column and the next group the column right of it, the order the group keys@@ -1519,6 +1522,8 @@ protected:std::vector< IRegion2D > m_pageSolids; ///< what the CSS page drew solid, in screen pixels; see setPageSolidsstd::vector< IRegion2D > m_pageHoles; ///< the page's own buttons, which let their clicks throughBool m_pageSolidsActive; ///< the page is drawing, so m_pageSolids decides clicks and not the plates+ GameWindow *m_radarAttackGlowWindow; ///< WinUAttack, Classic only; NULL in Reforged+ Int m_remainingRadarAttackGlowFrames; ///< logic frames left on the lamp's flashingPlayer *m_watchedSelection; ///< the player the selection last named while watching, NULL for nobodyWindowLayout *m_buildToolTipLayout; ///< The window that will slide on/display tooltipsdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.hindex 5785772ca..e397d5f28 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h@@ -264,6 +264,33 @@ inline Real UIScaleForScreen( Int screenWidth, Int screenHeight )return scale < 1.0f ? 1.0f : scale;}+//-------------------------------------------------------------------------------------------------+/** The Classic interface's box: the 800x600 layouts at one scale, the smaller of the two, centred.+ * On a screen wider than 4:3 it is the full height with the world showing down both sides; at+ * 4:3 it is the screen. This is the rectangle parseScreenRect fits a layout into, except on a+ * screen taller than 4:3 (1280x1024), where it stands on the bottom edge as the command bar does+ * and the fitted dialogs stay centred. */+//-------------------------------------------------------------------------------------------------+struct UIRect { Int x, y, w, h; };++inline UIRect UIRectForScreen( Int screenWidth, Int screenHeight )+{+ UIRect r = { 0, 0, screenWidth, screenHeight };+ if( screenWidth <= 0 || screenHeight <= 0 )+ return r;+ Real scale = screenWidth / 800.0f;+ if( screenHeight / 600.0f < scale )+ scale = screenHeight / 600.0f;+ r.w = (Int)( 800.0f * scale + 0.5f );+ r.h = (Int)( 600.0f * scale + 0.5f );+ r.x = ( screenWidth - r.w ) / 2;+ r.y = screenHeight - r.h;+ return r;+}++/// Where the 2D interface lives: the 4:3 box in the Classic interface, the whole screen in Reforged.+UIRect TheUIRect( void );+//-------------------------------------------------------------------------------------------------inline Real TheUIScale( void ){diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex 3cbd7e670..314a91b24 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -465,7 +465,7 @@ public: // ********************************************************************void feedStructure( Object *structure, Bool finished );void feedScience( Player *player, ScienceType science );virtual void toggleMessages( void ) { m_messagesOn = 1 - m_messagesOn; } ///< toggle messages on/off- void openScoreboard( void ) { m_scoreboardOpen = TRUE; } ///< the Tab scoreboard, up while Tab is held+ void openScoreboard( void ); ///< the Tab scoreboard, up while Tab is held; EA's diplomacy screen in Classicvoid closeScoreboard( void ) { m_scoreboardOpen = FALSE; }Bool pickSpectatorStat( Int commandSlot ); ///< a command bar key while watching: TRUE when it picked a stat/** The command bar's page, Window/Html/ControlBar.html, under the bar's windows: its panels are@@ -1671,6 +1671,26 @@ protected:void clearSignalMarks( void );void addFeedLine( HtmlValues line );void feedAct( Player *player, const Image *cameo, const std::string &what, const char *tag, const char *label );++ //+ // The Classic interface's message list: EA's column of six lines in the top left corner, each in+ // its own colour, fading out from the moment it is written. Reforged writes the event feed.+ //+ enum { CLASSIC_MESSAGES = 6 };+ struct ClassicMessage+ {+ DisplayString *text;+ UnsignedInt frame; ///< the logic frame it was written on+ Color color;+ };+ ClassicMessage m_classicMessages[ CLASSIC_MESSAGES ]; ///< newest first+ UnsignedInt m_classicMessageFadeFrame; ///< the last logic frame the fade was stepped on+ void addClassicMessage( const UnicodeString &text, const Color *color );+ void fadeClassicMessages( void );+ void drawClassicMessages( void );+ void freeClassicMessages( void );+ void drawClassicSuperweapon( SuperweaponInfo *info, const AsciiString &templateName, Bool isReady, Int readySecs,+ Int x, Int *y );void watchDozers( void );void drawFeed( void );Int feedTop( void ) const;diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cppindex 4c1077017..d23da1d87 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp@@ -1669,6 +1669,22 @@ Int parseTextLanguage(char *args[], int num)return 1;}+/* -interface <classic|reforged>: the InterfaceStyle row for this run, over what Options.ini saved,+ * so one script can shoot both interfaces without writing the player's file. Client only. */+Int parseInterfaceStyle(char *args[], int num)+{+ if (TheWritableGlobalData && num > 1)+ {+ if (strcasecmp(args[1], "classic") == 0)+ TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_CLASSIC;+ else if (strcasecmp(args[1], "reforged") == 0)+ TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_REFORGED;+ DEBUG_LOG(("-interface: %s\n", TheWritableGlobalData->m_interfaceStyle == INTERFACE_STYLE_CLASSIC ? "classic" : "reforged"));+ return 2;+ }+ return 1;+}+/* -dx11dump <directory>: write every program the Direct3D 11 backend generates into that* directory as it is built, named by the order it was built in with the state it came from on* its first line. A generated program that draws the wrong thing cannot be read any other way:@@ -2518,6 +2534,7 @@ static CommandLineParam params[] ={ "-msaa", parseMSAA },{ "-d3d9", parseDirect3D9 },{ "-language", parseTextLanguage },+ { "-interface", parseInterfaceStyle },{ "-dx11dump", parseDirect3D11Dump },{ "-dx11post", parseDirect3D11Post },{ "-autocamera", parseAutoCamera },diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cppindex 3568e01e0..34800891d 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp@@ -1007,6 +1007,9 @@ void GameEngine::init( int argc, char *argv[] )// special-case: parse command-line parameters after loading global dataparseCommandLine(argc, argv);+ // Options.ini and -interface have both had their say; the interface stays this until restart+ TheWritableGlobalData->latchInterfaceStyle();+// doesn't require resets so just create a single instance here.TheGameLODManager = MSGNEW("GameEngineSubsystem") GameLODManager;TheGameLODManager->init();diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 9a045a0ff..dac498de3 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -961,6 +961,7 @@ GlobalData::GlobalData()#endif// the game as it shipped until a player picks Reforgedm_interfaceStyle = INTERFACE_STYLE_CLASSIC;+ m_interfaceStyleInUse = INTERFACE_STYLE_CLASSIC;// the lobby's own colours until somebody asks for something elsem_playerColorScheme = PLAYER_COLORS_ORIGINAL;// the words the game shipped with until somebody picks a translationdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cppindex dd12287c6..4dec7f9ce 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp@@ -41,6 +41,7 @@#include "Common/GlobalData.h"#include "Common/Xfer.h"+#include "GameClient/ControlBar.h"#include "GameClient/Drawable.h"#include "GameClient/Eva.h"#include "GameClient/GameWindowManager.h"@@ -1238,6 +1239,9 @@ void Radar::tryUnderAttackEvent( const Object *obj )// if event created, do some more feedbackif( eventCreated ){+ // the lamp beside the radar; only the Classic bar has one to light+ if( TheControlBar )+ TheControlBar->triggerRadarAttackGlow();/////@todo Should make an INI data driven table for radar event strings, and audio events//diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cppindex 6f68d5ae7..c809d00ee 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp@@ -30,6 +30,7 @@#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine#include "Lib/Clock.h"+#include "Common/GlobalData.h"#include "GameClient/Display.h"#include "GameClient/Mouse.h"@@ -43,6 +44,19 @@/// The Display singleton instance.Display *TheDisplay = NULL;+UIRect TheUIRect( void )+{+ if( TheDisplay == NULL )+ {+ UIRect none = { 0, 0, 800, 600 };+ return none;+ }+ if( TheGlobalData && TheGlobalData->isClassicUI() )+ return UIRectForScreen( TheDisplay->getWidth(), TheDisplay->getHeight() );+ UIRect screen = { 0, 0, (Int)TheDisplay->getWidth(), (Int)TheDisplay->getHeight() };+ return screen;+}+Display::Display(){diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex c9c4f7d0a..91c2a3fe7 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -1558,6 +1558,8 @@ ControlBar::ControlBar( void )updateCommanBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED);m_pageSolidsActive = FALSE;+ m_radarAttackGlowWindow = NULL;+ m_remainingRadarAttackGlowFrames = 0;#if defined( _INTERNAL ) || defined( _DEBUG )m_lastFrameMarkedDirty = 0;@@ -1648,6 +1650,21 @@ static const Real thePanelAnchorFraction[ ControlBar::CB_PANEL_COUNT ] = { 0.0f,/// ...and which authored x that anchor is, so at 4:3 the three plates reassemble the shipped barstatic const Real thePanelAnchorDesignX[ ControlBar::CB_PANEL_COUNT ] = { 0.0f, 400.0f, 800.0f };+/// The Classic interface: EA's bar in one piece, all three panels pinned on the screen's centre at+/// the design's centre, which is the shipped layout at one scale inside the 4:3 box (UIRectForScreen).+static Bool barIsClassic( void )+{+ return TheGlobalData != NULL && TheGlobalData->isClassicUI();+}++/// Where a panel's design x 0 lands on screen.+static Real panelOriginX( Int panel, Real dispW, Real s )+{+ if( barIsClassic() )+ return dispW * 0.5f - CONTROL_BAR_DESIGN_W * 0.5f * s;+ return dispW * thePanelAnchorFraction[ panel ] - thePanelAnchorDesignX[ panel ] * s;+}+//-------------------------------------------------------------------------------------------------/** One scale for both axes, the smaller of the two, so nothing anywhere in the HUD is distorted.* Everything that used to work this out for itself now asks here. */@@ -1694,7 +1711,7 @@ Real ControlBarHudScale( void )// the player's HudScale option on top, 100/115/130/150%static const Real steps[] = { 1.0f, 1.15f, 1.3f, 1.5f };Int step = TheGlobalData ? TheGlobalData->m_hudScale : 0;- if( step < 0 || step > 3 )+ if( step < 0 || step > 3 || barIsClassic() ) // EA's HUD has the one sizestep = 0;return ControlBarHudScaleFit( ControlBarHudScaleFor( TheDisplay->getWidth(), TheDisplay->getHeight() ) * steps[ step ],@@ -1759,12 +1776,14 @@ void ControlBarLayoutUniform( GameWindow *root, Real anchorFracX, Real anchorFraconst Real s = ControlBarUniformScale();//- // The anchor is a point that does not move: the same fraction of the screen and of the design- // space. (1,1) keeps the bottom right corner where it was however wide the screen is, which is- // what a bar hanging off the right edge above the command bar wants.+ // The anchor is a point that does not move: the same fraction of the interface's rectangle and+ // of the design space. (1,1) keeps the bottom right corner where it was however wide the+ // screen is, which is what a bar hanging off the right edge above the command bar wants. In+ // the Classic interface the rectangle is the 4:3 box, so every anchor lands on the box itself.//- const Real originX = dispW * anchorFracX - CONTROL_BAR_DESIGN_W * anchorFracX * s;- const Real originY = dispH * anchorFracY - CONTROL_BAR_DESIGN_H * anchorFracY * s;+ const UIRect box = TheUIRect();+ const Real originX = box.x + box.w * anchorFracX - CONTROL_BAR_DESIGN_W * anchorFracX * s;+ const Real originY = box.y + box.h * anchorFracY - CONTROL_BAR_DESIGN_H * anchorFracY * s;ICoord2D rootOrigin;root->winGetScreenPosition( &rootOrigin.x, &rootOrigin.y );@@ -1806,14 +1825,17 @@ Bool ControlBarPanelDesignToScreen( Int panel, const IRegion2D *design,const Real loadScaleY = dispH / CONTROL_BAR_DESIGN_H;const Real s = loadScaleX < loadScaleY ? loadScaleX : loadScaleY;- const Real originX = dispW * thePanelAnchorFraction[ panel ]- - thePanelAnchorDesignX[ panel ] * s;+ const Real originX = panelOriginX( panel, dispW, s );rectOut->lo.x = REAL_TO_INT_FLOOR( originX + design->lo.x * s );rectOut->hi.x = REAL_TO_INT_CEIL ( originX + design->hi.x * s );rectOut->lo.y = REAL_TO_INT_FLOOR( dispH - ( CONTROL_BAR_DESIGN_H - design->lo.y ) * s );rectOut->hi.y = REAL_TO_INT_CEIL ( dispH - ( CONTROL_BAR_DESIGN_H - design->hi.y ) * s );+ // the Classic bar is EA's one piece, centred in the 4:3 box, and touches no screen edge but the bottom+ if( barIsClassic() )+ return TRUE;+//// The screen has three edges the bar touches and each belongs to one panel: the left panel owns// the left edge, the right panel the right, and all three stand on the bottom. The centre@@ -2133,9 +2155,22 @@ void ControlBar::setPageSolids( const std::vector< IRegion2D > *solids, const stm_pageHoles.clear();}+//-------------------------------------------------------------------------------------------------+void ControlBar::triggerRadarAttackGlow( void )+{+ if( m_radarAttackGlowWindow == NULL )+ return;+ m_remainingRadarAttackGlowFrames = 150;+ m_radarAttackGlowWindow->winEnable( FALSE );+}+//-------------------------------------------------------------------------------------------------Bool ControlBar::letsClickThrough( GameWindow *window, Int x, Int y ){+ // EA's bar: its input-blocking panes are the shape of the bar, and they keep their clicks+ if( barIsClassic() )+ return FALSE;+GameWindow *frame = window->winGetParent();if( frame == NULL || m_controlBarSchemeManager == NULL || TheDisplay == NULL )return FALSE;@@ -2222,8 +2257,7 @@ void ControlBar::placeInPanel( GameWindow *win, Int panel,const Real loadScaleX = dispW / CONTROL_BAR_DESIGN_W;const Real loadScaleY = dispH / CONTROL_BAR_DESIGN_H;const Real s = ControlBarUniformScale();- const Real originX = dispW * thePanelAnchorFraction[ panel ]- - thePanelAnchorDesignX[ panel ] * s;+ const Real originX = panelOriginX( panel, dispW, s );ICoord2D rel, size;win->winGetPosition( &rel.x, &rel.y );@@ -2258,7 +2292,8 @@ void ControlBar::placeInPanel( GameWindow *win, Int panel,// observer panes - slides across into the field. See ControlBarPlate.//const ControlBarPlate *plate = NULL;- if( m_controlBarSchemeManager )+ // the Classic bar wears the scheme's own painting, which ControlBarScheme.ini's windows match+ if( m_controlBarSchemeManager && !barIsClassic() ){plate = ControlBarPlateForSide( m_controlBarSchemeManager->getCurrentSide(), panel );if( plate == NULL )@@ -2515,7 +2550,8 @@ void ControlBar::updatePanelSlide( void )//-------------------------------------------------------------------------------------------------void ControlBar::showPanel( Int panel, Bool show, Bool immediate ){- if( panel < 0 || panel >= CB_PANEL_COUNT )+ // EA's bar is one piece and minimises as one (setLowControlBarConfig)+ if( panel < 0 || panel >= CB_PANEL_COUNT || barIsClassic() )return;m_panelSlideTo[ panel ] = show ? 0.0f : 1.0f;@@ -2760,7 +2796,7 @@ void ControlBar::layoutPanels( void )//for( p = 0; p < CB_PANEL_COUNT; p++ )m_panelDropCap[ p ] = 0;- if( m_controlBarSchemeManager )+ if( m_controlBarSchemeManager && !barIsClassic() ){const ControlBarPlate *rightPlate =ControlBarPlateForSide( m_controlBarSchemeManager->getCurrentSide(), CB_PANEL_RIGHT );@@ -2906,6 +2942,8 @@ void ControlBar::shutdownWindows( void )m_rightHUDCameoWindow = NULL;m_rightHUDUnitSelectParent = NULL;m_communicatorButton = NULL;+ m_radarAttackGlowWindow = NULL;+ m_remainingRadarAttackGlowFrames = 0;m_animateDownWindow = NULL;m_multiSelectTiles.clear();m_sideSelectAnimateDown = FALSE;@@ -3091,9 +3129,15 @@ void ControlBar::initWindows( void )setControlCommand(win, findCommandButton("NonCommand_IdleWorker") );win->winSetTooltipFunc(commandButtonTooltip);}- // the bar carries no beacon button; nothing below shows it again+ // the Reforged bar carries no beacon button; nothing below shows it again. Classic keeps EA'swin = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonPlaceBeacon"));- win->winHide(TRUE);+ if( win && barIsClassic() )+ {+ setControlCommand( win, findCommandButton( "NonCommand_Beacon" ) );+ win->winSetTooltipFunc( commandButtonTooltip );+ }+ else if( win )+ win->winHide(TRUE);win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral"));if(win){@@ -3123,10 +3167,12 @@ void ControlBar::initWindows( void )win->winSetTooltipFunc(commandButtonTooltip);}- // the radar's under-attack light is gone from the bar: the radar ping, the EVA line and the- // message say it already+ // the radar's under-attack light is gone from the Reforged bar: the radar ping, the EVA line+ // and the message say it already. Classic keeps it flashing, as EA's didwin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinUAttack"));- if(win)+ if( win && barIsClassic() )+ m_radarAttackGlowWindow = win;+ else if(win)win->winHide(TRUE);@@ -3302,6 +3348,15 @@ void ControlBar::update( void )if( logicTick ){getStarImage();++ // EA's lamp: 150 frames, flipping every 15. winEnable(FALSE) is the lit image+ if( m_radarAttackGlowWindow && m_remainingRadarAttackGlowFrames > 0 )+ {+ if( --m_remainingRadarAttackGlowFrames <= 0 )+ m_radarAttackGlowWindow->winEnable( TRUE );+ else if( m_remainingRadarAttackGlowFrames % 15 == 0 )+ m_radarAttackGlowWindow->winEnable( !BitTest( m_radarAttackGlowWindow->winGetStatus(), WIN_STATUS_ENABLED ) );+ }}//@@ -6121,6 +6176,17 @@ void ControlBar::setLowControlBarConfig( void )// down with the selection panel and stops it on the bottom edge of the screen.//TheTacticalView->setHeight((Int)(TheDisplay->getHeight()));++ // EA's: the whole bar drops to a tenth of the screen from the bottom, its top edge still showing+ if( barIsClassic() )+ {+ m_contextParent[ CP_MASTER ]->winSetPosition( m_defaultControlBarPosition.x,+ REAL_TO_INT( TheDisplay->getHeight() - 0.1f * TheDisplay->getHeight() ) );+ m_contextParent[ CP_MASTER ]->winHide(FALSE);+ setUpDownImages();+ return;+ }+m_contextParent[ CP_MASTER ]->winSetPosition(m_defaultControlBarPosition.x, m_defaultControlBarPosition.y);m_contextParent[ CP_MASTER ]->winHide(FALSE);diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cppindex 0304b8290..da86eb02f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp@@ -1153,16 +1153,36 @@ void ControlBarSchemeManager::update( void )}//-----------------------------------------------------------------------------+/** The Classic interface lays EA's bar out at one scale, centred and standing on the bottom of the+ * screen (layoutPanels, ControlBarPanelDesignToScreen), so its painting goes through that same+ * transform instead of the loader's two-way stretch. */+//-----------------------------------------------------------------------------+static Coord2D paintTransform( Coord2D stretch, ICoord2D *offset )+{+ if( TheGlobalData == NULL || !TheGlobalData->isClassicUI() || TheDisplay == NULL )+ return stretch;++ const Real s = ControlBarUniformScale();+ offset->x += REAL_TO_INT_FLOOR( TheDisplay->getWidth() * 0.5f - 400.0f * s );+ offset->y += REAL_TO_INT_FLOOR( TheDisplay->getHeight() - 600.0f * s );+ Coord2D uniform;+ uniform.x = uniform.y = s;+ return uniform;+}+void ControlBarSchemeManager::drawForeground( ICoord2D offset ){- if(m_currentScheme)- m_currentScheme->drawForeground( m_multiplyer, offset);+ // two statements: paintTransform moves `offset`, and argument order is the compiler's choice+ const Coord2D multi = paintTransform( m_multiplyer, &offset );+ if(m_currentScheme)+ m_currentScheme->drawForeground( multi, offset );}//-----------------------------------------------------------------------------void ControlBarSchemeManager::drawBackground( ICoord2D offset ){- if(m_currentScheme)- m_currentScheme->drawBackground( m_multiplyer, offset );+ const Coord2D multi = paintTransform( m_multiplyer, &offset );+ if(m_currentScheme)+ m_currentScheme->drawBackground( multi, offset );}//-----------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cppindex 5836b2387..37700b05c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp@@ -97,9 +97,13 @@ void ShowInGameChat( Bool immediate )static NameKeyType chatTypeStaticTextID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:StaticTextChatType" );chatTypeStaticText = TheWindowManager->winGetWindowFromId( NULL, chatTypeStaticTextID );- chatWindow->winSetDrawFunc( drawChatNothing );- for( GameWindow *child = chatWindow->winGetChild(); child; child = child->winGetNext() )- child->winSetDrawFunc( drawChatNothing );+ // the Classic interface has no page: EA's layout draws itself where InGameChat.wnd puts it+ if( !TheGlobalData->isClassicUI() )+ {+ chatWindow->winSetDrawFunc( drawChatNothing );+ for( GameWindow *child = chatWindow->winGetChild(); child; child = child->winGetNext() )+ child->winSetDrawFunc( drawChatNothing );+ }}TheWindowManager->winSetFocus( chatTextEntry );SetInGameChatType( INGAME_CHAT_EVERYONE );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cppindex e7d28fc44..936b44078 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp@@ -522,13 +522,29 @@ static Bool startsWithFolder( const char *path, const char *folder )return *path == '/' || *path == '\\';}+// The Classic interface puts everything in the 4:3 box (UIRectForScreen), battlefield furniture and+// all, except the layouts the command bar takes back out of the loader's stretch itself+// (layoutPanels, ControlBarLayoutUniform): they divide the stretch back out, so they must be given it.+static Bool barLaysOutItself( const char *filename )+{+ static const char *const own[] = { "controlbar.wnd", "generalsexppoints.wnd", "genpowersshortcutbar" };+ for( Int i = 0; i < (Int)ARRAY_SIZE( own ); i++ )+ if( strnicmp( filename, own[ i ], strlen( own[ i ] ) ) == 0 )+ return TRUE;+ return FALSE;+}+static Bool layoutFits( const char *filename ){- if( TheGlobalData == NULL || TheGlobalData->m_menuLayout != MENU_LAYOUT_FIT || filename == NULL )+ if( TheGlobalData == NULL || filename == NULL )return FALSE;// "Menus/X.wnd" as the shell names them, or the whole "Window\\Menus\\X.wnd"if( startsWithFolder( filename, "window" ) )filename += 7;+ if( TheGlobalData->isClassicUI() )+ return !barLaysOutItself( filename );+ if( TheGlobalData->m_menuLayout != MENU_LAYOUT_FIT )+ return FALSE;return startsWithFolder( filename, "menus" );}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cppindex be5e5384f..5a3b375b1 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp@@ -275,6 +275,9 @@ GameConsole::~GameConsole()//-------------------------------------------------------------------------------------------------void GameConsole::toggle( void ){+ // EA's game had no console; the Classic interface keeps it shut+ if( !m_isOpen && TheGlobalData->isClassicUI() )+ return;m_isOpen = !m_isOpen;if( !m_isOpen )m_inputLine.clear();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cppindex 1b991cf2e..02e3fd0fc 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp@@ -191,7 +191,9 @@ void GlobalLanguage::init( void )// grow at the full rate, so on a 1920x1080 screen every label was drawn a size or two smaller than// the box drawn for it, and on 2560x1440 a tooltip's text filled half its panel. The text keeps// pace with its panel now, which is also the size it was authored at on 800x600.- m_resolutionFontSizeAdjustment = TEXT_GROWS_WITH_LAYOUT;+ // The Classic interface is EA's and keeps EA's rate.+ if( !TheGlobalData->isClassicUI() )+ m_resolutionFontSizeAdjustment = TEXT_GROWS_WITH_LAYOUT;StringListIt it = m_localFonts.begin();while( it != m_localFonts.end())@@ -232,9 +234,13 @@ const Real GlobalLanguage::TEXT_GROWS_WITH_LAYOUT = 1.0f;Int GlobalLanguage::adjustFontSize(Int theFontSize){- return adjustFontSizeForScreen( theFontSize, TheGlobalData->m_xResolution,- TheGlobalData->m_yResolution,- m_resolutionFontSizeAdjustment );+ const Int size = adjustFontSizeForScreen( theFontSize, TheGlobalData->m_xResolution,+ TheGlobalData->m_yResolution,+ m_resolutionFontSizeAdjustment );+ // the Classic interface letters at EA's rate (init leaves Language.ini's damping) and EA's 2x cap+ if( TheGlobalData->isClassicUI() && size > theFontSize * 2 )+ return theFontSize * 2;+ return size;}Int GlobalLanguage::adjustFontSizeForScreen(Int theFontSize, Int screenWidth, Int screenHeight,diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 6e15cf47e..422657845 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -1125,6 +1125,13 @@ InGameUI::InGameUI()m_messagePointSize = 10;m_messageBold = FALSE;m_messageDelayMS = 5000;+ for( i = 0; i < CLASSIC_MESSAGES; i++ )+ {+ m_classicMessages[ i ].text = NULL;+ m_classicMessages[ i ].frame = 0;+ m_classicMessages[ i ].color = 0;+ }+ m_classicMessageFadeFrame = 0;m_militaryCaptionColor.red = 200;m_militaryCaptionColor.green = 200;@@ -1470,8 +1477,10 @@ void InGameUI::init( void )if (TheGlobalLanguageData->m_superweaponCountdownNormalFont.name.isNotEmpty()){ m_superweaponNormalFont = TheGlobalLanguageData->m_superweaponCountdownNormalFont.name;m_superweaponNormalPointSize = TheGlobalLanguageData->m_superweaponCountdownNormalFont.size;- // these are overlay text on the battlefield, not panel text - take them down a notch- m_superweaponNormalPointSize = max( 8, (m_superweaponNormalPointSize * 4) / 5 );+ // these are overlay text on the battlefield, not panel text - take them down a notch, except+ // in the Classic interface, which draws EA's column of them at EA's size+ if( !TheGlobalData->isClassicUI() )+ m_superweaponNormalPointSize = max( 8, (m_superweaponNormalPointSize * 4) / 5 );m_superweaponNormalBold = TheGlobalLanguageData->m_superweaponCountdownNormalFont.bold;}@@ -1497,7 +1506,9 @@ void InGameUI::init( void )// the message list is overlay text in the top-left corner of the battlefield, not panel text -// take it down a notch, same as the superweapon countdown above. (line spacing follows the// font height in postDraw(), so the whole stack shrinks with it.)- m_messagePointSize = max( 8, (m_messagePointSize * 4) / 5 );+ // The Classic interface's list is EA's, at EA's size.+ if( !TheGlobalData->isClassicUI() )+ m_messagePointSize = max( 8, (m_messagePointSize * 4) / 5 );/**@ todo we used to put in the hint spy translator, but it's difficultto order the translators when the code is not centralized so it has@@ -1941,6 +1952,9 @@ enumstatic void readHtmlPage( const char *path, std::string &page ){page.clear();+ // the Classic interface is EA's, and every page here has EA's windows, or nothing, to fall back on+ if( TheGlobalData->isClassicUI() )+ return;File *file = TheFileSystem->openFile( path, File::READ | File::BINARY );if( file == NULL ){@@ -4348,8 +4362,138 @@ void InGameUI::reset( void )void InGameUI::freeMessageResources( void ){m_feedLines.clear();+ freeClassicMessages();} // end freeMessageResources+//-------------------------------------------------------------------------------------------------+void InGameUI::freeClassicMessages( void )+{+ for( Int i = 0; i < CLASSIC_MESSAGES; i++ )+ {+ if( m_classicMessages[ i ].text )+ TheDisplayStringManager->freeDisplayString( m_classicMessages[ i ].text );+ m_classicMessages[ i ].text = NULL;+ m_classicMessages[ i ].frame = 0;+ }+}++//-------------------------------------------------------------------------------------------------+/** EA's InGameUI::addMessageText: the oldest line falls off the end, the new one goes in at the top+ * in white or grey by turns, or in the colour it was given. */+//-------------------------------------------------------------------------------------------------+void InGameUI::addClassicMessage( const UnicodeString &text, const Color *color )+{+ const Color color1 = color ? ( *color | GameMakeColor( 0, 0, 0, 255 ) ) : m_messageColor1;+ const Color color2 = color ? ( *color | GameMakeColor( 0, 0, 0, 255 ) ) : m_messageColor2;++ if( m_classicMessages[ CLASSIC_MESSAGES - 1 ].text )+ TheDisplayStringManager->freeDisplayString( m_classicMessages[ CLASSIC_MESSAGES - 1 ].text );+ for( Int i = CLASSIC_MESSAGES - 1; i >= 1; i-- )+ m_classicMessages[ i ] = m_classicMessages[ i - 1 ];++ ClassicMessage &added = m_classicMessages[ 0 ];+ added.frame = TheGameLogic->getFrame();+ added.text = TheDisplayStringManager->newDisplayString();+ added.text->setFont( TheFontLibrary->getFont( m_messageFont,+ TheGlobalLanguageData->adjustFontSize( m_messagePointSize ), m_messageBold ) );+ added.text->setText( text );+ added.color = ( m_classicMessages[ 1 ].text == NULL || m_classicMessages[ 1 ].color == color2 ) ? color1 : color2;+}++//-------------------------------------------------------------------------------------------------+/** EA's fade, once a logic frame: a line loses alpha by a hundredth of its age every frame from the+ * start (MessageDelayMS divided by the frame rate and by a thousand is 0 in EA's arithmetic), so a+ * line is gone about seven seconds after it came. */+//-------------------------------------------------------------------------------------------------+void InGameUI::fadeClassicMessages( void )+{+ const UnsignedInt now = TheGameLogic->getFrame();+ if( now == m_classicMessageFadeFrame )+ return;+ m_classicMessageFadeFrame = now;++ const UnsignedInt timeout = m_messageDelayMS / LOGICFRAMES_PER_SECOND / 1000;+ for( Int i = CLASSIC_MESSAGES - 1; i >= 0; i-- )+ {+ ClassicMessage &line = m_classicMessages[ i ];+ if( line.text == NULL || now - line.frame <= timeout )+ continue;+ UnsignedByte r, g, b, a;+ GameGetColorComponents( line.color, &r, &g, &b, &a );+ const Int amount = REAL_TO_INT( ( now - line.frame ) * 0.01f );+ a = ( a - amount < 0 ) ? 0 : a - amount;+ line.color = GameMakeColor( r, g, b, a );+ if( a == 0 )+ {+ TheDisplayStringManager->freeDisplayString( line.text );+ line.text = NULL;+ }+ }+}++//-------------------------------------------------------------------------------------------------+void InGameUI::drawClassicMessages( void )+{+ fadeClassicMessages();+ if( !m_messagesOn )+ return;++ const UIRect box = TheUIRect();+ const Int x = box.x + m_messagePosition.x;+ Int y = box.y + m_messagePosition.y;+ for( Int i = CLASSIC_MESSAGES - 1; i >= 0; i-- )+ {+ ClassicMessage &line = m_classicMessages[ i ];+ if( line.text == NULL )+ continue;+ UnsignedByte r, g, b, a;+ GameGetColorComponents( line.color, &r, &g, &b, &a );+ line.text->draw( x, y, line.color, GameMakeColor( 0, 0, 0, a ) );+ y += line.text->getFont()->height;+ }+}++//-------------------------------------------------------------------------------------------------+/** EA's countdown line: the power's name right-aligned to x and its clock after it, in its owner's+ * colour, the ready one bold and flashing. The text is only set again when the second, the+ * readiness or a forced refresh changes it. */+//-------------------------------------------------------------------------------------------------+void InGameUI::drawClassicSuperweapon( SuperweaponInfo *info, const AsciiString &templateName, Bool isReady,+ Int readySecs, Int x, Int *y )+{+ if( readySecs != (Int)info->m_timestamp || isReady != info->m_ready || info->m_forceUpdateText )+ {+ if( isReady )+ info->setFont( m_superweaponReadyFont, m_superweaponReadyPointSize, m_superweaponReadyBold );+ else if( info->m_timestamp == 0 )+ info->setFont( m_superweaponNormalFont, m_superweaponNormalPointSize, m_superweaponNormalBold );+ info->m_forceUpdateText = false;+ info->m_ready = isReady;+ info->m_timestamp = readySecs;+ AsciiString label;+ label.format( "GUI:%s", templateName.str() );+ UnicodeString name, time;+ name.format( u"%ls: ", TheGameText->fetch( label.str() ).str() );+ time.format( u"%d:%2.2d", readySecs / 60, readySecs % 60 );+ info->setText( name, time );+ }++ Color color = 0;+ if( isReady && m_superweaponFlashDuration != 0.0f )+ {+ if( TheGameLogic->getFrame() >= m_superweaponLastFlashFrame + (Int)m_superweaponFlashDuration )+ {+ m_superweaponUsedFlashColor = !m_superweaponUsedFlashColor;+ m_superweaponLastFlashFrame = TheGameLogic->getFrame();+ }+ color = m_superweaponUsedFlashColor ? 0 : m_superweaponFlashColor;+ }+ const Color drop = GameMakeColor( 0, 0, 0, 255 );+ info->drawName( x, *y, color, drop );+ info->drawTime( x, *y, color, drop );+ *y += REAL_TO_INT( info->getHeight() );+}+//-------------------------------------------------------------------------------------------------/** Same as the unicode message method, but this takes an ascii string which is assumed* to me a string manager label */@@ -4413,6 +4557,11 @@ void InGameUI::message( UnicodeString format, ... )//-------------------------------------------------------------------------------------------------void InGameUI::addMessageText( const UnicodeString& formattedMessage ){+ if( TheGlobalData->isClassicUI() )+ {+ addClassicMessage( formattedMessage, NULL );+ return;+ }HtmlValues line;line[ "kind" ] = "note";line[ "before" ] = WideCharStringToMultiByte( formattedMessage.str() );@@ -4425,6 +4574,13 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage )//-------------------------------------------------------------------------------------------------void InGameUI::playerMessage( Player *player, const UnicodeString &text ){+ // EA wrote these lines in the player's colour+ if( TheGlobalData->isClassicUI() )+ {+ const Color color = player->getPlayerColor();+ addClassicMessage( text, &color );+ return;+ }HtmlValues line = spectatorHead( player );line[ "kind" ] = "player";line[ "portrait" ] = line[ "image" ];@@ -4475,6 +4631,9 @@ static std::string buttonName( const CommandButton *button )//-------------------------------------------------------------------------------------------------void InGameUI::feedAct( Player *player, const Image *cameo, const std::string &what, const char *tag, const char *label ){+ // the feed's own lines, a power fired or a promotion bought: EA's list never carried them+ if( TheGlobalData->isClassicUI() )+ return;HtmlValues line = spectatorHead( player );line[ "kind" ] = "act";line[ "portrait" ] = line[ "image" ];@@ -4781,6 +4940,15 @@ enum//-------------------------------------------------------------------------------------------------void InGameUI::chatMessage( Player *player, const UnicodeString &text ){+ // EA's: "[name] text" in the message list, in the sender's colour+ if( TheGlobalData->isClassicUI() )+ {+ UnicodeString said;+ said.format( u"[%ls] %ls", player->getPlayerDisplayName().str(), text.str() );+ const Color color = player->getPlayerColor();+ addClassicMessage( said, &color );+ return;+ }FeedLine line;line.values = spectatorHead( player );line.values[ "text" ] = WideCharStringToMultiByte( text.str() );@@ -4800,7 +4968,8 @@ void InGameUI::chatMessage( Player *player, const UnicodeString &text )//-------------------------------------------------------------------------------------------------void InGameUI::drawChat( void ){- if( !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )+ // Classic: EA's InGameChat.wnd draws itself where it was laid out, and the lines are messages+ if( !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() || TheGlobalData->isClassicUI() )return;// shut, the chat is the talk around its newest line: every line that came within CHAT_LINE_FRAMES@@ -8257,6 +8426,7 @@ void InGameUI::postDraw( void )drawSpectatorPage();drawFeed();drawChat();+ drawClassicMessages();if( m_militarySubtitle ){@@ -8300,6 +8470,13 @@ void InGameUI::postDraw( void )m_superweaponIconCount = 0;m_spectatorSuperweapons.clear();+ // the Classic interface writes EA's column of names and clocks instead, inside the 4:3 box+ const Bool classic = TheGlobalData->isClassicUI();+ const UIRect box = TheUIRect();+ const Int classicX = box.x + REAL_TO_INT( m_superweaponPosition.x * box.w );+ Int classicY = box.y + REAL_TO_INT( m_superweaponPosition.y * box.h );+ const Int classicBottom = box.y + REAL_TO_INT( box.h * 0.8f * 0.82f ); // EA's: the view above its bar+for (Int i=0; i<MAX_PLAYER_COUNT; ++i){for (SuperweaponMap::iterator mapIt = m_superweapons[i].begin(); mapIt != m_superweapons[i].end(); ++mapIt)@@ -8408,8 +8585,13 @@ void InGameUI::postDraw( void )info->m_evaReadyPlayed = false; // Reset Eva for next time}+ if ( classic )+ {+ if ( !m_superweaponHiddenByScript && classicY < classicBottom )+ drawClassicSuperweapon( info, mapIt->first, isReady, readySecs, classicX, &classicY );+ }// hand it to the strip- if ( !m_superweaponHiddenByScript )+ else if ( !m_superweaponHiddenByScript ){info->m_forceUpdateText = false;info->m_ready = isReady;@@ -8450,7 +8632,8 @@ void InGameUI::postDraw( void )}}- drawSuperweaponStrip();+ if( !classic )+ drawSuperweaponStrip();}// draw named timers@@ -8458,8 +8641,9 @@ void InGameUI::postDraw( void ){// Int namedTimerCount = 0;Bool reverseXDir = (m_namedTimerPosition.x >= 0.5f);- Int startX = (Int)(m_namedTimerPosition.x * TheDisplay->getWidth());- Int startY = (Int)(m_namedTimerPosition.y * TheDisplay->getHeight());+ const UIRect box = TheUIRect();+ Int startX = box.x + (Int)(m_namedTimerPosition.x * box.w);+ Int startY = box.y + (Int)(m_namedTimerPosition.y * box.h);Color bgColor = GameMakeColor( 0, 0, 0, 255 );for (NamedTimerMapIt mapIt = m_namedTimers.begin(); mapIt != m_namedTimers.end(); ++mapIt){@@ -8801,9 +8985,10 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration )// calculate where this screen position should be since the position being passed in is based off 8x6Coord2D multiplier;- multiplier.x = (float)TheDisplay->getWidth() / 800.0f;- multiplier.y = (float)TheDisplay->getHeight() / 600.0f;-+ const UIRect box = TheUIRect();+ multiplier.x = (float)box.w / 800.0f;+ multiplier.y = (float)box.h / 600.0f;+// lets bring out the data structure!m_militarySubtitle = NEW MilitarySubtitleData;@@ -8811,8 +8996,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration )m_militarySubtitle->blockDrawn = TRUE;m_militarySubtitle->blockBeginFrame = currLogicFrame;m_militarySubtitle->lifetime = messageTimeout;- m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = m_militaryCaptionPosition.x * multiplier.x;- m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = m_militaryCaptionPosition.y * multiplier.y;+ m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = box.x + m_militaryCaptionPosition.x * multiplier.x;+ m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = box.y + m_militaryCaptionPosition.y * multiplier.y;m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * TheGlobalLanguageData->m_militaryCaptionDelayMS)/1000.0f);m_militarySubtitle->index = 0;for (int i = 1; i < MAX_SUBTITLE_LINES; i ++)@@ -10267,8 +10452,9 @@ void InGameUI::drawHudOverlay( void )// screen grew: the lettering inside it scales and the margin around it did not, so a 1440-tall// shot and a 1080-tall one did not overlay however the text was sized.const Int pad = stripPixels( 2 );- Int x = TheDisplay->getWidth() - textWidth - pad - stripPixels( 4 );- Int y = stripPixels( 2 );+ const UIRect box = TheUIRect();+ Int x = box.x + box.w - textWidth - pad - stripPixels( 4 );+ Int y = box.y + stripPixels( 2 );// a plate behind it, so it stays legible over bright terrainTheDisplay->drawFillRect( x - pad, y - 1, textWidth + pad*2, textHeight + 2,@@ -10945,7 +11131,7 @@ static Int gatherPlayerSkills( const Player *player, const CommandButton **buttovoid InGameUI::drawSkillStrip( void ){// the spectator page's left panel lists them instead; the page's flag is the last frame's here- if( stripSwitchedOff( &GlobalData::m_showSkillStrip ) || m_spectatorPageShown )+ if( stripSwitchedOff( &GlobalData::m_showSkillStrip ) || m_spectatorPageShown || TheGlobalData->isClassicUI() )return;if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )return;@@ -11312,6 +11498,18 @@ static void putSeatQueue( HtmlValues &row, Player *player )* with its production, the queue over the console he no longer has. Every section opens with a* band of kind "band" carrying its {{label}}, how many seats are {{standing}} of {{seats}}, and* {{side}} "allies", "enemies" or "team". */+//-------------------------------------------------------------------------------------------------+void InGameUI::openScoreboard( void )+{+ // the key that holds the scoreboard up is EA's diplomacy key, and Classic gives it back to diplomacy+ if( TheGlobalData->isClassicUI() )+ {+ ToggleDiplomacy( FALSE );+ return;+ }+ m_scoreboardOpen = TRUE;+}+//-------------------------------------------------------------------------------------------------void InGameUI::drawScoreboard( void ){@@ -14182,7 +14380,8 @@ void InGameUI::drawProductionStrip( void )m_productionStripCount = 0;m_productionStripTotal = 0;- if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )+ // EA's HUD has no strip: the queue is read off the building's own command bar+ if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() || TheGlobalData->isClassicUI() )return;Player *player = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;@@ -14464,8 +14663,9 @@ void InGameUI::popupMessage( const AsciiString& identifier, Int x, Int y, Int wiif( y < 0 )y = 0;- m_popupMessageData->x = TheDisplay->getWidth() * (INT_TO_REAL(x) / 100);- m_popupMessageData->y = TheDisplay->getHeight() * (INT_TO_REAL(y) / 100);+ const UIRect box = TheUIRect();+ m_popupMessageData->x = box.x + box.w * (INT_TO_REAL(x) / 100);+ m_popupMessageData->y = box.y + box.h * (INT_TO_REAL(y) / 100);// cap the lower limit of the widthif(width < 50)width = 50;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cppindex cf8a97ee1..2f090f5de 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp@@ -687,12 +687,40 @@ static const Image *plateImage( const ControlBarPlate *plate )/** Each panel wears a plate of its own now - see ControlBarPlateForSide in ControlBar.cpp for what* a plate is and why the scheme's one-piece painting is not drawn at all. *///-------------------------------------------------------------------------------------------------+//-------------------------------------------------------------------------------------------------+/** The Classic interface's bar wears EA's one-piece painting, the scheme's own layers, offset by+ * however far the bar's frame has travelled from where layoutPanels put it (the minimised bar drops+ * it), the same measure the plates use. ControlBarSchemeManager::drawBackground puts the painting where the windows are, in the 4:3 box. */+//-------------------------------------------------------------------------------------------------+static void drawSchemeLayers( GameWindow *window, ControlBarSchemeManager *man, Bool foreground )+{+ GameWindow *frame = window ? window->winGetParent() : NULL;+ if( frame == NULL )+ return;++ ICoord2D now, offset;+ frame->winGetScreenPosition( &now.x, &now.y );+ offset.x = now.x - TheControlBar->getPanelOrigin()->x;+ offset.y = now.y - TheControlBar->getPanelOrigin()->y;++ if( foreground )+ man->drawForeground( offset );+ else+ man->drawBackground( offset );+}+void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData ){ControlBarSchemeManager *man = TheControlBar ? TheControlBar->getControlBarSchemeManager() : NULL;if( man == NULL || TheDisplay == NULL )return;+ if( TheGlobalData->isClassicUI() )+ {+ drawSchemeLayers( window, man, FALSE );+ return;+ }+//// The plates are drawn from the design rectangles rather than from a window, so on their own// they stand still while the bar moves: minimising it drops the frame a tenth of the screen and@@ -757,8 +785,11 @@ void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instDatavoid W3DCommandBarForegroundDraw( GameWindow *window, WinInstanceData *instData ){-- // nothing sits on top of the plates - see W3DCommandBarBackgroundDraw+ // nothing sits on top of the plates - see W3DCommandBarBackgroundDraw - but EA's painting has+ // a foreground layer+ ControlBarSchemeManager *man = TheControlBar ? TheControlBar->getControlBarSchemeManager() : NULL;+ if( man && TheGlobalData->isClassicUI() )+ drawSchemeLayers( window, man, TRUE );}diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 774121a4e..e4bf7fc32 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -7438,6 +7438,11 @@ TEST(interface_style_defaults_to_classic_and_round_trips_through_options_ini)TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_CLASSIC;loadOptionsFromPreferences( pref );+ CHECK_EQ( TheGlobalData->m_interfaceStyle, (Int)INTERFACE_STYLE_REFORGED );++ // the HUD keeps the style it started in until the next start: Accept writes the row at once+ CHECK( TheGlobalData->isClassicUI() );+ TheWritableGlobalData->latchInterfaceStyle();CHECK( !TheGlobalData->isClassicUI() );delete TheWritableGlobalData;@@ -11908,6 +11913,46 @@ TEST(the_three_panels_are_one_bar_at_4x3_and_pull_apart_on_a_wide_screen)CHECK( ControlBarPanelDesignToScreen( ControlBar::CB_PANEL_LEFT, &whole, 0, 0, &left ) == FALSE );}+TEST(the_classic_bar_is_one_piece_centred_in_the_4x3_box)+{+ /* The Classic interface puts EA's bar back together, and on a wide screen it stands in the+ middle of the 4:3 box with the world showing down both sides, not pulled apart to the edges. */+ CHECK_EQ( UIRectForScreen( 1920, 1080 ).x, 240 );+ CHECK_EQ( UIRectForScreen( 1920, 1080 ).w, 1440 );+ CHECK_EQ( UIRectForScreen( 1920, 1080 ).h, 1080 );+ CHECK_EQ( UIRectForScreen( 2560, 1080 ).x, 560 );+ CHECK_EQ( UIRectForScreen( 1024, 768 ).x, 0 );+ CHECK_EQ( UIRectForScreen( 1024, 768 ).w, 1024 );+ CHECK_EQ( UIRectForScreen( 1280, 1024 ).y, 64 ); // narrower than 4:3: full width, on the bottom with the bar++ GlobalData *saved = TheWritableGlobalData;+ TheWritableGlobalData = NEW GlobalData;+ TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_CLASSIC;+ TheWritableGlobalData->latchInterfaceStyle();++ IRegion2D whole;+ whole.lo.x = 0;+ whole.lo.y = 408;+ whole.hi.x = 800;+ whole.hi.y = 600;+ for( Int screen = 0; screen < 2; screen++ )+ {+ const Int w = screen ? 2560 : 1920;+ const UIRect box = UIRectForScreen( w, 1080 );+ for( Int p = 0; p < ControlBar::CB_PANEL_COUNT; p++ )+ {+ IRegion2D rect;+ CHECK( ControlBarPanelDesignToScreen( p, &whole, w, 1080, &rect ) );+ CHECK_NEAR( (Real)rect.lo.x, (Real)box.x, 1.5f );+ CHECK_NEAR( (Real)rect.hi.x, (Real)( box.x + box.w ), 1.5f );+ CHECK_EQ( rect.hi.y, 1080 );+ }+ }++ delete TheWritableGlobalData;+ TheWritableGlobalData = saved;+}+TEST(a_plate_covers_the_windows_its_panel_is_responsible_for){/* The plates are cuts of the shipped painting and the windows are at the coordinates the .wnd