Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): land a horizontal window slide on its end position

Olcay Seygana76f2e28ba57
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23c0c63af..87966ed17 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -326,7 +326,6 @@ found and fixed — EA's own, not port damage.**
- A single selected unit wears a gold bar filling toward its next rank.
- Timings everywhere: buildings, queues, superweapon charge, upgrades being researched.
- A charge bar now says how many seconds are left.
-- Income per minute sits next to your money, averaged over half a minute.
- Aircraft always show how many attack runs they have left.
- The corner readout separates game time from real time, and sim rate from fps.
- Pausing stops both clocks.
@@ -478,6 +477,7 @@ found and fixed — EA's own, not port damage.**
- The strip of everything your base is building follows the screen too, instead of staying a row of postage stamps under a command bar three times its size.
- On a widescreen monitor the command bar is three pieces instead of one stretched strip. It was drawn for a 4:3 screen and every measurement in it is multiplied by your resolution separately across and down, so at 16:9 the whole thing came out a third wider than it is tall: square build pictures as rectangles, and one slab of metal across the entire bottom edge. The radar now sits hard in the left corner, the build grid in the middle, the selected unit's panel hard in the right corner, each at the size it was drawn at, and the battlefield shows through the two gaps that opens. At 4:3 the three pieces meet and it is the bar it has always been. The three pieces reach the screen: the paintings stop a pixel or two inside their own edges, which left a hairline of ground down both sides and along the bottom, and anything that close to an edge is now that edge. The American middle piece stands on the bottom edge like the other two sides' do, instead of hanging ten units high with a band of battlefield under the build grid, your money now sits in the middle of its readout instead of riding the top rim of it, and the build buttons are centred in the panel they are drawn on instead of pushing against its left edge with a strip of empty metal on the right. The stray pixels along the right-hand edges of the pieces are gone: a one-pixel light line down the side of the middle piece, and a lit speck sitting in the battlefield next to the bottom corner of the Chinese radar. Both were the same thing. The bar's artwork was being rescaled as it went to the graphics card, which left the last column of each picture holding a mirrored copy of it, and the last column of pixels on screen drew from there.
- The rest of the interface is drawn at the command bar's size, not the screen's width. The queue strip, the superweapon countdowns, the generals' powers bar down the right edge and the rank screen were each measured against how wide your monitor is, and the bar they sit beside is measured against the smaller of the two dimensions - so on a 16:9 screen a queue picture came out a third bigger than the build button it is a picture of, and the power slots were oblong where they were drawn square. One size for all of it now, and it is the bar's own.
+- The generals' powers bar stands on the right edge of the screen instead of hanging off it. It slides in from the right when a power is ready, and the slide stopped one step short of where it was going and left the window there - twenty-one pixels out at 1024x768 - so the rightmost column of powers was drawn half off the monitor and could not be clicked. Every panel in the game that slides in sideways had the same fault; the ones that slide up and down never did.
- The writing on a build button keeps its size against the button. The hotkey letter, the price, the build time and the queue count were sized off how wide your monitor is while the bar they sit on is sized off the smaller of its width and its height, so the wider the screen the further the lettering grew away from the cameo underneath it. One size for both now, and it is the bar's.
- An ultrawide monitor gets the same interface as a 16:9 one. Everything still sized off how wide the screen is came apart at 32:9: on a 5120x1440 screen the lettering was drawn at two and a half times what the panel under it had grown to, the clock and speed readout crept into the top corner because its margins were flat pixels, and a health bar reached across the whole base of the building it belonged to. All of it now measures off the same number the command bar does. Scale a 32:9 screenshot down to 16:9 and the two lie on top of each other.
- The camera shows the same ground whatever shape your monitor is. The game holds the angle it sees across the screen fixed and lets the up-and-down angle shrink as the screen widens, which at 32:9 left fifteen degrees of world against twenty-nine at 16:9 - the same barracks filled twice the height of the screen, and it read as a zoom nobody asked for. Above 16:9 the view opens sideways instead, so a wider monitor buys more battlefield rather than a closer look at less of it. Nothing at 16:9 or below moves.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
index d8b82af83..c7feb2a2b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
@@ -218,8 +218,17 @@ Bool ProcessAnimateWindowSlideFromRight::updateAnimateWindow( AnimateWindow *ani
if(curPos.x < endPos.x)
{
+ //
+ // the step that carries the window past its resting place is the one that has to put it
+ // there. Without this the window keeps the last position it was actually written at, which
+ // is up to one velocity step short: the general's powers bar stopped 21 pixels right of the
+ // screen edge at 1024x768 and drew its rightmost column half off the monitor. Every
+ // vertical slide already does this; the three horizontal ones did not.
+ //
curPos.x = endPos.x;
animWin->setFinished( TRUE );
+ win->winSetPosition(curPos.x, curPos.y);
+ animWin->setCurPos(curPos);
return TRUE;
}
win->winSetPosition(curPos.x, curPos.y);
@@ -396,8 +405,11 @@ Bool ProcessAnimateWindowSlideFromLeft::updateAnimateWindow( AnimateWindow *anim
if(curPos.x > endPos.x)
{
+ // see ProcessAnimateWindowSlideFromRight::updateAnimateWindow - the last step has to be written
curPos.x = endPos.x;
animWin->setFinished( TRUE );
+ win->winSetPosition(curPos.x, curPos.y);
+ animWin->setCurPos(curPos);
return TRUE;
}
win->winSetPosition(curPos.x, curPos.y);
@@ -1477,8 +1489,11 @@ Bool ProcessAnimateWindowSlideFromRightFast::updateAnimateWindow( AnimateWindow
if(curPos.x < endPos.x)
{
+ // see ProcessAnimateWindowSlideFromRight::updateAnimateWindow - the last step has to be written
curPos.x = endPos.x;
animWin->setFinished( TRUE );
+ win->winSetPosition(curPos.x, curPos.y);
+ animWin->setCurPos(curPos);
return TRUE;
}
win->winSetPosition(curPos.x, curPos.y);