Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

735 lines
17 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "hudelement.h"
  8. #include "hud_numericdisplay.h"
  9. #include <vgui_controls/Panel.h>
  10. #include "hud.h"
  11. #include "hud_suitpower.h"
  12. #include "hud_macros.h"
  13. #include "iclientmode.h"
  14. #include <vgui_controls/AnimationController.h>
  15. #include <vgui/ISurface.h>
  16. #include <vgui/ILocalize.h>
  17. #include "KeyValues.h"
  18. #include "filesystem.h"
  19. // memdbgon must be the last include file in a .cpp file!!!
  20. #include "tier0/memdbgon.h"
  21. struct creditname_t
  22. {
  23. char szCreditName[256];
  24. char szFontName[256];
  25. float flYPos;
  26. float flXPos;
  27. bool bActive;
  28. float flTime;
  29. float flTimeAdd;
  30. float flTimeStart;
  31. int iSlot;
  32. };
  33. #define CREDITS_FILE "scripts/credits.txt"
  34. enum
  35. {
  36. LOGO_FADEIN = 0,
  37. LOGO_FADEHOLD,
  38. LOGO_FADEOUT,
  39. LOGO_FADEOFF,
  40. };
  41. #define CREDITS_LOGO 1
  42. #define CREDITS_INTRO 2
  43. #define CREDITS_OUTRO 3
  44. bool g_bRollingCredits = false;
  45. int g_iCreditsPixelHeight = 0;
  46. //-----------------------------------------------------------------------------
  47. // Purpose: Shows the flashlight icon
  48. //-----------------------------------------------------------------------------
  49. class CHudCredits : public CHudElement, public vgui::Panel
  50. {
  51. DECLARE_CLASS_SIMPLE( CHudCredits, vgui::Panel );
  52. public:
  53. CHudCredits( const char *pElementName );
  54. virtual void Init( void );
  55. virtual void LevelShutdown( void );
  56. int GetStringPixelWidth ( wchar_t *pString, vgui::HFont hFont );
  57. void MsgFunc_CreditsMsg( bf_read &msg );
  58. void MsgFunc_LogoTimeMsg( bf_read &msg );
  59. virtual bool ShouldDraw( void )
  60. {
  61. g_bRollingCredits = IsActive();
  62. if ( g_bRollingCredits && m_iCreditsType == CREDITS_INTRO )
  63. g_bRollingCredits = false;
  64. return IsActive();
  65. }
  66. protected:
  67. virtual void Paint();
  68. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  69. private:
  70. void Clear();
  71. void ReadNames( KeyValues *pKeyValue );
  72. void ReadParams( KeyValues *pKeyValue );
  73. void PrepareCredits( const char *pKeyName );
  74. void DrawOutroCreditsName( void );
  75. void DrawIntroCreditsName( void );
  76. void DrawLogo( void );
  77. void PrepareLogo( float flTime );
  78. void PrepareOutroCredits( void );
  79. void PrepareIntroCredits( void );
  80. float FadeBlend( float fadein, float fadeout, float hold, float localTime );
  81. void PrepareLine( vgui::HFont hFont, char const *pchLine );
  82. CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
  83. CPanelAnimationVar( Color, m_TextColor, "TextColor", "FgColor" );
  84. CUtlVector<creditname_t> m_CreditsList;
  85. float m_flScrollTime;
  86. float m_flSeparation;
  87. float m_flFadeTime;
  88. bool m_bLastOneInPlace;
  89. int m_Alpha;
  90. int m_iCreditsType;
  91. int m_iLogoState;
  92. float m_flFadeInTime;
  93. float m_flFadeHoldTime;
  94. float m_flFadeOutTime;
  95. float m_flNextStartTime;
  96. float m_flPauseBetweenWaves;
  97. float m_flLogoTimeMod;
  98. float m_flLogoTime;
  99. float m_flLogoDesiredLength;
  100. float m_flX;
  101. float m_flY;
  102. char m_szLogo[256];
  103. char m_szLogo2[256];
  104. Color m_cColor;
  105. };
  106. void CHudCredits::PrepareCredits( const char *pKeyName )
  107. {
  108. Clear();
  109. KeyValues *pKV= new KeyValues( "CreditsFile" );
  110. if ( !pKV->LoadFromFile( filesystem, CREDITS_FILE, "MOD" ) )
  111. {
  112. pKV->deleteThis();
  113. Assert( !"env_credits couldn't be initialized!" );
  114. return;
  115. }
  116. KeyValues *pKVSubkey;
  117. if ( pKeyName )
  118. {
  119. pKVSubkey = pKV->FindKey( pKeyName );
  120. ReadNames( pKVSubkey );
  121. }
  122. pKVSubkey = pKV->FindKey( "CreditsParams" );
  123. ReadParams( pKVSubkey );
  124. pKV->deleteThis();
  125. }
  126. using namespace vgui;
  127. DECLARE_HUDELEMENT( CHudCredits );
  128. DECLARE_HUD_MESSAGE( CHudCredits, CreditsMsg );
  129. DECLARE_HUD_MESSAGE( CHudCredits, LogoTimeMsg );
  130. //-----------------------------------------------------------------------------
  131. // Purpose: Constructor
  132. //-----------------------------------------------------------------------------
  133. CHudCredits::CHudCredits( const char *pElementName ) : CHudElement( pElementName ), BaseClass( NULL, "HudCredits" )
  134. {
  135. vgui::Panel *pParent = g_pClientMode->GetViewport();
  136. SetParent( pParent );
  137. }
  138. void CHudCredits::LevelShutdown()
  139. {
  140. Clear();
  141. }
  142. void CHudCredits::Clear( void )
  143. {
  144. SetActive( false );
  145. m_CreditsList.RemoveAll();
  146. m_bLastOneInPlace = false;
  147. m_Alpha = m_TextColor[3];
  148. m_iLogoState = LOGO_FADEOFF;
  149. }
  150. //-----------------------------------------------------------------------------
  151. // Purpose:
  152. //-----------------------------------------------------------------------------
  153. void CHudCredits::Init()
  154. {
  155. HOOK_HUD_MESSAGE( CHudCredits, CreditsMsg );
  156. HOOK_HUD_MESSAGE( CHudCredits, LogoTimeMsg );
  157. SetActive( false );
  158. }
  159. void CHudCredits::ReadNames( KeyValues *pKeyValue )
  160. {
  161. if ( pKeyValue == NULL )
  162. {
  163. Assert( !"CHudCredits couldn't be initialized!" );
  164. return;
  165. }
  166. // Now try and parse out each act busy anim
  167. KeyValues *pKVNames = pKeyValue->GetFirstSubKey();
  168. while ( pKVNames )
  169. {
  170. creditname_t Credits;
  171. V_strcpy_safe( Credits.szCreditName, pKVNames->GetName() );
  172. V_strcpy_safe( Credits.szFontName, pKeyValue->GetString( Credits.szCreditName, "Default" ) );
  173. m_CreditsList.AddToTail( Credits );
  174. pKVNames = pKVNames->GetNextKey();
  175. }
  176. }
  177. void CHudCredits::ReadParams( KeyValues *pKeyValue )
  178. {
  179. if ( pKeyValue == NULL )
  180. {
  181. Assert( !"CHudCredits couldn't be initialized!" );
  182. return;
  183. }
  184. m_flScrollTime = pKeyValue->GetFloat( "scrolltime", 57 );
  185. m_flSeparation = pKeyValue->GetFloat( "separation", 5 );
  186. m_flFadeInTime = pKeyValue->GetFloat( "fadeintime", 1 );
  187. m_flFadeHoldTime = pKeyValue->GetFloat( "fadeholdtime", 3 );
  188. m_flFadeOutTime = pKeyValue->GetFloat( "fadeouttime", 2 );
  189. m_flNextStartTime = pKeyValue->GetFloat( "nextfadetime", 2 );
  190. m_flPauseBetweenWaves = pKeyValue->GetFloat( "pausebetweenwaves", 2 );
  191. m_flLogoTimeMod = pKeyValue->GetFloat( "logotime", 2 );
  192. m_flX = pKeyValue->GetFloat( "posx", 2 );
  193. m_flY = pKeyValue->GetFloat( "posy", 2 );
  194. m_cColor = pKeyValue->GetColor( "color" );
  195. Q_strncpy( m_szLogo, pKeyValue->GetString( "logo", "HALF-LIFE'" ), sizeof( m_szLogo ) );
  196. Q_strncpy( m_szLogo2, pKeyValue->GetString( "logo2", "" ), sizeof( m_szLogo2 ) );
  197. }
  198. int CHudCredits::GetStringPixelWidth( wchar_t *pString, vgui::HFont hFont )
  199. {
  200. int iLength = 0;
  201. for ( wchar_t *wch = pString; *wch != 0; wch++ )
  202. {
  203. iLength += surface()->GetCharacterWidth( hFont, *wch );
  204. }
  205. return iLength;
  206. }
  207. void CHudCredits::DrawOutroCreditsName( void )
  208. {
  209. if ( m_CreditsList.Count() == 0 )
  210. return;
  211. // fill the screen
  212. int iWidth, iTall;
  213. GetHudSize(iWidth, iTall);
  214. SetSize( iWidth, iTall );
  215. for ( int i = 0; i < m_CreditsList.Count(); i++ )
  216. {
  217. creditname_t *pCredit = &m_CreditsList[i];
  218. if ( pCredit == NULL )
  219. continue;
  220. vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
  221. vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName, true );
  222. int iFontTall = surface()->GetFontTall ( m_hTFont );
  223. if ( pCredit->flYPos < -iFontTall || pCredit->flYPos > iTall )
  224. {
  225. pCredit->bActive = false;
  226. }
  227. else
  228. {
  229. pCredit->bActive = true;
  230. }
  231. Color cColor = m_TextColor;
  232. //HACKHACK
  233. //Last one stays on screen and fades out
  234. if ( i == m_CreditsList.Count()-1 )
  235. {
  236. if ( m_bLastOneInPlace == false )
  237. {
  238. pCredit->flYPos -= gpGlobals->frametime * ( (float)g_iCreditsPixelHeight / m_flScrollTime );
  239. if ( (int)pCredit->flYPos + ( iFontTall / 2 ) <= iTall / 2 )
  240. {
  241. m_bLastOneInPlace = true;
  242. // 360 certification requires that we not hold a static image too long.
  243. m_flFadeTime = gpGlobals->curtime + ( IsConsole() ? 2.0f : 10.0f );
  244. }
  245. }
  246. else
  247. {
  248. if ( m_flFadeTime <= gpGlobals->curtime )
  249. {
  250. if ( m_Alpha > 0 )
  251. {
  252. m_Alpha -= gpGlobals->frametime * ( m_flScrollTime * 2 );
  253. if ( m_Alpha <= 0 )
  254. {
  255. pCredit->bActive = false;
  256. engine->ClientCmd( "creditsdone" );
  257. }
  258. }
  259. }
  260. cColor[3] = MAX( 0, m_Alpha );
  261. }
  262. }
  263. else
  264. {
  265. pCredit->flYPos -= gpGlobals->frametime * ( (float)g_iCreditsPixelHeight / m_flScrollTime );
  266. }
  267. if ( pCredit->bActive == false )
  268. continue;
  269. surface()->DrawSetTextFont( m_hTFont );
  270. surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], cColor[3] );
  271. wchar_t unicode[256];
  272. if ( pCredit->szCreditName[0] == '#' )
  273. {
  274. g_pVGuiLocalize->ConstructString( unicode, sizeof(unicode), g_pVGuiLocalize->Find(pCredit->szCreditName), 0 );
  275. }
  276. else
  277. {
  278. g_pVGuiLocalize->ConvertANSIToUnicode( pCredit->szCreditName, unicode, sizeof( unicode ) );
  279. }
  280. int iStringWidth = GetStringPixelWidth( unicode, m_hTFont );
  281. surface()->DrawSetTextPos( ( iWidth / 2 ) - ( iStringWidth / 2 ), pCredit->flYPos );
  282. surface()->DrawUnicodeString( unicode );
  283. }
  284. }
  285. void CHudCredits::DrawLogo( void )
  286. {
  287. if( m_iLogoState == LOGO_FADEOFF )
  288. {
  289. SetActive( false );
  290. return;
  291. }
  292. switch( m_iLogoState )
  293. {
  294. case LOGO_FADEIN:
  295. {
  296. float flDeltaTime = ( m_flFadeTime - gpGlobals->curtime );
  297. m_Alpha = MAX( 0, RemapValClamped( flDeltaTime, 5.0f, 0, -128, 255 ) );
  298. if ( flDeltaTime <= 0.0f )
  299. {
  300. m_iLogoState = LOGO_FADEHOLD;
  301. m_flFadeTime = gpGlobals->curtime + m_flLogoDesiredLength;
  302. }
  303. break;
  304. }
  305. case LOGO_FADEHOLD:
  306. {
  307. if ( m_flFadeTime <= gpGlobals->curtime )
  308. {
  309. m_iLogoState = LOGO_FADEOUT;
  310. m_flFadeTime = gpGlobals->curtime + 2.0f;
  311. }
  312. break;
  313. }
  314. case LOGO_FADEOUT:
  315. {
  316. float flDeltaTime = ( m_flFadeTime - gpGlobals->curtime );
  317. m_Alpha = RemapValClamped( flDeltaTime, 0.0f, 2.0f, 0, 255 );
  318. if ( flDeltaTime <= 0.0f )
  319. {
  320. m_iLogoState = LOGO_FADEOFF;
  321. SetActive( false );
  322. }
  323. break;
  324. }
  325. }
  326. // fill the screen
  327. int iWidth, iTall;
  328. GetHudSize(iWidth, iTall);
  329. SetSize( iWidth, iTall );
  330. char szLogoFont[64];
  331. if ( IsXbox() )
  332. {
  333. Q_snprintf( szLogoFont, sizeof( szLogoFont ), "WeaponIcons_Small" );
  334. }
  335. else if ( hl2_episodic.GetBool() )
  336. {
  337. Q_snprintf( szLogoFont, sizeof( szLogoFont ), "ClientTitleFont" );
  338. }
  339. else
  340. {
  341. Q_snprintf( szLogoFont, sizeof( szLogoFont ), "WeaponIcons" );
  342. }
  343. vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
  344. vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( szLogoFont );
  345. int iFontTall = surface()->GetFontTall ( m_hTFont );
  346. Color cColor = m_TextColor;
  347. cColor[3] = m_Alpha;
  348. surface()->DrawSetTextFont( m_hTFont );
  349. surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], cColor[3] );
  350. wchar_t unicode[256];
  351. g_pVGuiLocalize->ConvertANSIToUnicode( m_szLogo, unicode, sizeof( unicode ) );
  352. int iStringWidth = GetStringPixelWidth( unicode, m_hTFont );
  353. surface()->DrawSetTextPos( ( iWidth / 2 ) - ( iStringWidth / 2 ), ( iTall / 2 ) - ( iFontTall / 2 ) );
  354. surface()->DrawUnicodeString( unicode );
  355. if ( Q_strlen( m_szLogo2 ) > 0 )
  356. {
  357. g_pVGuiLocalize->ConvertANSIToUnicode( m_szLogo2, unicode, sizeof( unicode ) );
  358. iStringWidth = GetStringPixelWidth( unicode, m_hTFont );
  359. surface()->DrawSetTextPos( ( iWidth / 2 ) - ( iStringWidth / 2 ), ( iTall / 2 ) + ( iFontTall / 2 ));
  360. surface()->DrawUnicodeString( unicode );
  361. }
  362. }
  363. //-----------------------------------------------------------------------------
  364. // Purpose:
  365. //-----------------------------------------------------------------------------
  366. float CHudCredits::FadeBlend( float fadein, float fadeout, float hold, float localTime )
  367. {
  368. float fadeTime = fadein + hold;
  369. float fadeBlend;
  370. if ( localTime < 0 )
  371. return 0;
  372. if ( localTime < fadein )
  373. {
  374. fadeBlend = 1 - ((fadein - localTime) / fadein);
  375. }
  376. else if ( localTime > fadeTime )
  377. {
  378. if ( fadeout > 0 )
  379. fadeBlend = 1 - ((localTime - fadeTime) / fadeout);
  380. else
  381. fadeBlend = 0;
  382. }
  383. else
  384. fadeBlend = 1;
  385. if ( fadeBlend < 0 )
  386. fadeBlend = 0;
  387. return fadeBlend;
  388. }
  389. void CHudCredits::DrawIntroCreditsName( void )
  390. {
  391. if ( m_CreditsList.Count() == 0 )
  392. return;
  393. // fill the screen
  394. int iWidth, iTall;
  395. GetHudSize(iWidth, iTall);
  396. SetSize( iWidth, iTall );
  397. for ( int i = 0; i < m_CreditsList.Count(); i++ )
  398. {
  399. creditname_t *pCredit = &m_CreditsList[i];
  400. if ( pCredit == NULL )
  401. continue;
  402. if ( pCredit->bActive == false )
  403. continue;
  404. vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
  405. vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
  406. float localTime = gpGlobals->curtime - pCredit->flTimeStart;
  407. surface()->DrawSetTextFont( m_hTFont );
  408. surface()->DrawSetTextColor( m_cColor[0], m_cColor[1], m_cColor[2], FadeBlend( m_flFadeInTime, m_flFadeOutTime, m_flFadeHoldTime + pCredit->flTimeAdd, localTime ) * m_cColor[3] );
  409. wchar_t unicode[256];
  410. g_pVGuiLocalize->ConvertANSIToUnicode( pCredit->szCreditName, unicode, sizeof( unicode ) );
  411. surface()->DrawSetTextPos( XRES( pCredit->flXPos ), YRES( pCredit->flYPos ) );
  412. surface()->DrawUnicodeString( unicode );
  413. if ( m_flLogoTime > gpGlobals->curtime )
  414. continue;
  415. if ( pCredit->flTime - m_flNextStartTime <= gpGlobals->curtime )
  416. {
  417. if ( m_CreditsList.IsValidIndex( i + 3 ) )
  418. {
  419. creditname_t *pNextCredits = &m_CreditsList[i + 3];
  420. if ( pNextCredits && pNextCredits->flTime == 0.0f )
  421. {
  422. pNextCredits->bActive = true;
  423. if ( i < 3 )
  424. {
  425. pNextCredits->flTimeAdd = ( i + 1.0f );
  426. pNextCredits->flTime = gpGlobals->curtime + m_flFadeInTime + m_flFadeOutTime + m_flFadeHoldTime + pNextCredits->flTimeAdd;
  427. }
  428. else
  429. {
  430. pNextCredits->flTimeAdd = m_flPauseBetweenWaves;
  431. pNextCredits->flTime = gpGlobals->curtime + m_flFadeInTime + m_flFadeOutTime + m_flFadeHoldTime + pNextCredits->flTimeAdd;
  432. }
  433. pNextCredits->flTimeStart = gpGlobals->curtime;
  434. pNextCredits->iSlot = pCredit->iSlot;
  435. }
  436. }
  437. }
  438. if ( pCredit->flTime <= gpGlobals->curtime )
  439. {
  440. pCredit->bActive = false;
  441. if ( i == m_CreditsList.Count()-1 )
  442. {
  443. Clear();
  444. }
  445. }
  446. }
  447. }
  448. void CHudCredits::ApplySchemeSettings( IScheme *pScheme )
  449. {
  450. BaseClass::ApplySchemeSettings( pScheme );
  451. SetVisible( ShouldDraw() );
  452. SetBgColor( Color(0, 0, 0, 0) );
  453. }
  454. void CHudCredits::Paint()
  455. {
  456. if ( m_iCreditsType == CREDITS_LOGO )
  457. {
  458. DrawLogo();
  459. }
  460. else if ( m_iCreditsType == CREDITS_INTRO )
  461. {
  462. DrawIntroCreditsName();
  463. }
  464. else if ( m_iCreditsType == CREDITS_OUTRO )
  465. {
  466. DrawOutroCreditsName();
  467. }
  468. }
  469. void CHudCredits::PrepareLogo( float flTime )
  470. {
  471. // Only showing the logo. Just load the CreditsParams section.
  472. PrepareCredits( NULL );
  473. m_Alpha = 0;
  474. m_flLogoDesiredLength = flTime;
  475. m_flFadeTime = gpGlobals->curtime + 5.0f;
  476. m_iLogoState = LOGO_FADEIN;
  477. SetActive( true );
  478. }
  479. void CHudCredits::PrepareLine( vgui::HFont hFont, char const *pchLine )
  480. {
  481. Assert( pchLine );
  482. wchar_t unicode[256];
  483. if ( pchLine[0] == '#' )
  484. {
  485. g_pVGuiLocalize->ConstructString( unicode, sizeof(unicode), g_pVGuiLocalize->Find(pchLine), 0 );
  486. }
  487. else
  488. {
  489. g_pVGuiLocalize->ConvertANSIToUnicode( pchLine, unicode, sizeof( unicode ) );
  490. }
  491. surface()->PrecacheFontCharacters( hFont, unicode );
  492. }
  493. void CHudCredits::PrepareOutroCredits( void )
  494. {
  495. PrepareCredits( "OutroCreditsNames" );
  496. if ( m_CreditsList.Count() == 0 )
  497. return;
  498. // fill the screen
  499. int iWidth, iTall;
  500. GetHudSize(iWidth, iTall);
  501. SetSize( iWidth, iTall );
  502. int iHeight = iTall;
  503. for ( int i = 0; i < m_CreditsList.Count(); i++ )
  504. {
  505. creditname_t *pCredit = &m_CreditsList[i];
  506. if ( pCredit == NULL )
  507. continue;
  508. vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
  509. vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName, true );
  510. pCredit->flYPos = iHeight;
  511. pCredit->bActive = false;
  512. iHeight += surface()->GetFontTall ( m_hTFont ) + m_flSeparation;
  513. PrepareLine( m_hTFont, pCredit->szCreditName );
  514. }
  515. SetActive( true );
  516. g_iCreditsPixelHeight = iHeight;
  517. }
  518. void CHudCredits::PrepareIntroCredits( void )
  519. {
  520. PrepareCredits( "IntroCreditsNames" );
  521. int iSlot = 0;
  522. for ( int i = 0; i < m_CreditsList.Count(); i++ )
  523. {
  524. creditname_t *pCredit = &m_CreditsList[i];
  525. if ( pCredit == NULL )
  526. continue;
  527. vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
  528. vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
  529. pCredit->flYPos = m_flY + ( iSlot * surface()->GetFontTall ( m_hTFont ) );
  530. pCredit->flXPos = m_flX;
  531. if ( i < 3 )
  532. {
  533. pCredit->bActive = true;
  534. pCredit->iSlot = iSlot;
  535. pCredit->flTime = gpGlobals->curtime + m_flFadeInTime + m_flFadeOutTime + m_flFadeHoldTime;
  536. pCredit->flTimeStart = gpGlobals->curtime;
  537. m_flLogoTime = pCredit->flTime + m_flLogoTimeMod;
  538. }
  539. else
  540. {
  541. pCredit->bActive = false;
  542. pCredit->flTime = 0.0f;
  543. }
  544. iSlot = ( iSlot + 1 ) % 3;
  545. PrepareLine( m_hTFont, pCredit->szCreditName );
  546. }
  547. SetActive( true );
  548. }
  549. void CHudCredits::MsgFunc_CreditsMsg( bf_read &msg )
  550. {
  551. m_iCreditsType = msg.ReadByte();
  552. switch ( m_iCreditsType )
  553. {
  554. case CREDITS_LOGO:
  555. {
  556. PrepareLogo( 5.0f );
  557. break;
  558. }
  559. case CREDITS_INTRO:
  560. {
  561. PrepareIntroCredits();
  562. break;
  563. }
  564. case CREDITS_OUTRO:
  565. {
  566. PrepareOutroCredits();
  567. break;
  568. }
  569. }
  570. }
  571. void CHudCredits::MsgFunc_LogoTimeMsg( bf_read &msg )
  572. {
  573. m_iCreditsType = CREDITS_LOGO;
  574. PrepareLogo( msg.ReadFloat() );
  575. }