From 14ebc3a94f992abc6f8e5ca77fc1a07a7cdaedb8 Mon Sep 17 00:00:00 2001 From: tophroxx Date: Wed, 28 Jan 2026 21:33:22 +0300 Subject: [PATCH 1/9] 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/9] 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/9] 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; From ace4181e4d35227b40805cf10a6d90aeb205a84c Mon Sep 17 00:00:00 2001 From: tophroxx Date: Fri, 30 Jan 2026 01:56:21 +0300 Subject: [PATCH 4/9] fix(ui): Move scaled constant methods from display into animation code --- .../GameEngine/Include/GameClient/Display.h | 3 -- .../GameClient/GUI/ProcessAnimateWindow.cpp | 43 +++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index 2ab4493906e..c6c69b62298 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -90,9 +90,6 @@ 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 diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index c926ef5c343..a1d2ebcb3ce 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -68,6 +68,13 @@ // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- +inline static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { + return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth(); +} + +inline static UnsignedInt scaleVerticalConstant(UnsignedInt y) { + return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight(); +} //----------------------------------------------------------------------------- // ProcessAnimateWindowSlideFromRight PUBLIC FUNCTIONS //////////////////////// @@ -75,7 +82,10 @@ ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { + m_maxVel.x = 0.0f; m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; + 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 } @@ -137,10 +147,10 @@ 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 + // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = -static_cast(TheDisplay->scaleHorizontalConstant(40)); - m_slowDownThreshold = TheDisplay->scaleHorizontalConstant(80); + m_maxVel.x = -static_cast(scaleHorizontalConstant(40)); + m_slowDownThreshold = scaleHorizontalConstant(80); //Now initialize the velocities vel.x = m_maxVel.x; @@ -262,7 +272,10 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { + m_maxVel.x = 0.0f; m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; + 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 } @@ -319,10 +332,10 @@ 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 + // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = static_cast(TheDisplay->scaleHorizontalConstant(40)); - m_slowDownThreshold = TheDisplay->scaleHorizontalConstant(80); + m_maxVel.x = static_cast(scaleHorizontalConstant(40)); + m_slowDownThreshold = scaleHorizontalConstant(80); //Now initialize the velocities vel = m_maxVel; @@ -442,6 +455,9 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromTop::ProcessAnimateWindowSlideFromTop( void ) { m_maxVel.x = 0.0f; + m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; + 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 } @@ -498,10 +514,10 @@ 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 + // TheSuperHackers @bugfix tophroxx 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); + m_maxVel.y = static_cast(scaleVerticalConstant(40)); + m_slowDownThreshold = scaleVerticalConstant(80); //Now initialize the velocities vel = m_maxVel; @@ -622,6 +638,9 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromBottom::ProcessAnimateWindowSlideFromBottom( void ) { m_maxVel.x = 0.0f; + m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; + 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 } @@ -679,10 +698,10 @@ 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 + // TheSuperHackers @bugfix tophroxx 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); + m_maxVel.y = -static_cast(scaleVerticalConstant(40)); + m_slowDownThreshold = scaleVerticalConstant(80); //Now initialize the velocities vel = m_maxVel; From 8ff432892f9a03cd85e1eb71e2351af7d8ee3aee Mon Sep 17 00:00:00 2001 From: tophroxx Date: Fri, 30 Jan 2026 01:58:29 +0300 Subject: [PATCH 5/9] refactor(ui): Remove inline modifier for scaled constant functions --- .../GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index a1d2ebcb3ce..27afd7a1b85 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -68,11 +68,11 @@ // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -inline static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { +static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth(); } -inline static UnsignedInt scaleVerticalConstant(UnsignedInt y) { +static UnsignedInt scaleVerticalConstant(UnsignedInt y) { return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight(); } From 5599f7737b457e1df3db654b0d91575015ad3f9b Mon Sep 17 00:00:00 2001 From: tophroxx Date: Fri, 30 Jan 2026 02:00:53 +0300 Subject: [PATCH 6/9] chore(ui): Restore original comments in animation class constructors --- .../GameClient/GUI/ProcessAnimateWindow.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 27afd7a1b85..315ba41b803 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -82,9 +82,9 @@ static UnsignedInt scaleVerticalConstant(UnsignedInt y) { ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { - m_maxVel.x = 0.0f; + m_maxVel.x = 0.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 0; + m_slowDownThreshold = 0; // 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 @@ -272,9 +272,9 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { - m_maxVel.x = 0.0f; + m_maxVel.x = 0.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 0; + m_slowDownThreshold = 0; // 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 @@ -454,9 +454,9 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromTop::ProcessAnimateWindowSlideFromTop( void ) { - m_maxVel.x = 0.0f; + m_maxVel.x = 0.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 0; + m_slowDownThreshold = 0; // 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 @@ -637,9 +637,9 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow ProcessAnimateWindowSlideFromBottom::ProcessAnimateWindowSlideFromBottom( void ) { - m_maxVel.x = 0.0f; + m_maxVel.x = 0.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 0; + m_slowDownThreshold = 0; // 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 From f62fe204bdf79fb81a8fa8df1af2d0d0ab2e7b32 Mon Sep 17 00:00:00 2001 From: tophroxx Date: Fri, 30 Jan 2026 02:18:45 +0300 Subject: [PATCH 7/9] fix(ui): Replicate animation scaling fix to vanilla Generals, update comments for current date --- .../GameClient/GUI/ProcessAnimateWindow.cpp | 59 +++++++++++++------ .../GameClient/GUI/ProcessAnimateWindow.cpp | 8 +-- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index e247cae758d..881362b2e87 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -68,6 +68,13 @@ // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- +static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { + return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth(); +} + +static UnsignedInt scaleVerticalConstant(UnsignedInt y) { + return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight(); +} //----------------------------------------------------------------------------- // ProcessAnimateWindowSlideFromRight PUBLIC FUNCTIONS //////////////////////// @@ -75,13 +82,12 @@ ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { - m_maxVel.x = -40.0f; // top speed windows travel in x and y + m_maxVel.x = 0.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_slowDownThreshold = 0; // 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 +147,11 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.x = -static_cast(scaleHorizontalConstant(40)); + m_slowDownThreshold = scaleHorizontalConstant(80); + //Now initialize the velocities vel.x = m_maxVel.x; vel.y = 0.0f; @@ -261,13 +272,12 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { - m_maxVel.x = 40.0f; // top speed windows travel in x and y + m_maxVel.x = 0.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_slowDownThreshold = 0; // 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 +332,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 tophroxx 30/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.x = static_cast(scaleHorizontalConstant(40)); + m_slowDownThreshold = scaleHorizontalConstant(80); + //Now initialize the velocities vel = m_maxVel; @@ -439,13 +454,12 @@ 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_maxVel.x = 0.0f; // top speed windows travel in x and y + m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; // 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 +514,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 tophroxx 30/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.y = static_cast(scaleVerticalConstant(40)); + m_slowDownThreshold = scaleVerticalConstant(80); + //Now initialize the velocities vel = m_maxVel; @@ -618,13 +637,12 @@ 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_maxVel.x = 0.0f; // top speed windows travel in x and y + m_maxVel.y = 0.0f; + m_slowDownThreshold = 0; // 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 +698,11 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // for slowdown threshold and velocity. + m_maxVel.y = -static_cast(scaleVerticalConstant(40)); + m_slowDownThreshold = scaleVerticalConstant(80); + //Now initialize the velocities vel = m_maxVel; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 315ba41b803..9772a3f5ac3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -147,7 +147,7 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. m_maxVel.x = -static_cast(scaleHorizontalConstant(40)); m_slowDownThreshold = scaleHorizontalConstant(80); @@ -332,7 +332,7 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. m_maxVel.x = static_cast(scaleHorizontalConstant(40)); m_slowDownThreshold = scaleHorizontalConstant(80); @@ -514,7 +514,7 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. m_maxVel.y = static_cast(scaleVerticalConstant(40)); m_slowDownThreshold = scaleVerticalConstant(80); @@ -698,7 +698,7 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 29/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. m_maxVel.y = -static_cast(scaleVerticalConstant(40)); m_slowDownThreshold = scaleVerticalConstant(80); From 22844ebed26f99639ed44f53807d600edeb147e9 Mon Sep 17 00:00:00 2001 From: tophroxx Date: Sat, 31 Jan 2026 22:25:12 +0300 Subject: [PATCH 8/9] fix(ui): Use scaler functions instead of passing pixel constants into calls --- .../GameClient/GUI/ProcessAnimateWindow.cpp | 38 +++++++++++-------- .../GameClient/GUI/ProcessAnimateWindow.cpp | 38 +++++++++++-------- 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 881362b2e87..63438239c33 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -68,12 +68,14 @@ // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { - return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth(); +static Real getDisplayWidthScaler() +{ + return static_cast(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; } -static UnsignedInt scaleVerticalConstant(UnsignedInt y) { - return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight(); +static Real getDisplayHeightScaler() +{ + return static_cast(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; } //----------------------------------------------------------------------------- @@ -147,10 +149,11 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = -static_cast(scaleHorizontalConstant(40)); - m_slowDownThreshold = scaleHorizontalConstant(80); + const Real widthScaler = getDisplayWidthScaler(); + m_maxVel.x = -40 * widthScaler; + m_slowDownThreshold = 80 * widthScaler; //Now initialize the velocities vel.x = m_maxVel.x; @@ -332,10 +335,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 tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = static_cast(scaleHorizontalConstant(40)); - m_slowDownThreshold = scaleHorizontalConstant(80); + const Real widthScaler = getDisplayWidthScaler(); + m_maxVel.x = 40 * widthScaler; + m_slowDownThreshold = 80 * widthScaler; //Now initialize the velocities vel = m_maxVel; @@ -514,10 +518,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 tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.y = static_cast(scaleVerticalConstant(40)); - m_slowDownThreshold = scaleVerticalConstant(80); + const Real heightScaler = getDisplayHeightScaler(); + m_maxVel.y = 40 * heightScaler; + m_slowDownThreshold = 80 * heightScaler; //Now initialize the velocities vel = m_maxVel; @@ -698,10 +703,11 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.y = -static_cast(scaleVerticalConstant(40)); - m_slowDownThreshold = scaleVerticalConstant(80); + const Real heightScaler = getDisplayHeightScaler(); + m_maxVel.y = -40 * heightScaler; + m_slowDownThreshold = 80 * heightScaler; //Now initialize the velocities vel = m_maxVel; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 9772a3f5ac3..e53a1d42564 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -68,12 +68,14 @@ // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -static UnsignedInt scaleHorizontalConstant(UnsignedInt x) { - return (static_cast(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth(); +static Real getDisplayWidthScaler() +{ + return static_cast(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; } -static UnsignedInt scaleVerticalConstant(UnsignedInt y) { - return (static_cast(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight(); +static Real getDisplayHeightScaler() +{ + return static_cast(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; } //----------------------------------------------------------------------------- @@ -147,10 +149,11 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = -static_cast(scaleHorizontalConstant(40)); - m_slowDownThreshold = scaleHorizontalConstant(80); + const Real widthScaler = getDisplayWidthScaler(); + m_maxVel.x = -40 * widthScaler; + m_slowDownThreshold = 80 * widthScaler; //Now initialize the velocities vel.x = m_maxVel.x; @@ -332,10 +335,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 tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.x = static_cast(scaleHorizontalConstant(40)); - m_slowDownThreshold = scaleHorizontalConstant(80); + const Real widthScaler = getDisplayWidthScaler(); + m_maxVel.x = 40 * widthScaler; + m_slowDownThreshold = 80 * widthScaler; //Now initialize the velocities vel = m_maxVel; @@ -514,10 +518,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 tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.y = static_cast(scaleVerticalConstant(40)); - m_slowDownThreshold = scaleVerticalConstant(80); + const Real heightScaler = getDisplayHeightScaler(); + m_maxVel.y = 40 * heightScaler; + m_slowDownThreshold = 80 * heightScaler; //Now initialize the velocities vel = m_maxVel; @@ -698,10 +703,11 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 30/01/2026 Use scaled pixel constants + // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants // for slowdown threshold and velocity. - m_maxVel.y = -static_cast(scaleVerticalConstant(40)); - m_slowDownThreshold = scaleVerticalConstant(80); + const Real heightScaler = getDisplayHeightScaler(); + m_maxVel.y = -40 * heightScaler; + m_slowDownThreshold = 80 * heightScaler; //Now initialize the velocities vel = m_maxVel; From ed8f3c123b8534ee1ccddf8ab6661fe65d55a10f Mon Sep 17 00:00:00 2001 From: tophroxx Date: Sun, 1 Feb 2026 01:45:13 +0300 Subject: [PATCH 9/9] chore(ui): Make better comments regarding window animation fixes --- .../GameClient/GUI/ProcessAnimateWindow.cpp | 16 ++++++++-------- .../GameClient/GUI/ProcessAnimateWindow.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 63438239c33..347addb6c90 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -149,8 +149,8 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real widthScaler = getDisplayWidthScaler(); m_maxVel.x = -40 * widthScaler; m_slowDownThreshold = 80 * widthScaler; @@ -335,8 +335,8 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real widthScaler = getDisplayWidthScaler(); m_maxVel.x = 40 * widthScaler; m_slowDownThreshold = 80 * widthScaler; @@ -518,8 +518,8 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real heightScaler = getDisplayHeightScaler(); m_maxVel.y = 40 * heightScaler; m_slowDownThreshold = 80 * heightScaler; @@ -703,8 +703,8 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real heightScaler = getDisplayHeightScaler(); m_maxVel.y = -40 * heightScaler; m_slowDownThreshold = 80 * heightScaler; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index e53a1d42564..f4eef9e6b74 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -149,8 +149,8 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real widthScaler = getDisplayWidthScaler(); m_maxVel.x = -40 * widthScaler; m_slowDownThreshold = 80 * widthScaler; @@ -335,8 +335,8 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real widthScaler = getDisplayWidthScaler(); m_maxVel.x = 40 * widthScaler; m_slowDownThreshold = 80 * widthScaler; @@ -518,8 +518,8 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real heightScaler = getDisplayHeightScaler(); m_maxVel.y = 40 * heightScaler; m_slowDownThreshold = 80 * heightScaler; @@ -703,8 +703,8 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow //set the window's position to the new start positions. win->winSetPosition(startPos.x, startPos.y); - // TheSuperHackers @bugfix tophroxx 31/01/2026 Use scaled pixel constants - // for slowdown threshold and velocity. + // TheSuperHackers @bugfix tophroxx 31/01/2026 Scale movement by display size so that it looks + // consistent regardless of the display resolution. const Real heightScaler = getDisplayHeightScaler(); m_maxVel.y = -40 * heightScaler; m_slowDownThreshold = 80 * heightScaler;