From 14ebc3a94f992abc6f8e5ca77fc1a07a7cdaedb8 Mon Sep 17 00:00:00 2001 From: tophroxx Date: Wed, 28 Jan 2026 21:33:22 +0300 Subject: [PATCH 1/3] feat(display): Add scaled constant methods to Display --- GeneralsMD/Code/GameEngine/Include/GameClient/Display.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index c6c69b62298..2ab4493906e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -90,6 +90,9 @@ class Display : public SubsystemInterface virtual void dumpAssetUsage(const char* mapname) = 0; #endif + virtual UnsignedInt scaleHorizontalConstant(UnsignedInt x) { return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * getWidth(); } + virtual UnsignedInt scaleVerticalConstant(UnsignedInt y) { return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * getHeight(); } + //--------------------------------------------------------------------------------------- // View management virtual void attachView( View *view ); ///< Attach the given view to the world From 590536ab1ce82142e619fd04714920bd328c5d0d Mon Sep 17 00:00:00 2001 From: tophroxx Date: Wed, 28 Jan 2026 21:34:52 +0300 Subject: [PATCH 2/3] bugfix(ui): Use scaled constants instead of plain for window animations --- .../GameClient/GUI/ProcessAnimateWindow.cpp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 3c060e685c0..0493e7b2c26 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -75,13 +75,9 @@ ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { - m_maxVel.x = -40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when windows get this close to their resting - // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up - } //----------------------------------------------------------------------------- @@ -141,6 +137,11 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.x = -static_cast(TheDisplay->scaleVerticalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + //Now initialize the velocities vel.x = m_maxVel.x; vel.y = 0.0f; @@ -261,13 +262,9 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { - m_maxVel.x = 40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when windows get this close to their resting - // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up - } ProcessAnimateWindowSlideFromLeft::~ProcessAnimateWindowSlideFromLeft( void ) { } @@ -322,6 +319,11 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.x = static_cast(TheDisplay->scaleVerticalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + //Now initialize the velocities vel = m_maxVel; @@ -439,13 +441,9 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromTop::ProcessAnimateWindowSlideFromTop( void ) { - m_maxVel.y = 40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when windows get this close to their resting - // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up - } ProcessAnimateWindowSlideFromTop::~ProcessAnimateWindowSlideFromTop( void ) { } @@ -500,6 +498,11 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.y = static_cast(TheDisplay->scaleVerticalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + //Now initialize the velocities vel = m_maxVel; @@ -618,13 +621,9 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromBottom::ProcessAnimateWindowSlideFromBottom( void ) { - m_maxVel.y = -40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when windows get this close to their resting - // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up - } ProcessAnimateWindowSlideFromBottom::~ProcessAnimateWindowSlideFromBottom( void ) { } @@ -680,6 +679,11 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.y = -static_cast(TheDisplay->scaleVerticalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + //Now initialize the velocities vel = m_maxVel; From e6d01cc01a23a4dbda073c4ab4506f8f737737cc Mon Sep 17 00:00:00 2001 From: tophroxx Date: Wed, 28 Jan 2026 23:45:30 +0300 Subject: [PATCH 3/3] fix(ui): use horizontal constants in horizontal animations instead of vertical ones --- .../Source/GameClient/GUI/ProcessAnimateWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 0493e7b2c26..c926ef5c343 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -139,8 +139,8 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = -static_cast(TheDisplay->scaleVerticalConstant(40)); - m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + m_maxVel.x = -static_cast(TheDisplay->scaleHorizontalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleHorizontalConstant(80); //Now initialize the velocities vel.x = m_maxVel.x; @@ -321,8 +321,8 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a // TheSuperHackers @bugfix toph 29/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = static_cast(TheDisplay->scaleVerticalConstant(40)); - m_slowDownThreshold = TheDisplay->scaleVerticalConstant(80); + m_maxVel.x = static_cast(TheDisplay->scaleHorizontalConstant(40)); + m_slowDownThreshold = TheDisplay->scaleHorizontalConstant(80); //Now initialize the velocities vel = m_maxVel;