Counter Strike : Global Offensive Source Code
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.

162 lines
4.2 KiB

  1. //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "GameUI/IGameUI.h"
  10. #include "fmtstr.h"
  11. #include "igameevents.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. // See interface.h/.cpp for specifics: basically this ensures that we actually Sys_UnloadModule the dll and that we don't call Sys_LoadModule
  15. // over and over again.
  16. static CDllDemandLoader g_GameUI( "gameui" );
  17. #ifndef CLIENT_DLL
  18. //-----------------------------------------------------------------------------
  19. // Purpose:
  20. //-----------------------------------------------------------------------------
  21. class CPointBonusMapsAccessor : public CPointEntity
  22. {
  23. public:
  24. DECLARE_CLASS( CPointBonusMapsAccessor, CPointEntity );
  25. DECLARE_DATADESC();
  26. virtual void Activate( void );
  27. void InputUnlock( inputdata_t& inputdata );
  28. void InputComplete( inputdata_t& inputdata );
  29. void InputSave( inputdata_t& inputdata );
  30. private:
  31. string_t m_String_tFileName;
  32. string_t m_String_tMapName;
  33. IGameUI *m_pGameUI;
  34. };
  35. BEGIN_DATADESC( CPointBonusMapsAccessor )
  36. DEFINE_KEYFIELD( m_String_tFileName, FIELD_STRING, "filename" ),
  37. DEFINE_KEYFIELD( m_String_tMapName, FIELD_STRING, "mapname" ),
  38. DEFINE_INPUTFUNC( FIELD_VOID, "Unlock", InputUnlock ),
  39. DEFINE_INPUTFUNC( FIELD_VOID, "Complete", InputComplete ),
  40. DEFINE_INPUTFUNC( FIELD_VOID, "Save", InputSave ),
  41. END_DATADESC()
  42. LINK_ENTITY_TO_CLASS( point_bonusmaps_accessor, CPointBonusMapsAccessor );
  43. void CPointBonusMapsAccessor::Activate( void )
  44. {
  45. BaseClass::Activate();
  46. CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
  47. if ( gameUIFactory )
  48. {
  49. m_pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
  50. }
  51. }
  52. void CPointBonusMapsAccessor::InputUnlock( inputdata_t& inputdata )
  53. {
  54. #if 0
  55. if ( m_pGameUI )
  56. {
  57. m_pGameUI->BonusMapUnlock( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() );
  58. }
  59. #endif
  60. }
  61. void CPointBonusMapsAccessor::InputComplete( inputdata_t& inputdata )
  62. {
  63. if ( m_pGameUI )
  64. {
  65. int iNumAdvancedComplete = 0;
  66. #if 0
  67. m_pGameUI->BonusMapComplete( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() );
  68. iNumAdvancedComplete = m_pGameUI->BonusMapNumAdvancedCompleted();
  69. #endif
  70. IGameEvent *event = gameeventmanager->CreateEvent( "advanced_map_complete" );
  71. if ( event )
  72. {
  73. event->SetInt( "numadvanced", iNumAdvancedComplete );
  74. gameeventmanager->FireEvent( event );
  75. }
  76. }
  77. }
  78. void CPointBonusMapsAccessor::InputSave( inputdata_t& inputdata )
  79. {
  80. #if 0
  81. if ( m_pGameUI )
  82. m_pGameUI->BonusMapDatabaseSave();
  83. #endif
  84. }
  85. #endif
  86. void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest )
  87. {
  88. CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
  89. if ( gameUIFactory )
  90. {
  91. IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
  92. if ( pGameUI )
  93. {
  94. int piNumMedals[ 3 ] = {0};
  95. #if 0
  96. pGameUI->BonusMapChallengeUpdate( pchFileName, pchMapName, pchChallengeName, iBest );
  97. pGameUI->BonusMapNumMedals( piNumMedals );
  98. #endif
  99. IGameEvent *event = gameeventmanager->CreateEvent( "challenge_map_complete" );
  100. if ( event )
  101. {
  102. event->SetInt( "numbronze", piNumMedals[ 0 ] );
  103. event->SetInt( "numsilver", piNumMedals[ 1 ] );
  104. event->SetInt( "numgold", piNumMedals[ 2 ] );
  105. gameeventmanager->FireEvent( event );
  106. }
  107. }
  108. }
  109. }
  110. void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName )
  111. {
  112. #if 0
  113. CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
  114. if ( gameUIFactory )
  115. {
  116. IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
  117. if ( pGameUI )
  118. {
  119. pGameUI->BonusMapChallengeNames( pchFileName, pchMapName, pchChallengeName );
  120. }
  121. }
  122. #endif
  123. }
  124. void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold )
  125. {
  126. #if 0
  127. CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
  128. if ( gameUIFactory )
  129. {
  130. IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
  131. if ( pGameUI )
  132. {
  133. pGameUI->BonusMapChallengeObjectives( iBronze, iSilver, iGold );
  134. }
  135. }
  136. #endif
  137. }