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
feat(gameclient): summary is the only score screen, table removed
Olcay Seygan0ca8db74a74c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 52d131a63..d1ee4f88a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,7 +10,7 @@ found and fixed — EA's own, not port damage.**## A summary and graphs on the score screen-- After a skirmish, a LAN or online match or a replay the score screen opens on a summary: one row per player with its side, units built, lost and destroyed, buildings built and money earned, and the winner marked. The Scores button beside OK swaps it for the full score table and back.+- The old score table with its rows of icons and the Tactical Analysis box is gone. Every score screen, skirmish, LAN, online, replay and campaign mission alike, opens on one summary: a row per player with its side, units built, lost and destroyed, buildings built, lost and destroyed, and money earned, the winner marked. In a campaign mission your enemies share one row per side, as they did in the old table. Generals' Challenge keeps the general's portrait and verdict it always had.- Under the summary one chart at a time draws a line per player over the whole match: money earned, army size or buildings standing. Army size counts infantry, vehicles and aircraft; workers and supply trucks are left out.- A single row of small pictures above the chart marks superweapons built and fired, general's powers and promotions, framed in the player's colour. Moments that fall close together share one picture with a count on it. Hover over it for the list, each line with its time, and a faint line down to where each one falls on the chart.- The Build order tab puts the first of each structure and unit each player made on a timeline whose first five minutes take over half the width, so an opening reads at a glance. Show every build adds the rest; hover over a picture for its name and time.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex ba59363b0..d56443667 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -2001,24 +2001,32 @@ GUI:LobbyRecordCloseEND// The score screen's summary panel (ScoreScreenGraphs.cpp)-GUI:ScoreSummary-"SUMMARY"+GUI:SummaryUnits+"Units"END-GUI:ScoreTable-"SCORES"+GUI:SummaryMoney+"Money"ENDGUI:SummaryUnitsBuilt-"Units built"+"Built"END-GUI:SummaryUnitsDestroyed-"Units destroyed"+GUI:SummaryBuildingsBuilt+"Built"END-GUI:SummaryBuildingsBuilt-"Buildings built"+GUI:SummaryLost+"Lost"+END++GUI:SummaryDestroyed+"Destroyed"+END++GUI:SummaryEarned+"Earned"ENDGUI:SummaryWinner@@ -2045,10 +2053,6 @@ GUI:GraphBuildings"Buildings"END-GUI:GraphLost-"Units lost"-END-GUI:GraphBuildOrder"Build order"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex e2f0eaf4c..557ffc640 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -16389,24 +16389,32 @@ GUI:LobbyRecordClose"Kapat"END-GUI:ScoreSummary-"ÖZET"+GUI:SummaryUnits+"Birlikler"END-GUI:ScoreTable-"SKORLAR"+GUI:SummaryMoney+"Para"ENDGUI:SummaryUnitsBuilt-"Üretilen birlik"+"Üretilen"END-GUI:SummaryUnitsDestroyed-"Yok edilen birlik"+GUI:SummaryBuildingsBuilt+"İnşa edilen"END-GUI:SummaryBuildingsBuilt-"İnşa edilen bina"+GUI:SummaryLost+"Kaybedilen"+END++GUI:SummaryDestroyed+"Yok edilen"+END++GUI:SummaryEarned+"Kazanılan"ENDGUI:SummaryWinner@@ -16433,10 +16441,6 @@ GUI:GraphBuildings"Binalar"END-GUI:GraphLost-"Kaybedilen birlik"-END-GUI:GraphBuildOrder"İnşa sırası"ENDdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cppindex fa89ecb66..d4046a6eb 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp@@ -93,7 +93,6 @@#include "GameClient/GadgetTextEntry.h"#include "GameClient/GadgetPushButton.h"#include "GameClient/CampaignManager.h"-#include "GameClient/GameWindowTransitions.h"#include "GameClient/VideoPlayer.h"#include "GameNetwork/GameSpy/PeerDefs.h"#include "GameNetwork/GameSpy/GameResultsThread.h"@@ -146,20 +145,16 @@ static Bool overidePlayerDisplayName = FALSE;NameKeyType listboxChatWindowScoreScreenID = NAMEKEY_INVALID;GameWindow *listboxChatWindowScoreScreen = NULL;-NameKeyType listboxAcademyWindowScoreScreenID = NAMEKEY_INVALID;-GameWindow *listboxAcademyWindowScoreScreen = NULL;-NameKeyType staticTextAcademyTitleID = NAMEKEY_INVALID;-GameWindow *staticTextAcademyTitle = NULL;-std::string LastReplayFileName;static Bool canSaveReplay = FALSE;extern void PopupReplayUpdate(WindowLayout *layout, void *userData);-// the summary panel and the button that swaps it with the score table, ScoreScreenGraphs.cpp+// the summary and graphs panel that replaces the layout's score table, ScoreScreenGraphs.cppextern void ScoreScreenGraphsInit( GameWindow *parent, GameWindow *anchor );extern void ScoreScreenGraphsAddPlayer( Player *player, const UnicodeString &name, Color color );-extern void ScoreScreenGraphsShow( Bool show );-extern Bool ScoreScreenGraphsSelected( GameWindow *control );+extern void ScoreScreenGraphsAddSide( const UnicodeString &name, Color color, Int unitsBuilt, Int unitsLost, Int unitsDestroyed,+ Int buildingsBuilt, Int buildingsLost, Int buildingsDestroyed, Int earned );+extern void ScoreScreenGraphsShow( GameWindow *floor );extern void ScoreScreenGraphsShutdown( void );void initSinglePlayer( void );@@ -175,9 +170,8 @@ void initReplayMultiPlayer(void);void initReplaySinglePlayer(void);void grabMultiPlayerInfo( void );void grabSinglePlayerInfo( void );-void hideWindows( Int pos );+static void hideScoreTable( void );void ScoreScreenEnableControls(Bool enable);-void setObserverWindows( Player *player, Int i );void displayChallengewinLoss( Image *imageGeneral, AsciiString strGeneral );enum {SCORESCREEN_SINGLEPLAYER = 0,@@ -198,9 +192,7 @@ struct ScoreGatherInt m_totalBuildingsDestroyed; ///< The total number of Buildings we've destroyedInt m_totalBuildingsBuilt; ///< The total number of buildings we've constructedInt m_totalBuildingsLost; ///< The total number of our buildings lost- const Image *m_sideImage;};-void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color);//-----------------------------------------------------------------------------// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////-----------------------------------------------------------------------------@@ -288,8 +280,6 @@ void ScoreScreenInit( WindowLayout *layout, void *userData )textEntryChatID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:TextEntryChat" ) );buttonEmoteID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ButtonEmote" ) );listboxChatWindowScoreScreenID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ListboxChatWindowScoreScreen" ) );- listboxAcademyWindowScoreScreenID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ListboxWarschoolAdvice" ) );- staticTextAcademyTitleID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:StaticTextWarSchool" ) );// buttonRehostID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ButtonRehost" ) );chatBoxBorderID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ChatBoxBorder" ) );buttonBuddiesID = TheNameKeyGenerator->nameToKey( AsciiString( "ScoreScreen.wnd:ButtonBuddy" ) );@@ -302,8 +292,6 @@ void ScoreScreenInit( WindowLayout *layout, void *userData )textEntryChat = TheWindowManager->winGetWindowFromId( parent, textEntryChatID );buttonEmote = TheWindowManager->winGetWindowFromId( parent,buttonEmoteID );listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( parent, listboxChatWindowScoreScreenID );- listboxAcademyWindowScoreScreen = TheWindowManager->winGetWindowFromId( parent, listboxAcademyWindowScoreScreenID );- staticTextAcademyTitle = TheWindowManager->winGetWindowFromId( parent, staticTextAcademyTitleID );// buttonRehost = TheWindowManager->winGetWindowFromId( parent, buttonRehostID );chatBoxBorder = TheWindowManager->winGetWindowFromId( parent, chatBoxBorderID );@@ -340,13 +328,11 @@ void ScoreScreenInit( WindowLayout *layout, void *userData )if (TheRecorder->isMultiplayer()){initReplayMultiPlayer();- TheTransitionHandler->setGroup("ScoreScreenShow");}else{overidePlayerDisplayName = TRUE;initReplaySinglePlayer();- TheTransitionHandler->setGroup("ScoreScreenShow");}}else@@ -354,17 +340,14 @@ void ScoreScreenInit( WindowLayout *layout, void *userData )if(TheGameLogic->isInInternetGame()){initInternetMultiPlayer();- TheTransitionHandler->setGroup("ScoreScreenShow");}else if( TheGameLogic->isInLanGame()){initLANMultiPlayer();- TheTransitionHandler->setGroup("ScoreScreenShow");}else if( TheGameLogic->isInSkirmishGame()){initSkirmish();- TheTransitionHandler->setGroup("ScoreScreenShow");}else{@@ -382,9 +365,18 @@ void ScoreScreenInit( WindowLayout *layout, void *userData )buttonSaveReplay->winHide(TRUE);}- // a match opens on its summary; a mission keeps the campaign's own screen- if (screenType != SCORESCREEN_SINGLEPLAYER)- ScoreScreenGraphsShow(TRUE);+ // The panel is the whole score screen; the layout's own table and its Tactical Analysis box stay+ // hidden. A General's Challenge mission keeps its portrait of the general instead, which+ // finishSinglePlayerInit puts where the table was. The panel stops above the chat after a+ // network match and above the "game saved" line after a mission.+ hideScoreTable();+ if (screenType == SCORESCREEN_SINGLEPLAYER)+ {+ if (!isChallengeCampaign)+ ScoreScreenGraphsShow(staticTextGameSaved);+ }+ else+ ScoreScreenGraphsShow(listboxChatWindowScoreScreen->winIsHidden() ? NULL : listboxChatWindowScoreScreen);// Make Sure the layout is visiblelayout->hide( FALSE );@@ -558,13 +550,10 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg,// --------------------------------------------------------------------------------------------case GBM_SELECTED:{- TheTransitionHandler->remove("ScoreScreenShow", TRUE);ReplayWasPressed = FALSE;GameWindow *control = (GameWindow *)mData1;Int controlID = control->winGetWindowId();- if( ScoreScreenGraphsSelected( control ) )- return MSG_HANDLED;if( controlID == buttonOkID ){TheShell->pop();@@ -894,10 +883,6 @@ void finishSinglePlayerInit( void )buttonEmote->winHide(TRUE);if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(TRUE);- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( TRUE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( TRUE );if (chatBoxBorder)chatBoxBorder->winHide(TRUE);if (buttonBuddies)@@ -980,10 +965,6 @@ void finishSinglePlayerInit( void )if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(TRUE);- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( TRUE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( TRUE );if (chatBoxBorder)chatBoxBorder->winHide(TRUE);@@ -991,11 +972,6 @@ void finishSinglePlayerInit( void )buttonBuddies->winHide(TRUE);// if (buttonRehost)// buttonRehost->winHide(TRUE);-- // need to do this here- if ( TheCampaignManager->getCurrentCampaign()- && !TheCampaignManager->getCurrentCampaign()->isChallengeCampaign())- TheTransitionHandler->setGroup("ScoreScreenShow");}/** Special Init path for making this a single player replay Score Screen */@@ -1018,10 +994,6 @@ void initReplaySinglePlayer( void )buttonBuddies->winHide(TRUE);if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(TRUE);- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( TRUE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( TRUE );// if (buttonRehost)// buttonRehost->winHide(TRUE);@@ -1045,11 +1017,6 @@ void initLANMultiPlayer(void)buttonContinue->winHide(TRUE);if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(FALSE);- //No academy in LAN- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( TRUE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( TRUE );if (chatBoxBorder)chatBoxBorder->winHide(FALSE);if (buttonBuddies)@@ -1074,12 +1041,6 @@ void initInternetMultiPlayer(void)buttonEmote->winHide(TRUE);if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(FALSE);-- //Provide academy advice in internet games.- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( FALSE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( FALSE );if (chatBoxBorder)chatBoxBorder->winHide(FALSE);@@ -1113,10 +1074,6 @@ void initReplayMultiPlayer(void)buttonEmote->winHide(TRUE);if (listboxChatWindowScoreScreen)listboxChatWindowScoreScreen->winHide(TRUE);- if( listboxAcademyWindowScoreScreen )- listboxAcademyWindowScoreScreen->winHide( TRUE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( TRUE );if (chatBoxBorder)chatBoxBorder->winHide(TRUE);if (buttonContinue)@@ -1432,189 +1389,7 @@ void populatePlayerInfo( Player *player, Int pos)DEBUG_ASSERTCRASH(FALSE,("Player %s does not have a scoreKeeper", player->getPlayerDisplayName().str()));return;}- AsciiString winName;- UnicodeString winValue;- GameWindow *win;- // set the player name- winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- if(overidePlayerDisplayName)- {- GadgetStaticTextSetText(win, TheGameText->fetch("GUI:Player"));- }- else- GadgetStaticTextSetText(win, player->getPlayerDisplayName());- ScoreScreenGraphsAddPlayer( player, GadgetStaticTextGetText( win ), color );- win->winHide(FALSE);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());-- // set the player name- winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units built- winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalUnitsBuilt());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total units Lost- winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalUnitsLost());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total units Destroyed- winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalUnitsDestroyed());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsBuilt- winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalBuildingsBuilt());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsLost- winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalBuildingsLost());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalBuildingsDestroyed());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalBuildingsDestroyed());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total Resources- winName.format("ScoreScreen.wnd:StaticTextResources%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", scoreKpr->getTotalMoneyEarned());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- if( player == ThePlayerList->getLocalPlayer() )- {- //Handle academy stats- if( listboxAcademyWindowScoreScreen )- {- listboxAcademyWindowScoreScreen->winHide( FALSE );- if( staticTextAcademyTitle )- staticTextAcademyTitle->winHide( FALSE );- if( TheGameLogic->isInSkirmishGame() || TheGameLogic->isInInternetGame() )- {- AcademyAdviceInfo info;- if( player->getAcademyStats()->calculateAcademyAdvice( &info ) )- {- for( Int i = 0; i < info.numTips; i++ )- {- GadgetListBoxAddEntryText( listboxAcademyWindowScoreScreen, info.advice[ i ], GameSpyColor[GSCOLOR_DEFAULT], -1 );- }- }- }- }- }-- // set the Score- /*-winName.format("ScoreScreen.wnd:StaticTextScore%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(L"%d", scoreKpr->calculateScore());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-*/- // set the Buttons-// winName.format("ScoreScreen.wnd:ButtonAdd%d", pos);- // win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- // DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- // if(screenType == SCORESCREEN_INTERNET && TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0)- // {- // // Get the stats for the player- //- // AsciiString aName;- // aName.translate(player->getPlayerDisplayName());- //- // PlayerInfoMap::iterator blah = TheGameSpyInfo->getPlayerInfoMap()->find(aName);- // if(blah->second.m_profileID != 0)- // {- //- // BuddyInfoMap::iterator bIt = TheGameSpyInfo->getBuddyMap()->find(blah->second.m_profileID);- // if(bIt != TheGameSpyInfo->getBuddyMap()->end() || (TheGameSpyInfo->getLocalProfileID() == blah->second.m_profileID))- // {- // // already our buddy- // win->winHide(TRUE);- // }- // else- // {- //- // GadgetButtonSetData(win, (void *) blah->second.m_profileID);- // win->winEnable(TRUE);- // win->winHide(FALSE);- // }- // }- // else- // win->winHide(TRUE);- // }- // else- // {- // win->winHide(TRUE);- // }--- // set a marker for who won and lost- winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(FALSE);-// if(TheVictoryConditions->hasAchievedVictory(player))-// win->winEnable(TRUE);-// else if(TheVictoryConditions->hasBeenDefeated(player))-// win->winEnable(FALSE);-// else-// win->winHide(TRUE);-//- const PlayerTemplate *fact = player->getPlayerTemplate();- if(fact != NULL)- {- win->winSetEnabledImage(0, fact->getSideIconImage());- }-+ ScoreScreenGraphsAddPlayer( player, overidePlayerDisplayName ? TheGameText->fetch("GUI:Player") : player->getPlayerDisplayName(), color );if ( screenType == SCORESCREEN_SKIRMISH && player->isLocalPlayer() ){@@ -2100,17 +1875,14 @@ void grabMultiPlayerInfo( void )++playerCount;}}- hideWindows(playerCount);Int count =0;RevScoreMapIt revIt;- // display the players based on Score- for ( revIt = scores.rbegin(); revIt != scores.rend(); ++revIt)+ // display the players based on Score; an observer has nothing to show+ for ( revIt = scores.rbegin(); revIt != scores.rend(); ++revIt){Player *p = revIt->second;- if(p->isPlayerObserver())- setObserverWindows( p, count );- else- populatePlayerInfo( p, count);+ if(!p->isPlayerObserver())+ populatePlayerInfo( p, count);count ++;}@@ -2204,7 +1976,6 @@ void grabSinglePlayerInfo( void )sg.m_totalUnitsBuilt = 0;sg.m_totalUnitsDestroyed = 0;sg.m_totalUnitsLost = 0;- sg.m_sideImage = NULL;Bool populate = FALSE;Color color;for(Int i = 0; i < MAX_PLAYER_COUNT; ++i)@@ -2227,8 +1998,7 @@ void grabSinglePlayerInfo( void )sg.m_totalUnitsBuilt += sk->getTotalUnitsBuilt();sg.m_totalUnitsDestroyed += sk->getTotalUnitsDestroyed();sg.m_totalUnitsLost += sk->getTotalUnitsLost();- sg.m_sideImage = player->getPlayerTemplate()->getSideIconImage();- color = clientPlayerColor( player );+ color = clientPlayerColor( player );populate = TRUE;}}@@ -2243,367 +2013,47 @@ void grabSinglePlayerInfo( void )label.concat("Allies");elselabel.concat("Enemies");- populateSideInfo(TheGameText->fetch(label), &sg, playerCount, color);+ ScoreScreenGraphsAddSide(TheGameText->fetch(label), color, sg.m_totalUnitsBuilt, sg.m_totalUnitsLost, sg.m_totalUnitsDestroyed,+ sg.m_totalBuildingsBuilt, sg.m_totalBuildingsLost, sg.m_totalBuildingsDestroyed, sg.m_totalMoneyEarned);++playerCount;}}- hideWindows(playerCount);-}-/** Hide the windows we're not using */+/** The layout's own score table, its Tactical Analysis box and the chat's academy twin: the+ * summary panel shows all of it now. *///--------------------------------------------------------------------------------------------------void hideWindows( Int pos )+static void hideScoreTable( void ){- if(pos < 0 || pos >= MAX_SLOTS)- return;- AsciiString winName;- GameWindow *win;- for( Int i = pos; i < MAX_SLOTS; ++i)+ static const char *const tableWindows[] ={+ "ScoreScreen.wnd:StaticTextPlayerName", "ScoreScreen.wnd:StaticTextUnitsBuilt", "ScoreScreen.wnd:StaticTextUnitsLost",+ "ScoreScreen.wnd:StaticTextUnitsDestroyed", "ScoreScreen.wnd:StaticTextBuildingsConstructed", "ScoreScreen.wnd:StaticTextBuildingsLost",+ "ScoreScreen.wnd:StaticTextBuildingsDestroyed", "ScoreScreen.wnd:StaticTextSuppliesCollected",+ "ScoreScreen.wnd:CameoUnitsCreated", "ScoreScreen.wnd:CameoUnitsLost", "ScoreScreen.wnd:CameoUnitsDestroyed",+ "ScoreScreen.wnd:CameoBuildingCreated", "ScoreScreen.wnd:CameoBuildingLost", "ScoreScreen.wnd:CameoBuildingDestroyed",+ "ScoreScreen.wnd:CameoSuppliesCollected", "ScoreScreen.wnd:Line",+ "ScoreScreen.wnd:ListboxWarschoolAdvice", "ScoreScreen.wnd:StaticTextWarSchool"+ };+ for( Int each = 0; each < ARRAY_SIZE( tableWindows ); ++each )+ TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( tableWindows[ each ] ) )->winHide( TRUE );- // set the player name- winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the player name- winName.format("ScoreScreen.wnd:StaticTextObserver%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units built- winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units Lost- winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units Destroyed- winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsBuilt- winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsLost- winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total Resources- winName.format("ScoreScreen.wnd:StaticTextResources%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total score- /*-winName.format("ScoreScreen.wnd:StaticTextScore%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-*/-- // Set the Game Winner marker- winName.format("ScoreScreen.wnd:GameWindowWinner%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);---// // Set the Game Add Buttons-// winName.format("ScoreScreen.wnd:ButtonAdd%d", i);-// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );-// DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));-// win->winHide(TRUE);- }-}--/** Hide the windows we're not using */-//--------------------------------------------------------------------------------------------------void setObserverWindows( Player *player, Int i )-{- if(i < 0 || i >= MAX_SLOTS)- return;- AsciiString winName;- GameWindow *win;-- Color color = 0xffffffff;-- // set the player name- winName.format("ScoreScreen.wnd:StaticTextPlayer%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- if (player)- {- GadgetStaticTextSetText(win, player->getPlayerDisplayName());- win->winHide(FALSE);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- }- else- {- win->winHide(TRUE);- }-- // set the player name- winName.format("ScoreScreen.wnd:StaticTextObserver%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(FALSE);--- // set the total units built- winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units Lost- winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units Destroyed- winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsBuilt- winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsLost- winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total Resources- winName.format("ScoreScreen.wnd:StaticTextResources%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total score- /*-winName.format("ScoreScreen.wnd:StaticTextScore%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-*/-- // Set the Game Winner marker- winName.format("ScoreScreen.wnd:GameWindowWinner%d", i);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(FALSE);- const PlayerTemplate *fact = player->getPlayerTemplate();- if(fact != NULL)+ // and its rows, one a slot+ static const char *const rowWindows[] ={- win->winSetEnabledImage(0, fact->getSideIconImage());- }--// // set the Buttons-// winName.format("ScoreScreen.wnd:ButtonAdd%d", i);-// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );-// DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));-//// if(screenType == SCORESCREEN_INTERNET)-//// win->winHide(FALSE);-//// else-//// win->winHide(TRUE);-// if(screenType == SCORESCREEN_INTERNET && TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0)-// {-// // Get the stats for the player-//-// AsciiString aName;-// aName.translate(player->getPlayerDisplayName());-//-// PlayerInfoMap::iterator blah = TheGameSpyInfo->getPlayerInfoMap()->find(aName);-// if(blah->second.m_profileID != 0)-// {-//-// BuddyInfoMap::iterator bIt = TheGameSpyInfo->getBuddyMap()->find(blah->second.m_profileID);-// if(bIt != TheGameSpyInfo->getBuddyMap()->end() || (TheGameSpyInfo->getLocalProfileID() == blah->second.m_profileID))-// {-// // already our buddy-// win->winHide(TRUE);-// }-// else-// {-//-// GadgetButtonSetData(win, (void *) blah->second.m_profileID);-// win->winEnable(TRUE);-// win->winHide(FALSE);-// }-// }-// else-// win->winHide(TRUE);-// }-// else-// {-// win->winHide(TRUE);-// }---}--/** Populate the various windows with the information about the game based on each player's score- keeper. */-//--------------------------------------------------------------------------------------------------void populateSideInfo( UnicodeString side,ScoreGather *sg, Int pos, Color color)-{- if(pos < 0 || pos > MAX_SLOTS)- return;-+ "ScoreScreen.wnd:StaticTextPlayer%d", "ScoreScreen.wnd:StaticTextObserver%d", "ScoreScreen.wnd:StaticTextUnitsBuilt%d",+ "ScoreScreen.wnd:StaticTextUnitsLost%d", "ScoreScreen.wnd:StaticTextUnitsDestroyed%d", "ScoreScreen.wnd:StaticTextBuildingsBuilt%d",+ "ScoreScreen.wnd:StaticTextBuildingsLost%d", "ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", "ScoreScreen.wnd:StaticTextResources%d",+ "ScoreScreen.wnd:GameWindowWinner%d"+ };AsciiString winName;- UnicodeString winValue;- GameWindow *win;- // set the player name- winName.format("ScoreScreen.wnd:StaticTextPlayer%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- GadgetStaticTextSetText(win, side);- win->winHide(FALSE);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());-- // set the player name- winName.format("ScoreScreen.wnd:StaticTextObserver%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- win->winHide(TRUE);-- // set the total units built- winName.format("ScoreScreen.wnd:StaticTextUnitsBuilt%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalUnitsBuilt);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total units Lost- winName.format("ScoreScreen.wnd:StaticTextUnitsLost%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalUnitsLost);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total units Destroyed- winName.format("ScoreScreen.wnd:StaticTextUnitsDestroyed%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalUnitsDestroyed);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsBuilt- winName.format("ScoreScreen.wnd:StaticTextBuildingsBuilt%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalBuildingsBuilt);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsLost- winName.format("ScoreScreen.wnd:StaticTextBuildingsLost%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalBuildingsLost);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total BuildingsDestroyed- winName.format("ScoreScreen.wnd:StaticTextBuildingsDestroyed%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalBuildingsDestroyed);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the total Resources- winName.format("ScoreScreen.wnd:StaticTextResources%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(u"%d", sg->m_totalMoneyEarned);- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-- // set the Score- /*-winName.format("ScoreScreen.wnd:StaticTextScore%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- winValue.format(L"%d", scoreKpr->calculateScore());- GadgetStaticTextSetText(win, winValue);- win->winSetEnabledTextColors(color, win->winGetEnabledTextBorderColor());- win->winHide(FALSE);-*/-- // set a marker for who won and lost- winName.format("ScoreScreen.wnd:GameWindowWinner%d", pos);- win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );- DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));- if(sg->m_sideImage)+ for( Int i = 0; i < MAX_SLOTS; ++i){- win->winHide(FALSE);- win->winSetEnabledImage(0, sg->m_sideImage);+ for( Int each = 0; each < ARRAY_SIZE( rowWindows ); ++each )+ {+ winName.format( rowWindows[ each ], i );+ TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) )->winHide( TRUE );+ }}--// // set the Buttons-// winName.format("ScoreScreen.wnd:ButtonAdd%d", pos);-// win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( winName ) );-// DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str()));-// if(screenType == SCORESCREEN_INTERNET)-// win->winHide(FALSE);-// else-// win->winHide(TRUE);}+diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cppindex 12d97558f..fe260f3a0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp@@ -18,14 +18,14 @@// FILE: ScoreScreenGraphs.cpp //////////////////////////////////////////////////////////////////////-// The summary panel the score screen opens on after a multiplayer match, a skirmish or a replay: a-// short table of the numbers that matter for each player, and below it one chart at a time (money-// earned, army, buildings) or the build order. A chart carries one row of small markers where a-// superweapon went up or fired, a general's power was used or a general was promoted; markers that-// fall close together share one picture and list all of theirs on hover. The build order shows-// the first of each structure and unit until asked for every build. The Scores button beside OK-// swaps the panel for the stock score table. Everything is drawn here from TheMatchHistory and the-// players' score keepers; the panel and its button are made in code, so no layout file changes.+// The score screen's whole content after any match, a mission or a replay: a short table of every+// player's numbers (a campaign adds its allied and enemy sides as rows of their own), and below it+// one chart at a time (money earned, army, buildings) or the build order. A chart carries one row+// of small markers where a superweapon went up or fired, a general's power was used or a general was+// promoted; markers that fall close together share one picture and list all of theirs on hover. The+// build order shows the first of each structure and unit until asked for every build. Everything is+// drawn here from TheMatchHistory and the score keepers; the panel is made in code over the layout,+// whose own score table ScoreScreen.cpp hides, so no layout file changes.////////////////////////////////////////////////////////////////////////////////////////////////////#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine@@ -40,7 +40,6 @@#include "GameClient/Display.h"#include "GameClient/DisplayString.h"#include "GameClient/DisplayStringManager.h"-#include "GameClient/GadgetPushButton.h"#include "GameClient/GameFont.h"#include "GameClient/GameText.h"#include "GameClient/GameWindow.h"@@ -71,22 +70,33 @@ static const MatchSeries theTabSeries[ GRAPH_TAB_BUILD_ORDER ] =MATCH_SERIES_EARNED, MATCH_SERIES_ARMY, MATCH_SERIES_BUILDINGS};-/// the summary's columns, in the stock score table's order+/// the summary's columns, in the old score table's order, under three group headingsenum SummaryColumn{SUMMARY_UNITS_BUILT,SUMMARY_UNITS_LOST,SUMMARY_UNITS_DESTROYED,SUMMARY_BUILDINGS_BUILT,+ SUMMARY_BUILDINGS_LOST,+ SUMMARY_BUILDINGS_DESTROYED,SUMMARY_EARNED,SUMMARY_COLUMN_COUNT};static const char *const theColumnLabels[ SUMMARY_COLUMN_COUNT ] ={- "GUI:SummaryUnitsBuilt", "GUI:GraphLost", "GUI:SummaryUnitsDestroyed", "GUI:SummaryBuildingsBuilt", "GUI:GraphEarned"+ "GUI:SummaryUnitsBuilt", "GUI:SummaryLost", "GUI:SummaryDestroyed",+ "GUI:SummaryBuildingsBuilt", "GUI:SummaryLost", "GUI:SummaryDestroyed",+ "GUI:SummaryEarned"};+enum { SUMMARY_GROUP_COUNT = 3 };++static const char *const theGroupLabels[ SUMMARY_GROUP_COUNT ] = { "GUI:SummaryUnits", "GUI:GraphBuildings", "GUI:SummaryMoney" };++/// the group each column sits under+static const Int theColumnGroup[ SUMMARY_COLUMN_COUNT ] = { 0, 0, 0, 1, 1, 1, 2 };+static const char *const theEventLabels[ MATCH_EVENT_TYPE_COUNT ] ={"GUI:GraphSuperweaponBuilt", "GUI:GraphSuperweaponFired", "GUI:GraphGeneralPower", "GUI:GraphPromotion"@@ -111,7 +121,7 @@ static const Color SHADOW = GameMakeColor( 0, 0, 0, 255 );struct GraphPlayer{- Int index;+ Int index; ///< the player's index, or -1 for a campaign's side, which only has a summary rowUnicodeString name;UnicodeString side;Color color;@@ -161,7 +171,6 @@ struct GraphLinestd::vector< ICoord2D > points;};-static GameWindow *s_button = NULL;static GameWindow *s_panel = NULL;static GameFont *s_font = NULL;static GameFont *s_smallFont = NULL;@@ -264,6 +273,18 @@ static void addTip( GraphMark &mark, const UnicodeString &text, Color color )mark.tip.push_back( line );}+/** The rows a player stands behind; a campaign's side rows have no history to draw. */+static std::vector< const GraphPlayer * > chartedPlayers( void )+{+ std::vector< const GraphPlayer * > players;+ for( size_t each = 0; each < s_players.size(); each++ )+ {+ if( s_players[ each ].index >= 0 )+ players.push_back( &s_players[ each ] );+ }+ return players;+}+static const GraphPlayer *playerFor( Int index ){for( size_t each = 0; each < s_players.size(); each++ )@@ -388,31 +409,55 @@ static Int minuteStep( UnsignedInt frames, Int most )}//--------------------------------------------------------------------------------------------------/** A row a player: a bar in its colour, the name in it, the side dimmed beside it, then the numbers.- * Returns where the table ends. */+/** A row a player: a bar in its colour, the name in it, the side dimmed beside it, then the numbers+ * under their group headings, Units, Buildings and Money. Returns where the table ends. */static Int layoutSummary( Int top, Int width, Int pad ){const Int smallLine = s_smallFont->height;const Int line = s_font->height;const Int left = pad * 2;const Int right = width - pad * 2;- const Int namesRight = left + ( right - left ) * 2 / 5;- const Int column = ( right - namesRight ) / SUMMARY_COLUMN_COUNT;+ const Int namesRight = left + ( right - left ) / 3;+ const Int groupGap = pad * 2;+ const Int column = ( right - namesRight - ( SUMMARY_GROUP_COUNT - 1 ) * groupGap ) / SUMMARY_COLUMN_COUNT;+ // each column's right edge, where its heading and numbers are aligned+ Int columnRight[ SUMMARY_COLUMN_COUNT ];for( Int each = 0; each < SUMMARY_COLUMN_COUNT; each++ )- addText( TheGameText->fetch( theColumnLabels[ each ] ), s_smallFont, namesRight + ( each + 1 ) * column, top, TEXT_DIM, 2 );- Int y = top + smallLine + pad / 2;+ columnRight[ each ] = namesRight + ( each + 1 ) * column + theColumnGroup[ each ] * groupGap;++ const Int subTop = top + smallLine + pad / 2;+ for( Int group = 0; group < SUMMARY_GROUP_COUNT; group++ )+ {+ Int first = SUMMARY_COLUMN_COUNT, last = 0;+ for( Int each = 0; each < SUMMARY_COLUMN_COUNT; each++ )+ {+ if( theColumnGroup[ each ] == group )+ {+ first = min( first, each );+ last = max( last, each );+ }+ }+ const Int groupLeft = columnRight[ first ] - column + pad;+ addText( TheGameText->fetch( theGroupLabels[ group ] ), s_smallFont, ( groupLeft + columnRight[ last ] ) / 2, top, TEXT, 1 );+ addRule( groupLeft, subTop - pad / 4, columnRight[ last ], subTop - pad / 4, AXIS );+ }+ for( Int each = 0; each < SUMMARY_COLUMN_COUNT; each++ )+ addText( TheGameText->fetch( theColumnLabels[ each ] ), s_smallFont, columnRight[ each ], subTop, TEXT_DIM, 2 );+ Int y = subTop + smallLine + pad / 2;addRule( left, y, right, y, GRID );- const Int rowHeight = line + pad;+ // eight players in a lobby with its chat below get tighter rows+ const Int rowHeight = s_players.size() > 4 ? line + pad / 3 : line + pad;y += pad / 2;for( size_t each = 0; each < s_players.size(); each++ ){const GraphPlayer &player = s_players[ each ];- s_marks.push_back( newMark( left, y + pad / 2, 4, rowHeight - pad, player.color, player.color ) );+ const Int textY = y + ( rowHeight - line ) / 2;+ s_marks.push_back( newMark( left, textY + 2, 4, line - 4, player.color, player.color ) );Int x = left + 4 + pad;- x += addText( player.name, s_font, x, y + pad / 2, player.color ) + pad;- const Int smallY = y + pad / 2 + line - smallLine - 1;+ x += addText( player.name, s_font, x, textY, player.color ) + pad;+ const Int smallY = textY + line - smallLine - 1;if( !player.side.isEmpty() )x += addText( player.side, s_smallFont, x, smallY, TEXT_DIM ) + pad;if( player.winner )@@ -421,7 +466,7 @@ static Int layoutSummary( Int top, Int width, Int pad ){UnicodeString value;value.format( u"%d", player.stats[ stat ] );- addText( value, s_font, namesRight + ( stat + 1 ) * column, y + pad / 2, TEXT, 2 );+ addText( value, s_font, columnRight[ stat ], textY, TEXT, 2 );}y += rowHeight;}@@ -477,11 +522,12 @@ static void layoutChart( MatchSeries series, Int top, Int width, Int bottom, Intreturn;}+ const std::vector< const GraphPlayer * > players = chartedPlayers();Int most = 0;for( Int sample = 0; sample < count; sample++ ){- for( size_t each = 0; each < s_players.size(); each++ )- most = max( most, history.getValue( sample, s_players[ each ].index, series ) );+ for( size_t each = 0; each < players.size(); each++ )+ most = max( most, history.getValue( sample, players[ each ]->index, series ) );}const Int step = niceStep( max( most, 4 ) / 4 );const Int ceiling = step * ( ( max( most, 1 ) + step - 1 ) / step );@@ -509,13 +555,13 @@ static void layoutChart( MatchSeries series, Int top, Int width, Int bottom, IntaddText( clockText( frame ), s_smallFont, x, plotBottom + pad / 2, TEXT_DIM, frame == 0 ? 0 : 1 );}- for( size_t each = 0; each < s_players.size(); each++ )+ for( size_t each = 0; each < players.size(); each++ ){- const Int index = s_players[ each ].index;+ const Int index = players[ each ]->index;if( !history.wasSampled( index ) )continue;GraphLine graph;- graph.color = s_players[ each ].color;+ graph.color = players[ each ]->color;for( Int sample = 0; sample < count; sample++ ){ICoord2D point;@@ -603,26 +649,28 @@ static void layoutBuildOrder( Int top, Int width, Int bottom, Int pad ){const MatchHistory &history = TheMatchHistory;const Int smallLine = s_smallFont->height;- if( s_players.empty() )+ const std::vector< const GraphPlayer * > players = chartedPlayers();+ if( players.empty() )return;UnsignedInt end = history.getSampleCount() > 0 ? history.getSampleFrame( history.getSampleCount() - 1 ) : 0;Int nameWidth = 0;- for( size_t each = 0; each < s_players.size(); each++ )+ for( size_t each = 0; each < players.size(); each++ ){- const std::vector< MatchBuild > &builds = history.getBuilds( s_players[ each ].index );+ const std::vector< MatchBuild > &builds = history.getBuilds( players[ each ]->index );if( !builds.empty() )end = max( end, builds.back().frame );- DisplayString *name = newText( s_players[ each ].name, s_smallFont );+ DisplayString *name = newText( players[ each ]->name, s_smallFont );nameWidth = max( nameWidth, textWidth( name ) );- name->setText( s_players[ each ].side );+ name->setText( players[ each ]->side );nameWidth = max( nameWidth, textWidth( name ) );TheDisplayStringManager->freeDisplayString( name );}end = max( end, (UnsignedInt)LOGICFRAMES_PER_SECOND );const Int rowsTop = top + smallLine + pad / 2;- const Int rowHeight = ( bottom - rowsTop ) / (Int)s_players.size();+ // a lone campaign player gets the height of two rows, not the whole area+ const Int rowHeight = ( bottom - rowsTop ) / max( (Int)players.size(), 2 );// the cameos at their own 4:3, two lanes of the first of each thing, three of every buildconst Int lanes = s_everyBuild ? 3 : 2;const Int icon = min( max( ( rowHeight - pad ) / lanes - 3, 10 ), s_font->height * 3 / 2 );@@ -638,15 +686,15 @@ static void layoutBuildOrder( Int top, Int width, Int bottom, Int pad )for( UnsignedInt frame = 0; frame <= end; frame += ( split && frame < EARLY_FRAMES ) ? minute : lateStep ){const Int x = buildX( frame, end, left, span );- addRule( x, rowsTop, x, bottom, frame == EARLY_FRAMES && split ? AXIS : GRID );+ addRule( x, rowsTop, x, rowsTop + (Int)players.size() * rowHeight, frame == EARLY_FRAMES && split ? AXIS : GRID );addText( clockText( frame ), s_smallFont, x, top, TEXT_DIM, 1 );if( split && frame < EARLY_FRAMES && frame + minute > EARLY_FRAMES )frame = EARLY_FRAMES - minute;}- for( size_t each = 0; each < s_players.size(); each++ )+ for( size_t each = 0; each < players.size(); each++ ){- const GraphPlayer &player = s_players[ each ];+ const GraphPlayer &player = *players[ each ];const Int rowTop = rowsTop + (Int)each * rowHeight;if( each > 0 )addRule( pad * 2, rowTop, right + iconWidth / 2, rowTop, GRID );@@ -865,7 +913,8 @@ static WindowMsgHandledType panelInput( GameWindow *window, UnsignedInt msg, Win}//--------------------------------------------------------------------------------------------------/** The button goes to the left of anchor, the panel over the score table above it. */+/** Makes the panel, hidden until ScoreScreenGraphsShow; anchor is the layout's OK button, whose font+ * the panel takes and above which it stops. */void ScoreScreenGraphsInit( GameWindow *parent, GameWindow *anchor ){s_players.clear();@@ -881,26 +930,6 @@ void ScoreScreenGraphsInit( GameWindow *parent, GameWindow *anchor )anchor->winGetScreenPosition( &anchorX, &anchorY );anchor->winGetSize( &anchorW, &anchorH );- WinInstanceData instData;- instData.init();- BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK );- s_button = TheWindowManager->gogoGadgetPushButton( parent, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE,- anchorX - parentX - anchorW - anchorW / 8, anchorY - parentY, anchorW, anchorH, &instData, s_font, TRUE );- // dressed as its neighbour, the layout's own button, rather than the plain default look- WinInstanceData *mine = s_button->winGetInstanceData();- const WinInstanceData *theirs = anchor->winGetInstanceData();- for( Int index = 0; index < MAX_DRAW_DATA; index++ )- {- mine->m_enabledDrawData[ index ] = theirs->m_enabledDrawData[ index ];- mine->m_disabledDrawData[ index ] = theirs->m_disabledDrawData[ index ];- mine->m_hiliteDrawData[ index ] = theirs->m_hiliteDrawData[ index ];- }- mine->m_enabledText = theirs->m_enabledText;- mine->m_disabledText = theirs->m_disabledText;- mine->m_hiliteText = theirs->m_hiliteText;- s_button->winSetDrawFunc( anchor->winGetDrawFunc() );- GadgetButtonSetText( s_button, TheGameText->fetch( "GUI:ScoreSummary" ) );-// inside the layout's blue frame, which sits about a twentieth of the screen in from each sideconst Int marginX = parentW / 20;const Int marginY = parentH / 16;@@ -928,42 +957,55 @@ void ScoreScreenGraphsAddPlayer( Player *player, const UnicodeString &name, Coloentry.stats[ SUMMARY_UNITS_LOST ] = score->getTotalUnitsLost();entry.stats[ SUMMARY_UNITS_DESTROYED ] = score->getTotalUnitsDestroyed();entry.stats[ SUMMARY_BUILDINGS_BUILT ] = score->getTotalBuildingsBuilt();+ entry.stats[ SUMMARY_BUILDINGS_LOST ] = score->getTotalBuildingsLost();+ entry.stats[ SUMMARY_BUILDINGS_DESTROYED ] = score->getTotalBuildingsDestroyed();entry.stats[ SUMMARY_EARNED ] = score->getTotalMoneyEarned();s_players.push_back( entry );}-/** Puts the summary over the stock score table, or takes it away. */-void ScoreScreenGraphsShow( Bool show )+/** A campaign's allies or enemies of one side, summed into one row; it has numbers and no lines. */+void ScoreScreenGraphsAddSide( const UnicodeString &name, Color color, Int unitsBuilt, Int unitsLost, Int unitsDestroyed,+ Int buildingsBuilt, Int buildingsLost, Int buildingsDestroyed, Int earned ){- if( show )- {- layoutPanel();- s_panel->winBringToTop();- }- s_panel->winHide( !show );- GadgetButtonSetText( s_button, TheGameText->fetch( show ? "GUI:ScoreTable" : "GUI:ScoreSummary" ) );+ GraphPlayer entry;+ entry.index = -1;+ entry.name = name;+ entry.color = color;+ entry.winner = FALSE;+ entry.stats[ SUMMARY_UNITS_BUILT ] = unitsBuilt;+ entry.stats[ SUMMARY_UNITS_LOST ] = unitsLost;+ entry.stats[ SUMMARY_UNITS_DESTROYED ] = unitsDestroyed;+ entry.stats[ SUMMARY_BUILDINGS_BUILT ] = buildingsBuilt;+ entry.stats[ SUMMARY_BUILDINGS_LOST ] = buildingsLost;+ entry.stats[ SUMMARY_BUILDINGS_DESTROYED ] = buildingsDestroyed;+ entry.stats[ SUMMARY_EARNED ] = earned;+ s_players.push_back( entry );}-/** TRUE when control was the Summary/Scores button, which then swaps the two. */-Bool ScoreScreenGraphsSelected( GameWindow *control )+/** Lays the panel out and shows it. floor, when given, is a window the panel has to stop above:+ * the chat after a network match, the "game saved" line after a mission. */+void ScoreScreenGraphsShow( GameWindow *floor ){- if( s_button == NULL || control != s_button )- return FALSE;- ScoreScreenGraphsShow( s_panel->winIsHidden() );- return TRUE;+ if( floor )+ {+ Int panelX, panelY, floorX, floorY, width, height;+ s_panel->winGetScreenPosition( &panelX, &panelY );+ floor->winGetScreenPosition( &floorX, &floorY );+ s_panel->winGetSize( &width, &height );+ s_panel->winSetSize( width, min( height, floorY - panelY - s_font->height / 2 ) );+ }+ layoutPanel();+ s_panel->winBringToTop();+ s_panel->winHide( FALSE );}void ScoreScreenGraphsShutdown( void ){- if( s_button == NULL )- return;clearContent();for( Int tab = 0; tab < GRAPH_TAB_COUNT; tab++ )TheDisplayStringManager->freeDisplayString( s_tabText[ tab ] );TheDisplayStringManager->freeDisplayString( s_toggleText );TheWindowManager->winDestroy( s_panel );- TheWindowManager->winDestroy( s_button );s_panel = NULL;- s_button = NULL;s_players.clear();}