Diplomacy.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: Diplomacy.cpp ///////////////////////////////////////////////////////////////////////
  24. // Author: Matthew D. Campbell - August 2002
  25. // Desc: GUI callbacks for the diplomacy menu
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "Common/GlobalData.h"
  30. #include "Common/MultiplayerSettings.h"
  31. #include "Common/Player.h"
  32. #include "Common/PlayerList.h"
  33. #include "Common/PlayerTemplate.h"
  34. #include "Common/Recorder.h"
  35. #include "GameClient/AnimateWindowManager.h"
  36. #include "GameClient/Diplomacy.h"
  37. #include "GameClient/DisconnectMenu.h"
  38. #include "GameClient/GameWindow.h"
  39. #include "GameClient/Gadget.h"
  40. #include "GameClient/GadgetCheckBox.h"
  41. #include "GameClient/GadgetListBox.h"
  42. #include "GameClient/GadgetTextEntry.h"
  43. #include "GameClient/GadgetStaticText.h"
  44. #include "GameClient/GadgetRadioButton.h"
  45. #include "GameClient/GameClient.h"
  46. #include "GameClient/GameText.h"
  47. #include "GameClient/GUICallbacks.h"
  48. #include "GameClient/InGameUI.h"
  49. #include "GameLogic/GameLogic.h"
  50. #include "GameLogic/VictoryConditions.h"
  51. #include "GameNetwork/GameInfo.h"
  52. #include "GameNetwork/NetworkInterface.h"
  53. #include "GameNetwork/GameSpy/BuddyDefs.h"
  54. #include "GameNetwork/GameSpy/peerDefs.h"
  55. #ifdef _INTERNAL
  56. // for occasional debugging...
  57. //#pragma optimize("", off)
  58. //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
  59. #endif
  60. //-------------------------------------------------------------------------------------------------
  61. static NameKeyType staticTextPlayerID[MAX_SLOTS];
  62. static NameKeyType staticTextSideID[MAX_SLOTS];
  63. static NameKeyType staticTextTeamID[MAX_SLOTS];
  64. static NameKeyType staticTextStatusID[MAX_SLOTS];
  65. static NameKeyType buttonMuteID[MAX_SLOTS];
  66. static NameKeyType buttonUnMuteID[MAX_SLOTS];
  67. static NameKeyType radioButtonInGameID = NAMEKEY_INVALID;
  68. static NameKeyType radioButtonBuddiesID = NAMEKEY_INVALID;
  69. static GameWindow *radioButtonInGame = NULL;
  70. static GameWindow *radioButtonBuddies = NULL;
  71. static NameKeyType winInGameID = NAMEKEY_INVALID;
  72. static NameKeyType winBuddiesID = NAMEKEY_INVALID;
  73. static NameKeyType winSoloID = NAMEKEY_INVALID;
  74. static GameWindow *winInGame = NULL;
  75. static GameWindow *winBuddies = NULL;
  76. static GameWindow *winSolo = NULL;
  77. static GameWindow *staticTextPlayer[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  78. static GameWindow *staticTextSide[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  79. static GameWindow *staticTextTeam[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  80. static GameWindow *staticTextStatus[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  81. static GameWindow *buttonMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  82. static GameWindow *buttonUnMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
  83. static Int slotNumInRow[MAX_SLOTS];
  84. //-------------------------------------------------------------------------------------------------
  85. static WindowLayout *theLayout = NULL;
  86. static GameWindow *theWindow = NULL;
  87. static AnimateWindowManager *theAnimateWindowManager = NULL;
  88. WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg,
  89. WindowMsgData mData1, WindowMsgData mData2);
  90. void InitBuddyControls(Int type);
  91. void updateBuddyInfo( void );
  92. static void grabWindowPointers( void )
  93. {
  94. for (Int i=0; i<MAX_SLOTS; ++i)
  95. {
  96. AsciiString temp;
  97. temp.format("Diplomacy.wnd:StaticTextPlayer%d", i);
  98. staticTextPlayerID[i] = NAMEKEY(temp);
  99. temp.format("Diplomacy.wnd:StaticTextSide%d", i);
  100. staticTextSideID[i] = NAMEKEY(temp);
  101. temp.format("Diplomacy.wnd:StaticTextTeam%d", i);
  102. staticTextTeamID[i] = NAMEKEY(temp);
  103. temp.format("Diplomacy.wnd:StaticTextStatus%d", i);
  104. staticTextStatusID[i] = NAMEKEY(temp);
  105. temp.format("Diplomacy.wnd:ButtonMute%d", i);
  106. buttonMuteID[i] = NAMEKEY(temp);
  107. temp.format("Diplomacy.wnd:ButtonUnMute%d", i);
  108. buttonUnMuteID[i] = NAMEKEY(temp);
  109. staticTextPlayer[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextPlayerID[i]);
  110. staticTextSide[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextSideID[i]);
  111. staticTextTeam[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextTeamID[i]);
  112. staticTextStatus[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextStatusID[i]);
  113. buttonMute[i] = TheWindowManager->winGetWindowFromId(theWindow, buttonMuteID[i]);
  114. buttonUnMute[i] = TheWindowManager->winGetWindowFromId(theWindow, buttonUnMuteID[i]);
  115. slotNumInRow[i] = -1;
  116. }
  117. }
  118. static void releaseWindowPointers( void )
  119. {
  120. for (Int i=0; i<MAX_SLOTS; ++i)
  121. {
  122. staticTextPlayer[i] = NULL;
  123. staticTextSide[i] = NULL;
  124. staticTextTeam[i] = NULL;
  125. staticTextStatus[i] = NULL;
  126. buttonMute[i] = NULL;
  127. buttonUnMute[i] = NULL;
  128. slotNumInRow[i] = -1;
  129. }
  130. }
  131. //-------------------------------------------------------------------------------------------------
  132. static void updateFunc( WindowLayout *layout, void *param )
  133. {
  134. if (theAnimateWindowManager && TheGlobalData->m_animateWindows)
  135. {
  136. Bool wasFinished = theAnimateWindowManager->isFinished();
  137. theAnimateWindowManager->update();
  138. if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed())
  139. theWindow->winHide( TRUE );
  140. }
  141. }
  142. //-------------------------------------------------------------------------------------------------
  143. //-------------------------------------------------------------------------------------------------
  144. static BriefingList theBriefingList;
  145. //-------------------------------------------------------------------------------------------------
  146. BriefingList* GetBriefingTextList(void)
  147. {
  148. return &theBriefingList;
  149. }
  150. //-------------------------------------------------------------------------------------------------
  151. void UpdateDiplomacyBriefingText(AsciiString newText, Bool clear)
  152. {
  153. GameWindow *listboxSolo = TheWindowManager->winGetWindowFromId(theWindow, NAMEKEY("Diplomacy.wnd:ListboxSolo"));
  154. if (clear)
  155. {
  156. theBriefingList.clear();
  157. if (listboxSolo)
  158. GadgetListBoxReset(listboxSolo);
  159. }
  160. if (newText.isEmpty())
  161. return;
  162. if (std::find(theBriefingList.begin(), theBriefingList.end(), newText) != theBriefingList.end())
  163. return;
  164. theBriefingList.push_back(newText);
  165. if (!listboxSolo)
  166. return;
  167. UnicodeString translated = TheGameText->fetch(newText);
  168. Int numEntries = GadgetListBoxGetNumEntries(listboxSolo);
  169. GadgetListBoxAddEntryText(listboxSolo, translated, TheInGameUI->getMessageColor(numEntries%2), -1);
  170. }
  171. // ------------------------------------------------------------------------------------------------
  172. // ------------------------------------------------------------------------------------------------
  173. void ShowDiplomacy( Bool immediate )
  174. {
  175. if (!TheInGameUI->getInputEnabled() || TheGameLogic->isIntroMoviePlaying() ||
  176. TheGameLogic->isLoadingGame())
  177. return;
  178. if (TheInGameUI->isQuitMenuVisible())
  179. return;
  180. if (TheDisconnectMenu && TheDisconnectMenu->isScreenVisible())
  181. return;
  182. if (theWindow)
  183. {
  184. theWindow->winHide(FALSE);
  185. theWindow->winEnable(TRUE);
  186. }
  187. else
  188. {
  189. theLayout = TheWindowManager->winCreateLayout( "Diplomacy.wnd" );
  190. theWindow = theLayout->getFirstWindow();
  191. theLayout->setUpdate(updateFunc);
  192. theAnimateWindowManager = NEW AnimateWindowManager;
  193. radioButtonInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonInGame");
  194. radioButtonBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonBuddies");
  195. radioButtonInGame = TheWindowManager->winGetWindowFromId(NULL, radioButtonInGameID);
  196. radioButtonBuddies = TheWindowManager->winGetWindowFromId(NULL, radioButtonBuddiesID);
  197. winInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:InGameParent");
  198. winBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:BuddiesParent");
  199. winSoloID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:SoloParent");
  200. winInGame = TheWindowManager->winGetWindowFromId(NULL, winInGameID);
  201. winBuddies = TheWindowManager->winGetWindowFromId(NULL, winBuddiesID);
  202. winSolo = TheWindowManager->winGetWindowFromId(NULL, winSoloID);
  203. if (!TheRecorder->isMultiplayer())
  204. {
  205. GameWindow *listboxSolo = TheWindowManager->winGetWindowFromId(theWindow, NAMEKEY("Diplomacy.wnd:ListboxSolo"));
  206. if (listboxSolo)
  207. {
  208. for (BriefingList::iterator it = theBriefingList.begin(); it != theBriefingList.end(); ++it)
  209. {
  210. UnicodeString translated = TheGameText->fetch(*it);
  211. Int numEntries = GadgetListBoxGetNumEntries(listboxSolo);
  212. GadgetListBoxAddEntryText(listboxSolo, translated, TheInGameUI->getMessageColor(numEntries%2), -1);
  213. }
  214. }
  215. }
  216. }
  217. theLayout->hide(FALSE);
  218. radioButtonInGame->winHide(TRUE);
  219. radioButtonBuddies->winHide(TRUE);
  220. GadgetRadioSetSelection(radioButtonInGame, FALSE);
  221. if (TheRecorder->isMultiplayer())
  222. {
  223. winInGame->winHide(FALSE);
  224. winBuddies->winHide(TRUE);
  225. winSolo->winHide(TRUE);
  226. }
  227. else
  228. {
  229. winInGame->winHide(TRUE);
  230. winBuddies->winHide(TRUE);
  231. winSolo->winHide(FALSE);
  232. }
  233. theAnimateWindowManager->reset();
  234. if (!immediate && TheGlobalData->m_animateWindows)
  235. theAnimateWindowManager->registerGameWindow( theWindow, WIN_ANIMATION_SLIDE_TOP, TRUE, 200 );
  236. TheInGameUI->registerWindowLayout(theLayout);
  237. grabWindowPointers();
  238. PopulateInGameDiplomacyPopup();
  239. if(TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0)
  240. {
  241. radioButtonInGame->winHide(FALSE);
  242. radioButtonBuddies->winHide(FALSE);
  243. InitBuddyControls(1);
  244. PopulateOldBuddyMessages();
  245. updateBuddyInfo();
  246. }
  247. }
  248. // ------------------------------------------------------------------------------------------------
  249. // ------------------------------------------------------------------------------------------------
  250. void ResetDiplomacy( void )
  251. {
  252. if(theLayout)
  253. {
  254. TheInGameUI->unregisterWindowLayout(theLayout);
  255. theLayout->destroyWindows();
  256. theLayout->deleteInstance();
  257. InitBuddyControls(-1);
  258. }
  259. theLayout = NULL;
  260. theWindow = NULL;
  261. if (theAnimateWindowManager)
  262. delete theAnimateWindowManager;
  263. theAnimateWindowManager = NULL;
  264. }
  265. // ------------------------------------------------------------------------------------------------
  266. // ------------------------------------------------------------------------------------------------
  267. void HideDiplomacy( Bool immediate )
  268. {
  269. releaseWindowPointers();
  270. if (theWindow)
  271. {
  272. if (immediate || !TheGlobalData->m_animateWindows)
  273. {
  274. theWindow->winHide(TRUE);
  275. theWindow->winEnable(FALSE);
  276. }
  277. else
  278. {
  279. if (theAnimateWindowManager->isFinished())
  280. theAnimateWindowManager->reverseAnimateWindow();
  281. }
  282. }
  283. }
  284. // ------------------------------------------------------------------------------------------------
  285. // ------------------------------------------------------------------------------------------------
  286. void ToggleDiplomacy( Bool immediate )
  287. {
  288. // If we bring this up, let's hide the quit menu
  289. HideQuitMenu();
  290. if (theWindow)
  291. {
  292. Bool show = theWindow->winIsHidden();
  293. if (show)
  294. ShowDiplomacy( immediate );
  295. else
  296. HideDiplomacy( immediate );
  297. }
  298. else
  299. {
  300. ShowDiplomacy( immediate );
  301. }
  302. }
  303. //-------------------------------------------------------------------------------------------------
  304. //-------------------------------------------------------------------------------------------------
  305. WindowMsgHandledType DiplomacyInput( GameWindow *window, UnsignedInt msg,
  306. WindowMsgData mData1, WindowMsgData mData2 )
  307. {
  308. switch( msg )
  309. {
  310. // --------------------------------------------------------------------------------------------
  311. case GWM_CHAR:
  312. {
  313. UnsignedByte key = mData1;
  314. // UnsignedByte state = mData2;
  315. switch( key )
  316. {
  317. // ----------------------------------------------------------------------------------------
  318. case KEY_ESC:
  319. {
  320. HideDiplomacy();
  321. return MSG_HANDLED;
  322. //return MSG_IGNORED;
  323. } // end escape
  324. } // end switch( key )
  325. return MSG_HANDLED;
  326. } // end char
  327. }
  328. return MSG_IGNORED;
  329. } // end DiplomacyInput
  330. //-------------------------------------------------------------------------------------------------
  331. WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg,
  332. WindowMsgData mData1, WindowMsgData mData2 )
  333. {
  334. if(BuddyControlSystem(window, msg, mData1, mData2) == MSG_HANDLED)
  335. {
  336. return MSG_HANDLED;
  337. }
  338. switch( msg )
  339. {
  340. //---------------------------------------------------------------------------------------------
  341. case GGM_FOCUS_CHANGE:
  342. {
  343. // Bool focus = (Bool) mData1;
  344. //if (focus)
  345. //TheWindowManager->winSetGrabWindow( chatTextEntry );
  346. break;
  347. } // end focus change
  348. //---------------------------------------------------------------------------------------------
  349. case GWM_INPUT_FOCUS:
  350. {
  351. // if we're given the opportunity to take the keyboard focus we must say we don't want it
  352. if( mData1 == TRUE )
  353. *(Bool *)mData2 = FALSE;
  354. return MSG_HANDLED;
  355. }//case GWM_INPUT_FOCUS:
  356. //---------------------------------------------------------------------------------------------
  357. case GBM_SELECTED:
  358. {
  359. GameWindow *control = (GameWindow *)mData1;
  360. NameKeyType controlID = (NameKeyType)control->winGetWindowId();
  361. static NameKeyType buttonHideID = NAMEKEY( "Diplomacy.wnd:ButtonHide" );
  362. if (controlID == buttonHideID)
  363. {
  364. HideDiplomacy( FALSE );
  365. }
  366. else if( controlID == radioButtonInGameID)
  367. {
  368. winInGame->winHide(FALSE);
  369. winBuddies->winHide(TRUE);
  370. }
  371. else if( controlID == radioButtonBuddiesID)
  372. {
  373. winInGame->winHide(TRUE);
  374. winBuddies->winHide(FALSE);
  375. }
  376. for (Int i=0; i<MAX_SLOTS; ++i)
  377. {
  378. if (controlID == buttonMuteID[i] && slotNumInRow[i] >= 0)
  379. {
  380. TheGameInfo->getSlot(slotNumInRow[i])->mute(TRUE);
  381. PopulateInGameDiplomacyPopup();
  382. break;
  383. }
  384. if (controlID == buttonUnMuteID[i] && slotNumInRow[i] >= 0)
  385. {
  386. TheGameInfo->getSlot(slotNumInRow[i])->mute(FALSE);
  387. PopulateInGameDiplomacyPopup();
  388. break;
  389. }
  390. }
  391. break;
  392. } // end button selected
  393. //---------------------------------------------------------------------------------------------
  394. default:
  395. return MSG_IGNORED;
  396. } // end switch( msg )
  397. return MSG_HANDLED;
  398. } // end DiplomacySystem
  399. void PopulateInGameDiplomacyPopup( void )
  400. {
  401. if (!TheGameInfo)
  402. return;
  403. Int rowNum = 0;
  404. for (Int slotNum=0; slotNum<MAX_SLOTS; ++slotNum)
  405. {
  406. const GameSlot *slot = TheGameInfo->getConstSlot(slotNum);
  407. if (slot && slot->isOccupied())
  408. {
  409. Bool isInGame = false;
  410. // Note - for skirmish, TheNetwork == NULL. jba.
  411. if (TheNetwork && TheNetwork->isPlayerConnected(slotNum)) {
  412. isInGame = true;
  413. } else if ((TheNetwork == NULL) && slot->isHuman()) {
  414. // this is a skirmish game and it is the human player.
  415. isInGame = true;
  416. }
  417. if (slot->isAI())
  418. isInGame = true;
  419. AsciiString playerName;
  420. playerName.format("player%d", slotNum);
  421. Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName));
  422. Bool isAlive = !TheVictoryConditions->hasSinglePlayerBeenDefeated(player);
  423. Bool isObserver = player->isPlayerObserver();
  424. if (slot->isHuman() && TheGameInfo->getLocalSlotNum() != slotNum && isInGame)
  425. {
  426. // show mute button
  427. if (buttonMute[rowNum])
  428. {
  429. buttonMute[rowNum]->winHide(slot->isMuted());
  430. }
  431. if (buttonUnMute[rowNum])
  432. {
  433. buttonUnMute[rowNum]->winHide(!slot->isMuted());
  434. }
  435. }
  436. else
  437. {
  438. // can't mute self, AI players, or MIA humans
  439. if (buttonMute[rowNum])
  440. buttonMute[rowNum]->winHide(TRUE);
  441. if (buttonUnMute[rowNum])
  442. buttonUnMute[rowNum]->winHide(TRUE);
  443. }
  444. Color playerColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor();
  445. Color backColor = GameMakeColor(0, 0, 0, 255);
  446. Color aliveColor = GameMakeColor(0, 255, 0, 255);
  447. Color deadColor = GameMakeColor(255, 0, 0, 255);
  448. Color observerInGameColor = GameMakeColor(255, 255, 255, 255);
  449. Color goneColor = GameMakeColor(196, 0, 0, 255);
  450. Color observerGoneColor = GameMakeColor(196, 196, 196, 255);
  451. if (staticTextPlayer[rowNum])
  452. {
  453. staticTextPlayer[rowNum]->winSetEnabledTextColors( playerColor, backColor );
  454. GadgetStaticTextSetText(staticTextPlayer[rowNum], slot->getName());
  455. }
  456. if (staticTextSide[rowNum])
  457. {
  458. staticTextSide[rowNum]->winSetEnabledTextColors( playerColor, backColor );
  459. GadgetStaticTextSetText(staticTextSide[rowNum], slot->getApparentPlayerTemplateDisplayName() );
  460. }
  461. if (staticTextTeam[rowNum])
  462. {
  463. staticTextTeam[rowNum]->winSetEnabledTextColors( playerColor, backColor );
  464. AsciiString teamStr;
  465. teamStr.format("Team:%d", slot->getTeamNumber() + 1);
  466. if (slot->isAI() && slot->getTeamNumber() == -1)
  467. teamStr = "Team:AI";
  468. GadgetStaticTextSetText(staticTextTeam[rowNum], TheGameText->fetch(teamStr) );
  469. }
  470. if (staticTextStatus[rowNum])
  471. {
  472. staticTextStatus[rowNum]->winHide(FALSE);
  473. if (isInGame)
  474. {
  475. if (isAlive)
  476. {
  477. staticTextStatus[rowNum]->winSetEnabledTextColors( aliveColor, backColor );
  478. GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerAlive"));
  479. }
  480. else
  481. {
  482. if (isObserver)
  483. {
  484. staticTextStatus[rowNum]->winSetEnabledTextColors( observerInGameColor, backColor );
  485. GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserver"));
  486. }
  487. else
  488. {
  489. staticTextStatus[rowNum]->winSetEnabledTextColors( deadColor, backColor );
  490. GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerDead"));
  491. }
  492. }
  493. }
  494. else
  495. {
  496. // not in game
  497. if (isObserver)
  498. {
  499. staticTextStatus[rowNum]->winSetEnabledTextColors( observerGoneColor, backColor );
  500. GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserverGone"));
  501. }
  502. else
  503. {
  504. staticTextStatus[rowNum]->winSetEnabledTextColors( goneColor, backColor );
  505. GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerGone"));
  506. }
  507. }
  508. }
  509. slotNumInRow[rowNum++] = slotNum;
  510. }
  511. }
  512. while (rowNum < MAX_SLOTS)
  513. {
  514. slotNumInRow[rowNum] = -1;
  515. if (staticTextPlayer[rowNum])
  516. staticTextPlayer[rowNum]->winHide(TRUE);
  517. if (staticTextSide[rowNum])
  518. staticTextSide[rowNum]->winHide(TRUE);
  519. if (staticTextTeam[rowNum])
  520. staticTextTeam[rowNum]->winHide(TRUE);
  521. if (staticTextStatus[rowNum])
  522. staticTextStatus[rowNum]->winHide(TRUE);
  523. if (buttonMute[rowNum])
  524. buttonMute[rowNum]->winHide(TRUE);
  525. if (buttonUnMute[rowNum])
  526. buttonUnMute[rowNum]->winHide(TRUE);
  527. ++rowNum;
  528. }
  529. }