Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,26 @@
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------

static UnsignedInt scaleHorizontalConstant(UnsignedInt x) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor style: Use

void function()
{
}

return (static_cast<Real>(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth();
}

static UnsignedInt scaleVerticalConstant(UnsignedInt y) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps call these

scaleByDisplayWidth
scaleByDisplayHeight

?

Would be a bit more specific to what they do.

Also how about not modify a value in the functions, but simply return the scaler value.

So do

m_maxVel.x = 40 * getDisplayWidthScaler();

This would be a tiny bit simpler to read.

return (static_cast<Real>(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight();
}

//-----------------------------------------------------------------------------
// ProcessAnimateWindowSlideFromRight PUBLIC FUNCTIONS ////////////////////////
//-----------------------------------------------------------------------------

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

}

//-----------------------------------------------------------------------------
Expand Down Expand 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<Real>(scaleHorizontalConstant(40));
m_slowDownThreshold = scaleHorizontalConstant(80);

//Now initialize the velocities
vel.x = m_maxVel.x;
vel.y = 0.0f;
Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleHorizontalConstant(40));
m_slowDownThreshold = scaleHorizontalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleVerticalConstant(40));
m_slowDownThreshold = scaleVerticalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleVerticalConstant(40));
m_slowDownThreshold = scaleVerticalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,26 @@
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------

static UnsignedInt scaleHorizontalConstant(UnsignedInt x) {
return (static_cast<Real>(x) / DEFAULT_DISPLAY_WIDTH) * TheDisplay->getWidth();
}

static UnsignedInt scaleVerticalConstant(UnsignedInt y) {
return (static_cast<Real>(y) / DEFAULT_DISPLAY_HEIGHT) * TheDisplay->getHeight();
}

//-----------------------------------------------------------------------------
// ProcessAnimateWindowSlideFromRight PUBLIC FUNCTIONS ////////////////////////
//-----------------------------------------------------------------------------

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

}

//-----------------------------------------------------------------------------
Expand Down Expand 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<Real>(scaleHorizontalConstant(40));
m_slowDownThreshold = scaleHorizontalConstant(80);

//Now initialize the velocities
vel.x = m_maxVel.x;
vel.y = 0.0f;
Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleHorizontalConstant(40));
m_slowDownThreshold = scaleHorizontalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleVerticalConstant(40));
m_slowDownThreshold = scaleVerticalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down Expand Up @@ -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 ) { }
Expand Down Expand Up @@ -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<Real>(scaleVerticalConstant(40));
m_slowDownThreshold = scaleVerticalConstant(80);

//Now initialize the velocities
vel = m_maxVel;

Expand Down