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
fix(gameclient): army screen list scrolls, tiles keep their size
Olcay Seygan28e9b6f99a37
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9d2ebf697..a9f5c7449 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -352,7 +352,7 @@ found and fixed, EA's own, not port damage.**- A computer player on a mod's army now plays that mod's own plan. Contra's scripts pressed Zero Hour's buttons of the same name, so its GLA stash trucks never trained a worker and earned about a thousand in ten minutes, and its scripts looked for supply piles under a name no map uses. On Hard Contra's GLA now earns 18,000 to 36,000 in the same ten minutes, its USA and China about twice what they did.- Zero Hour's armies play the very same match with a mod loaded as without it, on every difficulty. Their computer players used to look through the mod's units for a scout too, and one that nobody could train cost them the scout.- A long army name in a room now shrinks to fit the field, and only that name.-- A mod's armies always stand beside Zero Hour's, never over them, one mod or five. Contra alone used to swap every USA, China and GLA in the room for its own and leave you nothing else to play. Now the list holds Zero Hour's armies and under them "Contra - Tank General" and the rest, so a Contra general can fight a plain Zero Hour China in one match. No switch asks for this and none turns it off. A plain Random stays with Zero Hour's armies; a mod's army plays when somebody picks it or ticks it into a Custom Selection. On the army screen each mod's generals gather under one heading a country, "Contra - USA", where Contra's twelve used to make twelve headings and run off the screen. Playing a mod's army you hear that mod's music tracks, so the Enhanced Music pack for Contra plays in the match.+- A mod's armies always stand beside Zero Hour's, never over them, one mod or five. Contra alone used to swap every USA, China and GLA in the room for its own and leave you nothing else to play. Now the list holds Zero Hour's armies and under them "Contra - Tank General" and the rest, so a Contra general can fight a plain Zero Hour China in one match. No switch asks for this and none turns it off. A plain Random stays with Zero Hour's armies; a mod's army plays when somebody picks it or ticks it into a Custom Selection. On the army screen each mod's generals gather under one heading a country, "Contra - USA", where Contra's twelve used to make twelve headings and run off the screen. More armies also used to shrink every tile on that screen, to about a third of its size at worst. The tiles now keep their size under any number of mods and the list scrolls, by the wheel or the bar beside it, opening with your seat's army in view. Playing a mod's army you hear that mod's music tracks, so the Enhanced Music pack for Contra plays in the match.- Reforged stays on top of every mod. This build's balance, its fixes to EA's data, its AI and its menus load after the mod and win where they touch the same unit, weapon or button, on Zero Hour's armies; a mod's army keeps its own numbers and buttons. A change that names something the mod renamed or removed is passed over instead of stopping the game, which is how ShockWave starts and plays. A mod's own copy of a file Reforged ships, the skirmish setup screen among them, is ignored, and so are any upscaled art archives it carries. The one exception is the skirmish AI's scripts: a mod's are written for its own generals, so they replace Reforged's, and Reforged's smarter AI plays them.- A mod no longer repaints the game around it. Shockwave Chaos set the whole skirmish lobby in Comic Sans, with its own yellow-edged boxes, loading bars, main menu backdrop and score screens, because its archives replaced the font list, the shell's image sheets and the pictures they are cut from. Every menu and lobby layout, the fonts, the shell's colours and frames and the in-match screens are ours now under any mod. The mod's units, their build pictures and its generals with their portraits still come from the mod, and its new generals still appear in the lobby's faction list.- The maps stay Zero Hour's under every mod. A mod that carries its own maps, Contra among them, used to fill the skirmish and LAN map lists with them, and its edited copies of the stock maps replaced ours under the same names: picking Twilight Flame started Contra's Twilight Flame. The map list and every map you start are Zero Hour's and Reforged's now, whatever mods are loaded, so everyone in a lobby plays the same map.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/FactionPicker.h b/GeneralsMD/Code/GameEngine/Include/GameClient/FactionPicker.hindex 8c72a0fa5..afcec39b7 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/FactionPicker.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/FactionPicker.h@@ -50,5 +50,9 @@ void FactionPickerOpenOnStart( Bool custom, const char *side );Bool FactionPickerSideTicked( UnsignedInt pool, UnsignedInt side );/// a click on a side's tick box: the whole side in, or out when it was all in alreadyUnsignedInt FactionPickerToggleSide( UnsignedInt pool, UnsignedInt side );+/// the army list's bar, in pixels: where the thumb stands below the track's top at a scroll+Int FactionPickerThumbTop( Int scroll, Int scrollMax, Int track, Int thumb );+/// the scroll a thumb held at thumbTop means, reaching both ends of the list however it rounds+Int FactionPickerScrollAtThumb( Int thumbTop, Int scrollMax, Int track, Int thumb );#endif // _FACTIONPICKER_H_diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cppindex fe88c4539..85e562587 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp@@ -23,7 +23,8 @@// sides' headings with Random All and Custom Selection over them, the focused army's portrait, name// and description on the right, Back and Confirm in the room's button row. It reads the armies from// the seat's own box, so whatever the box lists (the generals, a mod's sides, Observer where the room-// has one) is what the screen offers, and it hands the pick back through the box.+// has one) is what the screen offers, and it hands the pick back through the box. Every tile is one+// size whatever the box lists; a list taller than its place scrolls, with the wheel and a bar.//// Custom Selection ticks the Random pool. A ticked pool goes into the seat's faction number// (EncodeRandomPool, GameInfo.h), which every room already sends to the host and the host to every@@ -73,6 +74,8 @@ static const Real HEADING_HEIGHT = 34.0f;static const Real GROUP_GAP = 10.0f;static const Real CELL = 112.0f;static const Real CELL_GAP = 12.0f;+static const Real BAR_WIDTH = 20.0f; // in the 28 left over beside five columns of tiles+static const Real BAR_MIN_THUMB = 48.0f;static const Real PORTRAIT_BOTTOM = 440.0f;static const Real BANNER_BOTTOM = 504.0f;static const Real DESCRIPTION_TOP = 516.0f;@@ -137,6 +140,10 @@ static DisplayString *s_randomMark = NULL;static std::vector<DisplayString *> s_featureText;static IRegion2D s_panelBox, s_tabBox[ 2 ], s_backBox, s_confirmBox, s_portraitBox, s_bannerBox, s_descriptionBox;+static IRegion2D s_gridBox, s_barBox;+static Int s_scroll = 0; ///< pixels of the list above the grid's top+static Int s_scrollMax = 0; ///< 0 when the whole list fits, and then there is no bar+static Int s_thumbGrab = -1; ///< how far down the thumb the mouse holds it, -1 when it does not//-------------------------------------------------------------------------------------------------static DisplayString *newText( const UnicodeString &text, GameFont *font )@@ -262,6 +269,8 @@ static UnsignedInt listedMask( void )static Int cellAt( Int x, Int y ){+ if( !isInside( s_gridBox, x, y ) )+ return -1;for( size_t each = 0; each < s_cells.size(); each++ ){if( isInside( s_cells[ each ].box, x, y ) )@@ -286,6 +295,8 @@ static Int poolSide( void )static Int sideAt( Int x, Int y, Bool tickBox ){+ if( !isInside( s_gridBox, x, y ) )+ return -1;for( size_t group = 0; group < s_groups.size(); group++ ){const PickerGroup &g = s_groups[ group ];@@ -395,7 +406,7 @@ static void buildCells( void )}// A mod lists its generals in any order and its plain side last (Contra), so its groups go by- // BaseSide: one heading a country, and the screen fits however many generals it brings.+ // BaseSide: one heading a country, however many generals it brings.size_t group = 0;for( ; group < s_groups.size(); group++ ){@@ -421,38 +432,34 @@ static void buildCells( void )}}-/** Places everything; the cells shrink until every group fits above the button row. */+/** Places everything with the list at its top; what does not fit under the grid's bottom scrolls. */static void layout( void ){s_panelBox = boardBox( UIStyle::ROOM_PANEL_LEFT, UIStyle::ROOM_PANEL_TOP, UIStyle::ROOM_PANEL_RIGHT, UIStyle::ROOM_PANEL_BOTTOM );const Real tabWidth = ( GRID_RIGHT - LEFT - TAB_GAP ) / 2;s_tabBox[ 0 ] = boardBox( LEFT, TOP, LEFT + tabWidth, TOP + TAB_HEIGHT );s_tabBox[ 1 ] = boardBox( GRID_RIGHT - tabWidth, TOP, GRID_RIGHT, TOP + TAB_HEIGHT );+ s_gridBox = boardBox( LEFT, GRID_TOP, GRID_RIGHT - BAR_WIDTH, GRID_BOTTOM );+ s_barBox = boardBox( GRID_RIGHT - BAR_WIDTH, GRID_TOP, GRID_RIGHT, GRID_BOTTOM );- Real cell = CELL;- Int columns = 1;- for( ;; )- {- columns = max( 1, (Int)( ( GRID_RIGHT - LEFT + CELL_GAP ) / ( cell + CELL_GAP ) ) );- Real height = 0;- for( size_t group = 0; group < s_groups.size(); group++ )- {- const Int rows = ( (Int)s_groups[ group ].cells.size() + columns - 1 ) / columns;- height += HEADING_HEIGHT + rows * ( cell + CELL_GAP ) + GROUP_GAP;- }- if( height <= GRID_BOTTOM - GRID_TOP || cell <= 40.0f )- break;- cell -= 8.0f;- }-+ const Int columns = (Int)( ( GRID_RIGHT - LEFT + CELL_GAP ) / ( CELL + CELL_GAP ) );Real y = GRID_TOP;for( size_t group = 0; group < s_groups.size(); group++ ){PickerGroup &g = s_groups[ group ];+ g.heading->setClipRegion( &s_gridBox );g.at.x = UIStyle::boardX( LEFT );g.at.y = UIStyle::boardY( y );Int nameWidth, nameHeight;- g.heading->getSize( &nameWidth, &nameHeight );+ // text shrinks slower than the board, and at 1024x768 the heading's letters ran under the tiles+ const UIStyle::TextSize headingSizes[] = { UIStyle::TEXT_HEADING, UIStyle::TEXT_STRONG, UIStyle::TEXT_BODY };+ for( size_t size = 0; size < ARRAY_SIZE( headingSizes ); size++ )+ {+ g.heading->setFont( UIStyle::font( headingSizes[ size ] ) );+ g.heading->getSize( &nameWidth, &nameHeight );+ if( nameHeight <= UIStyle::px( HEADING_HEIGHT ) )+ break;+ }g.nameBox.lo = g.at;g.nameBox.hi.x = g.at.x + nameWidth;g.nameBox.hi.y = g.at.y + nameHeight;@@ -464,15 +471,22 @@ static void layout( void )y += HEADING_HEIGHT;for( size_t each = 0; each < g.cells.size(); each++ ){- const Real x = LEFT + ( each % columns ) * ( cell + CELL_GAP );- const Real top = y + ( each / columns ) * ( cell + CELL_GAP );+ const Real x = LEFT + ( each % columns ) * ( CELL + CELL_GAP );+ const Real top = y + ( each / columns ) * ( CELL + CELL_GAP );PickerCell &c = s_cells[ g.cells[ each ] ];- c.box = boardBox( x, top, x + cell, top + cell );+ c.box = boardBox( x, top, x + CELL, top + CELL );+ c.box.hi.x = c.box.lo.x + UIStyle::px( CELL ); // one size however the board's corners round+ c.box.hi.y = c.box.lo.y + UIStyle::px( CELL );if( c.label )+ {c.label->setWordWrap( boxWidth( c.box ) - UIStyle::px( 8 ) );+ c.label->setClipRegion( &s_gridBox );+ }}- y += ( ( (Int)g.cells.size() + columns - 1 ) / columns ) * ( cell + CELL_GAP ) + GROUP_GAP;+ y += ( ( (Int)g.cells.size() + columns - 1 ) / columns ) * ( CELL + CELL_GAP ) + GROUP_GAP;}+ s_scroll = 0;+ s_scrollMax = max( 0, UIStyle::boardY( y - CELL_GAP - GROUP_GAP ) - s_gridBox.hi.y );s_portraitBox = boardBox( DETAIL_LEFT, TOP, RIGHT, PORTRAIT_BOTTOM );s_bannerBox = boardBox( DETAIL_LEFT, PORTRAIT_BOTTOM + 8.0f, RIGHT, BANNER_BOTTOM );@@ -481,6 +495,49 @@ static void layout( void )s_confirmBox = boardBox( RIGHT - UIStyle::ROOM_WIDE_BUTTON_WIDTH, UIStyle::ROOM_BUTTON_TOP, RIGHT, UIStyle::ROOM_BUTTON_BOTTOM );}+/** The boxes stay in screen pixels, so a scroll moves them and drawing and clicks need nothing else. */+static void setScroll( Int scroll )+{+ scroll = max( 0, min( scroll, s_scrollMax ) );+ const Int shift = s_scroll - scroll;+ s_scroll = scroll;+ for( size_t each = 0; each < s_cells.size(); each++ )+ {+ s_cells[ each ].box.lo.y += shift;+ s_cells[ each ].box.hi.y += shift;+ }+ for( size_t group = 0; group < s_groups.size(); group++ )+ {+ PickerGroup &g = s_groups[ group ];+ g.at.y += shift;+ g.nameBox.lo.y += shift;+ g.nameBox.hi.y += shift;+ g.tickBox.lo.y += shift;+ g.tickBox.hi.y += shift;+ }+}++static Int thumbHeight( void )+{+ const Int track = boxHeight( s_barBox );+ return max( UIStyle::px( BAR_MIN_THUMB ), track * track / ( track + s_scrollMax ) );+}++static void dragThumb( Int y )+{+ setScroll( FactionPickerScrollAtThumb( y - s_barBox.lo.y - s_thumbGrab, s_scrollMax, boxHeight( s_barBox ), thumbHeight() ) );+}++/// on the thumb the press takes hold of it where it is; on the track the thumb comes to the mouse+static void pressBar( Int y )+{+ const Int top = s_barBox.lo.y + FactionPickerThumbTop( s_scroll, s_scrollMax, boxHeight( s_barBox ), thumbHeight() );+ const Bool onThumb = y >= top && y < top + thumbHeight();+ s_thumbGrab = onThumb ? y - top : thumbHeight() / 2;+ if( !onThumb )+ dragThumb( y );+}+/** The name, the description and the Confirm label follow the focus. */static void refresh( void ){@@ -577,10 +634,35 @@ static void drawCellPicture( const PickerCell &cell, const IRegion2D &box )drawCentred( cell.label, box, UIStyle::INK );}+/// the clip draws an open box's top and left line a pixel out, so only what the grid's edge cuts takes it+static void clipIfCut( const IRegion2D &box )+{+ if( box.lo.y < s_gridBox.lo.y || box.hi.y > s_gridBox.hi.y )+ TheDisplay->setClipRegion( &s_gridBox );+ else+ TheDisplay->enableClipping( FALSE );+}++/// the display's clip stops images and open boxes, and a filled box goes round it+static void fillInGrid( Int x, Int y, Int width, Int height, Color color )+{+ const Int top = max( y, s_gridBox.lo.y );+ const Int bottom = min( y + height, s_gridBox.hi.y );+ if( bottom > top )+ TheDisplay->drawFillRect( x, top, width, bottom - top, color );+}++static void panelInGrid( Int x, Int y, Int width, Int height, Color fill )+{+ fillInGrid( x, y, width, height, fill );+ TheDisplay->drawOpenRect( x, y, width, height, 1.0f, UIStyle::FRAME );+}+static void drawTickBox( Int x, Int y, Int size, Bool ticked ){- UIStyle::panel( x, y, size, size, ticked ? UIStyle::ACTIVE : UIStyle::CARD );- if( !ticked )+ panelInGrid( x, y, size, size, ticked ? UIStyle::ACTIVE : UIStyle::CARD );+ // the check mark's lines go round the clip too, and half a tick says nothing+ if( !ticked || y < s_gridBox.lo.y || y + size > s_gridBox.hi.y )return;const Real line = (Real)max( 2, UIStyle::px( 3 ) );TheDisplay->drawLine( x + size / 5, y + size / 2, x + size * 2 / 5, y + size * 3 / 4, line, UIStyle::GROUND );@@ -653,13 +735,15 @@ static void drawPicker( GameWindow *window, WinInstanceData *instData )}const ICoord2D mouse = TheMouse->getMouseStatus()->pos;+ const Bool mouseInGrid = isInside( s_gridBox, mouse.x, mouse.y );for( size_t group = 0; group < s_groups.size(); group++ ){// the name is a button (that side alone), lit under the mouse; the box is Custom Selection'sconst PickerGroup &g = s_groups[ group ];const Bool narrows = g.mask != 0;- const Bool hovered = narrows && isInside( g.nameBox, mouse.x, mouse.y );+ const Bool hovered = narrows && mouseInGrid && isInside( g.nameBox, mouse.x, mouse.y );g.heading->draw( g.at.x, g.at.y, hovered ? UIStyle::EDGE_LIT : UIStyle::ACTIVE, UIStyle::SHADOW );+ clipIfCut( g.tickBox );if( s_custom && narrows )drawTickBox( g.tickBox.lo.x, g.tickBox.lo.y, boxWidth( g.tickBox ), FactionPickerSideTicked( s_mask, g.mask ) );}@@ -667,7 +751,11 @@ static void drawPicker( GameWindow *window, WinInstanceData *instData ){const PickerCell &cell = s_cells[ each ];const IRegion2D &box = cell.box;- UIStyle::panel( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ), UIStyle::CARD );+ // the display's clip takes a picture wholly under the grid for a turned-over one+ if( box.hi.y <= s_gridBox.lo.y || box.lo.y >= s_gridBox.hi.y )+ continue;+ clipIfCut( box );+ panelInGrid( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ), UIStyle::CARD );drawCellPicture( cell, box );const Int inset = UIStyle::px( 6 );@@ -675,7 +763,7 @@ static void drawPicker( GameWindow *window, WinInstanceData *instData ){// out of the pool reads as greyed; an army that cannot go in a pool has no box to tickif( !isTicked( cell ) )- TheDisplay->drawFillRect( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ), UIStyle::withAlpha( UIStyle::GROUND, 150 ) );+ fillInGrid( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ), UIStyle::withAlpha( UIStyle::GROUND, 150 ) );if( cell.poolBit >= 0 ){const Int size = UIStyle::px( SIDE_TICK );@@ -684,9 +772,16 @@ static void drawPicker( GameWindow *window, WinInstanceData *instData )}if( (Int)each == s_focus )UIStyle::edge( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ) );- else if( isInside( box, mouse.x, mouse.y ) )+ else if( mouseInGrid && isInside( box, mouse.x, mouse.y ) )TheDisplay->drawOpenRect( box.lo.x, box.lo.y, boxWidth( box ), boxHeight( box ), 1.0f, UIStyle::EDGE_LIT );}+ TheDisplay->enableClipping( FALSE );+ if( s_scrollMax > 0 )+ {+ UIStyle::panel( s_barBox.lo.x, s_barBox.lo.y, boxWidth( s_barBox ), boxHeight( s_barBox ), UIStyle::CARD );+ const Int top = s_barBox.lo.y + FactionPickerThumbTop( s_scroll, s_scrollMax, boxHeight( s_barBox ), thumbHeight() );+ UIStyle::button( s_barBox.lo.x, top, boxWidth( s_barBox ), thumbHeight() );+ }UIStyle::panel( s_portraitBox.lo.x, s_portraitBox.lo.y, boxWidth( s_portraitBox ), boxHeight( s_portraitBox ), UIStyle::CARD );IRegion2D portraitInner = s_portraitBox;@@ -768,6 +863,10 @@ static void confirm( void )if( !canConfirm() )return;const Int pick = s_focus >= 0 ? s_cells[ s_focus ].pick : ( s_custom ? EncodeRandomPool( s_mask & listedMask() ) : (Int)PLAYERTEMPLATE_RANDOM );+ AsciiString pickedName;+ if( s_focus >= 0 )+ pickedName.translate( s_cells[ s_focus ].name );+ DEBUG_LOG(( "FACTIONPICKER confirm pick %d \"%s\" list scrolled %d of %d\n", pick, pickedName.str(), s_scroll, s_scrollMax ));GameWindow *combo = s_combo;closePicker( TRUE );@@ -888,8 +987,26 @@ static WindowMsgHandledType pickerInput( GameWindow *window, UnsignedInt msg, Wiconfirm();}break;+ case GWM_WHEEL_UP:+ setScroll( s_scroll - UIStyle::px( CELL + CELL_GAP ) );+ break;+ case GWM_WHEEL_DOWN:+ setScroll( s_scroll + UIStyle::px( CELL + CELL_GAP ) );+ break;+ case GWM_LEFT_DOWN:+ if( s_scrollMax > 0 && isInside( s_barBox, x, y ) )+ pressBar( y );+ break;+ case GWM_LEFT_DRAG:+ if( s_thumbGrab >= 0 )+ dragThumb( y );+ break;case GWM_LEFT_UP:- releaseAt( x, y );+ // a press that took the thumb ends here wherever the mouse went, on a tile or not+ if( s_thumbGrab >= 0 )+ s_thumbGrab = -1;+ else+ releaseAt( x, y );break;}// nothing under the screen sees the mouse or the keys while it is up@@ -931,6 +1048,7 @@ static void openPicker( GameWindow *combo )s_custom = current < PLAYERTEMPLATE_RANDOM_POOL;s_focus = -1;s_lastPressCell = -1;+ s_thumbGrab = -1;for( size_t each = 0; each < s_cells.size(); each++ ){if( s_cells[ each ].pick == current )@@ -946,6 +1064,8 @@ static void openPicker( GameWindow *combo )s_strategyText = newText( UnicodeString::TheEmptyString, UIStyle::font( UIStyle::TEXT_STRONG ) );s_randomMark = newText( UnicodeString( u"?" ), UIStyle::titleFont( UIStyle::TEXT_DISPLAY ) );layout();+ if( s_focus >= 0 )+ setScroll( s_cells[ s_focus ].box.hi.y - s_gridBox.hi.y ); // the seat's army in view, at the foot when it has to scrolls_strategyText->setWordWrap( boxWidth( s_descriptionBox ) - UIStyle::px( 2 * PAD ) );refresh();@@ -1051,3 +1171,14 @@ UnsignedInt FactionPickerToggleSide( UnsignedInt pool, UnsignedInt side ){return FactionPickerSideTicked( pool, side ) ? pool & ~side : pool | side;}++Int FactionPickerThumbTop( Int scroll, Int scrollMax, Int track, Int thumb )+{+ return scrollMax > 0 ? scroll * ( track - thumb ) / scrollMax : 0;+}++Int FactionPickerScrollAtThumb( Int thumbTop, Int scrollMax, Int track, Int thumb )+{+ const Int travel = track - thumb;+ return max( 0, min( thumbTop, travel ) ) * scrollMax / travel;+}diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 9059a6cbf..2a018b07b 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -7620,6 +7620,21 @@ TEST(gameslot_restores_the_pre_randomization_setup_on_a_restart)CHECK_EQ( fixed.getOriginalColor(), -1 );}+/* The army list's bar: the thumb's ends are the list's ends, and a thumb pulled past them stops. */+TEST(faction_picker_bar_reaches_both_ends_of_the_list)+{+ const Int scrollMax = 2500, track = 684, thumb = 145;+ CHECK_EQ( FactionPickerThumbTop( 0, scrollMax, track, thumb ), 0 );+ CHECK_EQ( FactionPickerThumbTop( scrollMax, scrollMax, track, thumb ), track - thumb );+ CHECK_EQ( FactionPickerThumbTop( 0, 0, track, track ), 0 );+ CHECK_EQ( FactionPickerScrollAtThumb( 0, scrollMax, track, thumb ), 0 );+ CHECK_EQ( FactionPickerScrollAtThumb( track - thumb, scrollMax, track, thumb ), scrollMax );+ CHECK_EQ( FactionPickerScrollAtThumb( -30, scrollMax, track, thumb ), 0 );+ CHECK_EQ( FactionPickerScrollAtThumb( track, scrollMax, track, thumb ), scrollMax );+ const Int there = FactionPickerScrollAtThumb( FactionPickerThumbTop( 1000, scrollMax, track, thumb ), scrollMax, track, thumb );+ CHECK( there > 990 && there <= 1000 );+}+/* A front-end title is set in capitals, and towupper in the C locale stops at ASCII: the armyscreen's Turkish title came out "ORDU SEç". Turkish's i takes its dot along only in Turkish. */TEST(capitals_reach_turkish_and_cyrillic_letters)