PilotReadyScreen.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. /*************************************************************************************************\
  2. PilotReadyScreen.cpp : Implementation of the PilotReadyScreen component.
  3. //---------------------------------------------------------------------------//
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. //===========================================================================//
  6. \*************************************************************************************************/
  7. #include "PilotReadyScreen.h"
  8. #include "LogisticsMech.h"
  9. #include "LogisticsData.h"
  10. #include "LogisticsMechIcon.h"
  11. #include "..\resource.h"
  12. #include "MechBayScreen.h"
  13. #include "warrior.h"
  14. #include "Gamesound.h"
  15. #include "multPlyr.h"
  16. #include "ChatWindow.h"
  17. PilotReadyScreen* PilotReadyScreen::s_instance = NULL;
  18. #define PR_MSG_ADD 62
  19. #define PR_MSG_REMOVE 63
  20. #define PR_MSG_MAIN 64
  21. PilotReadyScreen::PilotReadyScreen()
  22. {
  23. pCurPilot = NULL;
  24. pIcons = NULL;
  25. status = LogisticsScreen::RUNNING;
  26. s_instance = this;
  27. forceGroupCount = 0;
  28. pDragPilot = 0;
  29. dragLeft = 0;
  30. status = PAUSED;
  31. helpTextArrayID = 13;
  32. mechSelected = 0;
  33. }
  34. PilotReadyScreen::~PilotReadyScreen()
  35. {
  36. if ( pIcons )
  37. delete [] pIcons;
  38. pIcons = NULL;
  39. LogisticsScreen::clear();
  40. }
  41. void PilotReadyScreen::init(FitIniFile* file)
  42. {
  43. mechDisplay.init();
  44. // init button, texts, statics, rects
  45. LogisticsScreen::init( *file, "PilotReadyStatic", "PilotReadyTextEntry", "PilotReadyRect", "PilotReadyButton" );
  46. // initialize little icons
  47. FitIniFile iconFile;
  48. char path[256];
  49. strcpy( path, artPath );
  50. strcat( path, "mcl_gn_deploymentteams.fit" );
  51. strlwr( path );
  52. if ( NO_ERR != iconFile.open( path ) )
  53. {
  54. gosASSERT( "couldn't open the MCL_GN_DevploymentTeams file" );
  55. return;
  56. }
  57. LogisticsMechIcon::init(iconFile);
  58. pIcons = new LogisticsMechIcon[ICON_COUNT];
  59. int count = 0;
  60. long x = 0;
  61. long y = 0;
  62. for ( int j = 0; j < ICON_COUNT_Y; j++ )
  63. {
  64. for ( int i = 0; i < ICON_COUNT_X; i++ )
  65. {
  66. pIcons[count].setHelpID( IDS_HELP_DEPLOYTEAMMW );
  67. pIcons[count].setMech( 0 );
  68. pIcons[count].move( x, y );
  69. x+= pIcons[count].width();
  70. x+=4;
  71. count++;
  72. }
  73. y+= pIcons[i].height();
  74. y += 5;
  75. x = 0;
  76. }
  77. int mechCount[256];
  78. memset( mechCount, 0, sizeof ( int ) * 256 );
  79. // initialize the attribute meeters
  80. attributeMeters[0].init( file, "AttributeMeter0" );
  81. attributeMeters[1].init( file, "AttributeMeter1" );
  82. for ( int i= 0; i < buttonCount; i++ )
  83. buttons[i].setMessageOnRelease();
  84. pilotListBox.init( rects[0].left(), rects[0].top(),
  85. rects[0].width(), rects[0].height() );
  86. FullPathFileName tmpPath;
  87. tmpPath.init( artPath, "mcl_pr_availablepilotentry", ".fit" );
  88. FitIniFile tmpFile;
  89. if ( NO_ERR != tmpFile.open( tmpPath ) )
  90. {
  91. Assert( 0, 0, "couldn't open MCL_PR_AvailablePilotEntry.fit" );
  92. }
  93. LogisticsPilotListBoxItem::init( &tmpFile );
  94. char blockName[32];
  95. for ( i = 0; i < 4; i++ )
  96. {
  97. sprintf( blockName, "PilotSpecialtySkillIcon%ld", i );
  98. specialtySkillIcons[i].init( file, blockName );
  99. }
  100. for ( i = 0; i < 4; i++ )
  101. {
  102. sprintf( blockName, "PilotSpecialtySkill%ld", i );
  103. file->seekBlock( blockName );
  104. file->readIdLong( "left", skillLocations[i].left );
  105. file->readIdLong( "top", skillLocations[i].top );
  106. file->readIdLong( "bottom", skillLocations[i].bottom );
  107. file->readIdLong( "right", skillLocations[i].right );
  108. }
  109. for ( i = 0; i < 5; i++ )
  110. {
  111. sprintf( blockName, "PilotReadyRankIcon%ld", i );
  112. rankIcons[i].init( file, blockName );
  113. }
  114. for ( i = 0; i < 16; i++ )
  115. {
  116. sprintf( blockName, "PilotMedal%ld", i );
  117. medalIcons[i].init( file, blockName );
  118. }
  119. for ( i = 0; i < 16; i++ )
  120. {
  121. sprintf( blockName, "PilotMedalPlacement%ld", i );
  122. file->seekBlock( blockName );
  123. file->readIdLong( "left", medalLocations[i].left );
  124. file->readIdLong( "right", medalLocations[i].right );
  125. file->readIdLong( "top", medalLocations[i].top );
  126. file->readIdLong( "bottom", medalLocations[i].bottom );
  127. }
  128. }
  129. void PilotReadyScreen::begin()
  130. {
  131. getButton( MB_MSG_PREV )->disable( false );
  132. getButton( MB_MSG_MAINMENU )->disable( false );
  133. launchFadeTime = 0;
  134. // initialize both the inventory and icon lists
  135. EList< LogisticsMech*, LogisticsMech* > mechList;
  136. LogisticsData::instance->getInventory( mechList );
  137. // reset force group
  138. forceGroupCount = 0;
  139. int maxUnits = 12;
  140. if ( MPlayer )
  141. {
  142. long playerCount;
  143. MPlayer->getPlayers( playerCount );
  144. if ( playerCount )
  145. maxUnits = MAX_MULTIPLAYER_MECHS_IN_LOGISTICS/playerCount;
  146. if ( maxUnits > 12 )
  147. maxUnits = 12;
  148. }
  149. for ( int i = 0; i < 12; i++ )
  150. {
  151. pIcons[i].setMech( 0 );
  152. pIcons[i].select( 0 );
  153. if ( i >= maxUnits )
  154. pIcons[i].disable( 1 );
  155. else
  156. pIcons[i].disable( 0 );
  157. }
  158. if ( getButton( MB_MSG_MAINMENU ) )
  159. getButton( MB_MSG_MAINMENU )->setPressFX( -1 );
  160. int bHasPilot = -1;
  161. // update pilot use here... things can get screwed up.
  162. pilotListBox.removeAllItems( true );
  163. long count = 256;
  164. LogisticsPilot* pilots[256];
  165. LogisticsData::instance->getPilots( pilots, count );
  166. for ( i = 0; i < count; i++ )
  167. {
  168. pilots[i]->setUsed(0);
  169. }
  170. for ( EList< LogisticsMech*, LogisticsMech* >::EIterator iter = mechList.Begin();
  171. !iter.IsDone(); iter++ )
  172. {
  173. if ( (*iter)->getForceGroup() )
  174. {
  175. long FG = (*iter)->getForceGroup();
  176. pIcons[FG-1].setMech( (*iter) );
  177. if ( (*iter)->getPilot() )
  178. {
  179. (*iter)->getPilot()->setUsed( true );
  180. pIcons[FG-1].setPilot( (*iter)->getPilot() );
  181. bHasPilot = FG - 1;
  182. }
  183. forceGroupCount++;
  184. }
  185. }
  186. for ( i = 0; i < count; i++ )
  187. {
  188. if ( !pilots[i]->isUsed() && pilots[i]->isAvailable() )
  189. {
  190. pilotListBox.AddItem( new LogisticsPilotListBoxItem( pilots[i] ) );
  191. }
  192. }
  193. status = RUNNING;
  194. if ( bHasPilot != -1 )
  195. {
  196. pIcons[bHasPilot].select( true );
  197. setPilot( pIcons[bHasPilot].getPilot() );
  198. }
  199. else
  200. {
  201. LogisticsPilotListBoxItem* pItem = ( LogisticsPilotListBoxItem*)pilotListBox.GetItem( 0 );
  202. if ( pItem )
  203. {
  204. pilotListBox.SelectItem( 0 );
  205. setPilot( pItem->getPilot() );
  206. }
  207. pIcons[0].select( true );
  208. }
  209. }
  210. void PilotReadyScreen::end()
  211. {
  212. mechDisplay.setMech( NULL );
  213. }
  214. void PilotReadyScreen::render(int xOffset, int yOffset )
  215. {
  216. pilotListBox.move( xOffset, yOffset );
  217. pilotListBox.render();
  218. pilotListBox.move( -xOffset, -yOffset );
  219. if ( !xOffset && !yOffset )
  220. {
  221. if ( !MPlayer && !LogisticsData::instance->isSingleMission() && LogisticsData::instance->newPilotsAvailable() )
  222. {
  223. soundSystem->playBettySample( BETTY_NEW_PILOTS );
  224. LogisticsData::instance->setNewPilotsAcknowledged();
  225. }
  226. }
  227. for ( int i = 0; i < 2; i++ )
  228. {
  229. attributeMeters[i].render( xOffset, yOffset );
  230. }
  231. if ( pCurPilot )
  232. rankIcons[pCurPilot->getRank()].render(xOffset, yOffset);
  233. for ( i = 0; i < 4; i++ )
  234. skillIcons[i].render(xOffset, yOffset);
  235. for ( i = 0; i < MAX_MEDAL; i++ )
  236. medalIcons[i].render(xOffset, yOffset);
  237. LogisticsScreen::render( xOffset, yOffset );
  238. for ( i = 0; i < ICON_COUNT; i++ )
  239. {
  240. pIcons[i].render( xOffset, yOffset );
  241. }
  242. if ( mechSelected )
  243. {
  244. // hack, cover up pilot stuff.
  245. GUI_RECT rect = { 77 + xOffset, 317 + yOffset, 720+ xOffset, 515 + yOffset };
  246. drawRect( rect, 0xff000000 );
  247. mechDisplay.render( xOffset, yOffset );
  248. // hack, cover up list box overrruns.
  249. statics[27].render( xOffset, yOffset );
  250. statics[28].render( xOffset, yOffset );
  251. }
  252. if ( launchFadeTime )
  253. {
  254. launchFadeTime += frameLength;
  255. long color = interpolateColor( 0x00000000, 0x7f000000, launchFadeTime/.5f );
  256. GUI_RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight };
  257. drawRect( rect, color );
  258. }
  259. if ( MPlayer && ChatWindow::instance() )
  260. ChatWindow::instance()->render(xOffset, yOffset);
  261. if ( pDragPilot )
  262. dragIcon.render();
  263. }
  264. void PilotReadyScreen::update()
  265. {
  266. if ( MPlayer )
  267. {
  268. if ( MPlayer->playersReadyToLoad() )
  269. status = NEXT;
  270. }
  271. if ( getButton( MB_MSG_PREV )->isEnabled() ) // this is disabled if the user has already pressed launch )
  272. {
  273. // update current text
  274. char str[64];
  275. // RP
  276. sprintf( str, "%ld ", LogisticsData::instance->getCBills() );
  277. textObjects[1].setText( str );
  278. for ( int i = 0; i < 4; i++ )
  279. skillIcons[i].update();
  280. // desel icons if necessary
  281. bool bAllFull = 1;
  282. int newSel = -1;
  283. int oldSel = -1;
  284. bool bHasMech = 0;
  285. int newRightSel = -1;
  286. for ( i = 0; i < ICON_COUNT; i++ )
  287. {
  288. pIcons[i].update();
  289. if ( pIcons[i].justSelected() )
  290. newSel = i;
  291. else if ( pIcons[i].isSelected() )
  292. oldSel = i;
  293. bool bInside = pIcons[i].pointInside( userInput->getMouseX(), userInput->getMouseY() );
  294. if ( userInput->isLeftDoubleClick() && bInside && pIcons[i].getMech() )
  295. {
  296. removeSelectedPilot();
  297. }
  298. if ( userInput->isRightClick() && bInside && pIcons[i].getMech() )
  299. {
  300. newRightSel = i;
  301. }
  302. else if ( userInput->isLeftDrag()
  303. && bInside
  304. && pIcons[i].pointInside( userInput->getMouseDragX(), userInput->getMouseDragY() )
  305. && pIcons[i].getMech() )
  306. {
  307. beginDrag( pIcons[i].getMech()->getPilot() );
  308. pIcons[i].dimPilot( true );
  309. pIcons[i].setPilot( NULL );
  310. }
  311. if ( pIcons[i].getMech() && !pIcons[i].getPilot() )
  312. bAllFull = 0;
  313. if ( pIcons[i].getMech() )
  314. bHasMech = true;
  315. }
  316. if ( newSel != -1 )
  317. {
  318. if ( oldSel != -1 )
  319. pIcons[oldSel].select( 0 );
  320. if ( pIcons[newSel].getPilot() )
  321. {
  322. setPilot( pIcons[newSel].getPilot() );
  323. }
  324. else
  325. setMech( pIcons[newSel].getMech() );
  326. }
  327. if ( newRightSel != -1 )
  328. {
  329. setMech( pIcons[newRightSel].getMech() );
  330. }
  331. long curSel = newSel == -1 ? oldSel : newSel;
  332. if ( !MPlayer || !ChatWindow::instance()->pointInside(userInput->getMouseX(), userInput->getMouseY()) )
  333. LogisticsScreen::update();
  334. if ( mechSelected &&
  335. ( !MPlayer || !ChatWindow::instance()->pointInside(userInput->getMouseX(), userInput->getMouseY()) ))
  336. {
  337. if ( userInput->getMouseY() > 317 )
  338. {
  339. helpID = 0;
  340. textObjects[helpTextArrayID].setText( "" );
  341. }
  342. mechDisplay.update();
  343. }
  344. if ( !bAllFull ) // disable the next button until all have pilots
  345. {
  346. buttons[1].disable( 1 );
  347. if ( curSel == -1 || pIcons[curSel].getPilot() )
  348. buttons[2].disable( 1 );
  349. else
  350. buttons[2].disable( 0 );
  351. }
  352. else
  353. {
  354. if ( bHasMech )
  355. buttons[1].disable( 0 );
  356. else
  357. buttons[1].disable( 1 );
  358. buttons[2].disable( 1 );
  359. }
  360. if ( ( newSel == -1 && oldSel == -1 )|| !pIcons[curSel].getPilot())
  361. {
  362. // disable the remove button
  363. buttons[3].disable(1);
  364. }
  365. else
  366. buttons[3].disable(0);
  367. for ( i = 0; i < MAX_MEDAL; i++ ) // so we get rollovers
  368. medalIcons[i].update();
  369. // update drag and drop
  370. if ( pDragPilot )
  371. {
  372. dragIcon.moveTo( userInput->getMouseX() - dragIcon.width() / 2,
  373. userInput->getMouseY() - dragIcon.height() / 2 );
  374. LogisticsMechIcon* pSelIcon = 0;
  375. for ( int i = 0; i < ICON_COUNT; i++ )
  376. {
  377. if ( pIcons[i].pointInside( userInput->getMouseX(), userInput->getMouseY() )
  378. && pIcons[i].getMech() )
  379. {
  380. pSelIcon = &pIcons[i];
  381. break;
  382. }
  383. }
  384. if ( userInput->leftMouseReleased( ) )
  385. {
  386. endDrag(pSelIcon);
  387. }
  388. }
  389. pilotListBox.update();
  390. }
  391. if ( MPlayer && ChatWindow::instance() )
  392. ChatWindow::instance()->update();
  393. }
  394. int PilotReadyScreen::handleMessage( unsigned long message, unsigned long who )
  395. {
  396. switch( who )
  397. {
  398. case MB_MSG_NEXT:
  399. if ( MPlayer )
  400. {
  401. MPlayer->sendMissionSetup(0, 7, NULL);
  402. getButton( MB_MSG_PREV )->disable( true );
  403. getButton( MB_MSG_NEXT )->disable( true );
  404. getButton( MB_MSG_MAINMENU )->disable( true );
  405. MC2Player* pInfo = MPlayer->getPlayerInfo( MPlayer->commanderID );
  406. if ( pInfo )
  407. {
  408. const char* name = pInfo->name;
  409. MPlayer->sendPlayerActionChat(NULL, name, IDS_MP_PLAYER_READY );
  410. }
  411. pilotListBox.SelectItem( -1 );
  412. launchFadeTime = .0001f;
  413. }
  414. else
  415. status = NEXT;
  416. break;
  417. case MB_MSG_PREV:
  418. status = PREVIOUS;
  419. break;
  420. case PR_MSG_ADD:
  421. addSelectedPilot();
  422. break;
  423. case PR_MSG_REMOVE:
  424. removeSelectedPilot();
  425. break;
  426. case MB_MSG_MAINMENU:
  427. status = MAINMENU;
  428. break;
  429. }
  430. return 0;
  431. }
  432. void PilotReadyScreen::addSelectedPilot()
  433. {
  434. aListItem* pItem = NULL;
  435. bool bFound = 0;
  436. int index = pilotListBox.GetSelectedItem();
  437. if ( index != -1 )
  438. pItem = pilotListBox.GetItem( index );
  439. if ( pItem )
  440. {
  441. LogisticsPilot* pPilot = ((LogisticsPilotListBoxItem*)pItem)->getPilot();
  442. if ( pPilot )
  443. {
  444. for ( int i = 0; i < ICON_COUNT; i++ )
  445. {
  446. if ( pIcons[i].isSelected() )
  447. {
  448. if ( !pIcons[i].getPilot() && pIcons[i].getMech() )
  449. {
  450. pIcons[i].setPilot( pPilot );
  451. pIcons[i].select( 0 );
  452. i++;
  453. if ( i >= ICON_COUNT || !pIcons[i].getMech() )
  454. i = 0;
  455. pIcons[i].select( true );
  456. bFound = true;
  457. break;
  458. }
  459. }
  460. }
  461. if ( !bFound )
  462. {
  463. // if we got here, there was nothing selected
  464. for ( i = 0; i < ICON_COUNT; i++ )
  465. {
  466. if ( pIcons[i].getMech() && !pIcons[i].getPilot() )
  467. {
  468. pIcons[i].setPilot( pPilot );
  469. bFound = true;
  470. break;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. if ( index != -1 )
  477. pItem = pilotListBox.GetItem( index+1 );
  478. if ( pItem && bFound )
  479. {
  480. LogisticsPilot* pPilot = ((LogisticsPilotListBoxItem*)pItem)->getPilot();
  481. if ( pPilot )
  482. {
  483. setPilot( pPilot );
  484. }
  485. }
  486. }
  487. void PilotReadyScreen::removeSelectedPilot()
  488. {
  489. for ( int i = 0; i < ICON_COUNT; i++ )
  490. {
  491. if ( pIcons[i].isSelected() )
  492. {
  493. if ( pIcons[i].getPilot() )
  494. {
  495. // add the pilot back into the list
  496. int oldSel = pilotListBox.GetSelectedItem();
  497. LogisticsPilotListBoxItem* pNewItem = new LogisticsPilotListBoxItem( pIcons[i].getPilot() );
  498. int newIndex = pilotListBox.AddItem( pNewItem );
  499. pIcons[i].setPilot( NULL );
  500. pIcons[i].select( 0 );
  501. i++;
  502. if ( i >= ICON_COUNT || !pIcons[i].getMech() )
  503. i = 0;
  504. pIcons[i].select( true );
  505. if ( pIcons[i].getPilot() )
  506. {
  507. if ( newIndex <= oldSel )
  508. {
  509. pilotListBox.SelectItem( oldSel+1 );
  510. }
  511. setPilot( pIcons[i].getPilot() );
  512. }
  513. else
  514. {
  515. pilotListBox.SelectItem( newIndex );
  516. int index = pilotListBox.GetSelectedItem();
  517. if ( index != -1 )
  518. {
  519. LogisticsPilotListBoxItem* pItem = (LogisticsPilotListBoxItem*)pilotListBox.GetItem( index );
  520. if ( pItem )
  521. {
  522. LogisticsPilot* pPilot = ((LogisticsPilotListBoxItem*)pItem)->getPilot();
  523. if ( pPilot )
  524. {
  525. setPilot( pPilot );
  526. }
  527. }
  528. }
  529. }
  530. }
  531. return;
  532. }
  533. }
  534. }
  535. void PilotReadyScreen::beginDrag( LogisticsPilot* pPilot )
  536. {
  537. if ( !pDragPilot )
  538. pDragPilot = pPilot;
  539. if ( pPilot )
  540. LogisticsPilotListBox::makeUVs( pPilot, dragIcon );
  541. launchFadeTime = 0.f;
  542. }
  543. void PilotReadyScreen::endDrag( LogisticsMechIcon* pIcon )
  544. {
  545. if ( pIcon )
  546. {
  547. LogisticsPilot* pOldPilot = pIcon->getPilot();
  548. if ( pOldPilot )
  549. putBackPilot( pOldPilot );
  550. pIcon->setPilot( pDragPilot );
  551. pilotListBox.removePilot( pDragPilot );
  552. }
  553. else
  554. {
  555. putBackPilot( pDragPilot );
  556. }
  557. pDragPilot = 0;
  558. }
  559. void PilotReadyScreen::putBackPilot( LogisticsPilot* pPilot )
  560. {
  561. for ( int i = 0; i < ICON_COUNT; i++ )
  562. {
  563. if ( pIcons[i].getPilot() == pPilot )
  564. {
  565. pIcons[i].setPilot( 0 );
  566. pIcons[i].dimPilot( false );
  567. }
  568. }
  569. LogisticsPilotListBoxItem* pItem = new LogisticsPilotListBoxItem( pPilot );
  570. pilotListBox.AddItem( pItem );
  571. }
  572. void PilotReadyScreen::setPilot( LogisticsPilot* pPilot )
  573. {
  574. mechSelected = 0;
  575. if ( pPilot != pCurPilot )
  576. {
  577. pCurPilot = pPilot;
  578. // set up the big bitmap
  579. if ( !pCurPilot )
  580. {
  581. statics[staticCount-1].setColor( 0 );
  582. return;
  583. }
  584. char fileName[256];
  585. strcpy( fileName, artPath );
  586. strcat( fileName, "MCL_PR_" );
  587. strcat( fileName, pPilot->getName() );
  588. strcat( fileName, ".tga" );
  589. EString str = fileName;
  590. str.MakeLower();
  591. statics[67].setTexture( str );
  592. statics[67].setColor( 0xffffffff );
  593. statics[67].setUVs( 0, 0, 92, 128 );
  594. }
  595. // update pilot specific stuff
  596. if ( pCurPilot )
  597. {
  598. char str[256];
  599. //ACE not continguous with other ranks. Added too late!
  600. if (pCurPilot->getRank() != 4)
  601. textObjects[4].setText( IDS_GREEN + pCurPilot->getRank() );
  602. else
  603. textObjects[4].setText( IDS_ACE );
  604. sprintf( str, "%ld", (long)pCurPilot->getGunnery() );
  605. textObjects[5].setText( str );
  606. attributeMeters[0].setValue( ((float)pCurPilot->getGunnery())/80.f );
  607. char number[64];
  608. sprintf( number, "%ld", (long)pCurPilot->getPiloting() );
  609. textObjects[6].setText( number );
  610. attributeMeters[1].setValue( pCurPilot->getPiloting()/80.f );
  611. sprintf( number, "%ld", pCurPilot->getMechKills() );
  612. textObjects[7].setText( number );
  613. EString name = pCurPilot->getName();
  614. name.MakeUpper();
  615. textObjects[8].setText( name );
  616. int count = 32;
  617. const char* specialtySkills[32];
  618. int skillIDs[32];
  619. pCurPilot->getSpecialtySkills( specialtySkills, count );
  620. count = 32;
  621. pCurPilot->getSpecialtySkills( skillIDs, count );
  622. for ( int i = 0; i < 4; i++ )
  623. {
  624. if ( i < count )
  625. {
  626. textObjects[9+i].setText( specialtySkills[i] );
  627. textObjects[9+i].resize( textObjects[9+i].width(), textObjects[9+i].font.height() );
  628. textObjects[9+i].setHelpID( skillIDs[i] + IDS_SPECIALTY_HELP1 );
  629. skillIcons[i] = specialtySkillIcons[MechWarrior::skillTypes[skillIDs[i]]];
  630. skillIcons[i].resize( skillLocations[i].right - skillLocations[i].left,
  631. skillLocations[i].bottom - skillLocations[i].top );
  632. skillIcons[i].moveTo( skillLocations[i].left, skillLocations[i].top );
  633. skillIcons[i].setColor( 0xffffffff );
  634. skillIcons[i].setHelpID( skillIDs[i] + IDS_SPECIALTY_HELP1 );
  635. }
  636. else
  637. {
  638. textObjects[9+i].setText( "" );
  639. skillIcons[i].setColor( 0 );
  640. skillIcons[i].setHelpID( 0 );
  641. }
  642. }
  643. for( ; i < 4; i++ )
  644. skillIcons[i].setColor( 0 );
  645. const bool* medals = pCurPilot->getMedalArray( );
  646. long medalCount = 0;
  647. for ( i = 0; i < MAX_MEDAL; i++ )
  648. {
  649. if ( medals[i] )
  650. {
  651. medalIcons[i].moveTo( medalLocations[medalCount].left, medalLocations[medalCount].top );
  652. medalIcons[i].resize( medalLocations[medalCount].right - medalLocations[medalCount].left,
  653. medalLocations[medalCount].bottom - medalLocations[medalCount].top );
  654. medalIcons[i].setColor( 0xffffffff );
  655. medalCount++;
  656. medalIcons[i].showGUIWindow( true );
  657. medalIcons[i].setHelpID( IDS_HELP_MEDAL1 + i );
  658. }
  659. else
  660. {
  661. medalIcons[i].showGUIWindow( 0 );
  662. }
  663. }
  664. }
  665. else
  666. {
  667. for ( int i = 4; i < 13; i++ )
  668. textObjects[i].setText( "" );
  669. statics[staticCount-1].setColor( 0 );
  670. }
  671. }
  672. void PilotReadyScreen::setMech( LogisticsMech* pMech )
  673. {
  674. mechSelected = true;
  675. mechDisplay.setMech( pMech, 0 );
  676. }