diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/shared/point_bonusmaps_accessor.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/shared/point_bonusmaps_accessor.cpp')
| -rw-r--r-- | mp/src/game/shared/point_bonusmaps_accessor.cpp | 294 |
1 files changed, 147 insertions, 147 deletions
diff --git a/mp/src/game/shared/point_bonusmaps_accessor.cpp b/mp/src/game/shared/point_bonusmaps_accessor.cpp index c857fbe9..56a650fd 100644 --- a/mp/src/game/shared/point_bonusmaps_accessor.cpp +++ b/mp/src/game/shared/point_bonusmaps_accessor.cpp @@ -1,147 +1,147 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-
-#include "cbase.h"
-
-#include "GameUI/IGameUI.h"
-#include "fmtstr.h"
-#include "igameevents.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-// See interface.h/.cpp for specifics: basically this ensures that we actually Sys_UnloadModule the dll and that we don't call Sys_LoadModule
-// over and over again.
-static CDllDemandLoader g_GameUI( "GameUI" );
-
-#ifndef CLIENT_DLL
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-class CPointBonusMapsAccessor : public CPointEntity
-{
-public:
- DECLARE_CLASS( CPointBonusMapsAccessor, CPointEntity );
- DECLARE_DATADESC();
-
- virtual void Activate( void );
-
- void InputUnlock( inputdata_t& inputdata );
- void InputComplete( inputdata_t& inputdata );
- void InputSave( inputdata_t& inputdata );
-
-private:
- string_t m_String_tFileName;
- string_t m_String_tMapName;
- IGameUI *m_pGameUI;
-};
-
-BEGIN_DATADESC( CPointBonusMapsAccessor )
- DEFINE_KEYFIELD( m_String_tFileName, FIELD_STRING, "filename" ),
- DEFINE_KEYFIELD( m_String_tMapName, FIELD_STRING, "mapname" ),
-
- DEFINE_INPUTFUNC( FIELD_VOID, "Unlock", InputUnlock ),
- DEFINE_INPUTFUNC( FIELD_VOID, "Complete", InputComplete ),
- DEFINE_INPUTFUNC( FIELD_VOID, "Save", InputSave ),
-END_DATADESC()
-
-LINK_ENTITY_TO_CLASS( point_bonusmaps_accessor, CPointBonusMapsAccessor );
-
-void CPointBonusMapsAccessor::Activate( void )
-{
- BaseClass::Activate();
-
- CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
- if ( gameUIFactory )
- {
- m_pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
- }
-}
-
-void CPointBonusMapsAccessor::InputUnlock( inputdata_t& inputdata )
-{
- if ( m_pGameUI )
- m_pGameUI->BonusMapUnlock( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() );
-}
-
-void CPointBonusMapsAccessor::InputComplete( inputdata_t& inputdata )
-{
- if ( m_pGameUI )
- {
- m_pGameUI->BonusMapComplete( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() );
-
- int iNumAdvancedComplete = m_pGameUI->BonusMapNumAdvancedCompleted();
-
- IGameEvent *event = gameeventmanager->CreateEvent( "advanced_map_complete" );
- if ( event )
- {
- event->SetInt( "numadvanced", iNumAdvancedComplete );
- gameeventmanager->FireEvent( event );
- }
- }
-}
-
-void CPointBonusMapsAccessor::InputSave( inputdata_t& inputdata )
-{
- if ( m_pGameUI )
- m_pGameUI->BonusMapDatabaseSave();
-}
-
-#endif
-
-void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest )
-{
- CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
- if ( gameUIFactory )
- {
- IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
- if ( pGameUI )
- {
- pGameUI->BonusMapChallengeUpdate( pchFileName, pchMapName, pchChallengeName, iBest );
-
- int piNumMedals[ 3 ];
- pGameUI->BonusMapNumMedals( piNumMedals );
-
- IGameEvent *event = gameeventmanager->CreateEvent( "challenge_map_complete" );
- if ( event )
- {
- event->SetInt( "numbronze", piNumMedals[ 0 ] );
- event->SetInt( "numsilver", piNumMedals[ 1 ] );
- event->SetInt( "numgold", piNumMedals[ 2 ] );
- gameeventmanager->FireEvent( event );
- }
- }
- }
-}
-
-void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName )
-{
- CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
- if ( gameUIFactory )
- {
- IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
- if ( pGameUI )
- {
- pGameUI->BonusMapChallengeNames( pchFileName, pchMapName, pchChallengeName );
- }
- }
-}
-
-void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold )
-{
- CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory();
- if ( gameUIFactory )
- {
- IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL );
- if ( pGameUI )
- {
- pGameUI->BonusMapChallengeObjectives( iBronze, iSilver, iGold );
- }
- }
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#include "cbase.h" + +#include "GameUI/IGameUI.h" +#include "fmtstr.h" +#include "igameevents.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +// See interface.h/.cpp for specifics: basically this ensures that we actually Sys_UnloadModule the dll and that we don't call Sys_LoadModule +// over and over again. +static CDllDemandLoader g_GameUI( "GameUI" ); + +#ifndef CLIENT_DLL + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CPointBonusMapsAccessor : public CPointEntity +{ +public: + DECLARE_CLASS( CPointBonusMapsAccessor, CPointEntity ); + DECLARE_DATADESC(); + + virtual void Activate( void ); + + void InputUnlock( inputdata_t& inputdata ); + void InputComplete( inputdata_t& inputdata ); + void InputSave( inputdata_t& inputdata ); + +private: + string_t m_String_tFileName; + string_t m_String_tMapName; + IGameUI *m_pGameUI; +}; + +BEGIN_DATADESC( CPointBonusMapsAccessor ) + DEFINE_KEYFIELD( m_String_tFileName, FIELD_STRING, "filename" ), + DEFINE_KEYFIELD( m_String_tMapName, FIELD_STRING, "mapname" ), + + DEFINE_INPUTFUNC( FIELD_VOID, "Unlock", InputUnlock ), + DEFINE_INPUTFUNC( FIELD_VOID, "Complete", InputComplete ), + DEFINE_INPUTFUNC( FIELD_VOID, "Save", InputSave ), +END_DATADESC() + +LINK_ENTITY_TO_CLASS( point_bonusmaps_accessor, CPointBonusMapsAccessor ); + +void CPointBonusMapsAccessor::Activate( void ) +{ + BaseClass::Activate(); + + CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory(); + if ( gameUIFactory ) + { + m_pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL ); + } +} + +void CPointBonusMapsAccessor::InputUnlock( inputdata_t& inputdata ) +{ + if ( m_pGameUI ) + m_pGameUI->BonusMapUnlock( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() ); +} + +void CPointBonusMapsAccessor::InputComplete( inputdata_t& inputdata ) +{ + if ( m_pGameUI ) + { + m_pGameUI->BonusMapComplete( m_String_tFileName.ToCStr(), m_String_tMapName.ToCStr() ); + + int iNumAdvancedComplete = m_pGameUI->BonusMapNumAdvancedCompleted(); + + IGameEvent *event = gameeventmanager->CreateEvent( "advanced_map_complete" ); + if ( event ) + { + event->SetInt( "numadvanced", iNumAdvancedComplete ); + gameeventmanager->FireEvent( event ); + } + } +} + +void CPointBonusMapsAccessor::InputSave( inputdata_t& inputdata ) +{ + if ( m_pGameUI ) + m_pGameUI->BonusMapDatabaseSave(); +} + +#endif + +void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) +{ + CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory(); + if ( gameUIFactory ) + { + IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL ); + if ( pGameUI ) + { + pGameUI->BonusMapChallengeUpdate( pchFileName, pchMapName, pchChallengeName, iBest ); + + int piNumMedals[ 3 ]; + pGameUI->BonusMapNumMedals( piNumMedals ); + + IGameEvent *event = gameeventmanager->CreateEvent( "challenge_map_complete" ); + if ( event ) + { + event->SetInt( "numbronze", piNumMedals[ 0 ] ); + event->SetInt( "numsilver", piNumMedals[ 1 ] ); + event->SetInt( "numgold", piNumMedals[ 2 ] ); + gameeventmanager->FireEvent( event ); + } + } + } +} + +void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) +{ + CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory(); + if ( gameUIFactory ) + { + IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL ); + if ( pGameUI ) + { + pGameUI->BonusMapChallengeNames( pchFileName, pchMapName, pchChallengeName ); + } + } +} + +void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) +{ + CreateInterfaceFn gameUIFactory = g_GameUI.GetFactory(); + if ( gameUIFactory ) + { + IGameUI *pGameUI = (IGameUI *) gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL ); + if ( pGameUI ) + { + pGameUI->BonusMapChallengeObjectives( iBronze, iSilver, iGold ); + } + } +} |