mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-12-07 18:48:22 +00:00
Added CS:GO usermessage helper class.
--HG-- branch : protobuf
This commit is contained in:
parent
00a7f11cf5
commit
9b4973eaed
@ -0,0 +1,110 @@
|
||||
|
||||
#include "cstrike15_usermessage_helpers.h"
|
||||
|
||||
CCstrike15UsermessageHelpers g_Cstrike15UsermessageHelpers;
|
||||
|
||||
#define SETUP_MESSAGE( msgname ) \
|
||||
m_NameIndexMap.Insert( #msgname, CS_UM_##msgname ); \
|
||||
m_IndexNameMap[CS_UM_##msgname] = #msgname; \
|
||||
m_Prototypes[CS_UM_##msgname] = &CCSUsrMsg_##msgname::default_instance();
|
||||
|
||||
CCstrike15UsermessageHelpers::CCstrike15UsermessageHelpers()
|
||||
{
|
||||
// Clear all so that any unused are inited.
|
||||
memset( m_Prototypes, NULL, sizeof(m_Prototypes) );
|
||||
memset( m_IndexNameMap, NULL, sizeof(m_IndexNameMap) );
|
||||
|
||||
SETUP_MESSAGE( VGUIMenu );
|
||||
SETUP_MESSAGE( Geiger );
|
||||
SETUP_MESSAGE( Train );
|
||||
SETUP_MESSAGE( HudText );
|
||||
SETUP_MESSAGE( SayText );
|
||||
SETUP_MESSAGE( SayText2 );
|
||||
SETUP_MESSAGE( TextMsg );
|
||||
SETUP_MESSAGE( HudMsg );
|
||||
SETUP_MESSAGE( ResetHud );
|
||||
SETUP_MESSAGE( GameTitle );
|
||||
SETUP_MESSAGE( Shake );
|
||||
SETUP_MESSAGE( Fade );
|
||||
SETUP_MESSAGE( Rumble );
|
||||
SETUP_MESSAGE( CloseCaption );
|
||||
SETUP_MESSAGE( CloseCaptionDirect );
|
||||
SETUP_MESSAGE( SendAudio );
|
||||
SETUP_MESSAGE( RawAudio );
|
||||
SETUP_MESSAGE( VoiceMask );
|
||||
SETUP_MESSAGE( RequestState );
|
||||
SETUP_MESSAGE( Damage );
|
||||
SETUP_MESSAGE( RadioText );
|
||||
SETUP_MESSAGE( HintText );
|
||||
SETUP_MESSAGE( KeyHintText );
|
||||
SETUP_MESSAGE( ProcessSpottedEntityUpdate );
|
||||
SETUP_MESSAGE( ReloadEffect );
|
||||
SETUP_MESSAGE( AdjustMoney );
|
||||
//SETUP_MESSAGE( UpdateTeamMoney );
|
||||
SETUP_MESSAGE( StopSpectatorMode );
|
||||
SETUP_MESSAGE( KillCam );
|
||||
SETUP_MESSAGE( DesiredTimescale );
|
||||
SETUP_MESSAGE( CurrentTimescale );
|
||||
SETUP_MESSAGE( AchievementEvent );
|
||||
SETUP_MESSAGE( MatchEndConditions );
|
||||
SETUP_MESSAGE( DisconnectToLobby );
|
||||
SETUP_MESSAGE( PlayerStatsUpdate );
|
||||
SETUP_MESSAGE( DisplayInventory );
|
||||
SETUP_MESSAGE( WarmupHasEnded );
|
||||
SETUP_MESSAGE( ClientInfo );
|
||||
SETUP_MESSAGE( XRankGet );
|
||||
SETUP_MESSAGE( XRankUpd );
|
||||
SETUP_MESSAGE( SetPlayerEloDisplayBracket );
|
||||
SETUP_MESSAGE( RequestEloBracketInfo );
|
||||
SETUP_MESSAGE( SetEloBracketInfo );
|
||||
SETUP_MESSAGE( CallVoteFailed );
|
||||
SETUP_MESSAGE( VoteStart );
|
||||
SETUP_MESSAGE( VotePass );
|
||||
SETUP_MESSAGE( VoteFailed );
|
||||
SETUP_MESSAGE( VoteSetup );
|
||||
SETUP_MESSAGE( ServerRankRevealAll );
|
||||
SETUP_MESSAGE( SendLastKillerDamageToClient );
|
||||
SETUP_MESSAGE( ServerRankUpdate );
|
||||
SETUP_MESSAGE( ItemPickup );
|
||||
SETUP_MESSAGE( ShowMenu );
|
||||
SETUP_MESSAGE( BarTime );
|
||||
SETUP_MESSAGE( AmmoDenied );
|
||||
SETUP_MESSAGE( MarkAchievement );
|
||||
SETUP_MESSAGE( MatchStatsUpdate );
|
||||
SETUP_MESSAGE( ItemDrop );
|
||||
}
|
||||
|
||||
const google::protobuf::Message *CCstrike15UsermessageHelpers::GetPrototype( int index ) const
|
||||
{
|
||||
if( index >= 0 && index < ECstrike15UserMessages_ARRAYSIZE )
|
||||
return m_Prototypes[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const google::protobuf::Message *CCstrike15UsermessageHelpers::GetPrototype( const char *name ) const
|
||||
{
|
||||
int index = GetIndex( name );
|
||||
if( index > -1 )
|
||||
return m_Prototypes[ index ];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CCstrike15UsermessageHelpers::GetIndex( const char *name ) const
|
||||
{
|
||||
int idx = m_NameIndexMap.Find( name );
|
||||
if( idx != m_NameIndexMap.InvalidHandle() )
|
||||
return m_NameIndexMap[idx];
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *CCstrike15UsermessageHelpers::GetName( int index ) const
|
||||
{
|
||||
if( index >= 0 && index < ECstrike15UserMessages_ARRAYSIZE )
|
||||
return m_IndexNameMap[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
#ifndef CSTRIKE15_UM_HELPERS
|
||||
#define CSTRIKE15_UM_HELPERS
|
||||
|
||||
#include "game/shared/csgo/protobuf/cstrike15_usermessages.pb.h"
|
||||
#include <tier1/utlhashdict.h>
|
||||
|
||||
class CCstrike15UsermessageHelpers
|
||||
{
|
||||
public:
|
||||
CCstrike15UsermessageHelpers();
|
||||
|
||||
const google::protobuf::Message *GetPrototype( int index ) const;
|
||||
const google::protobuf::Message *GetPrototype( const char *name ) const;
|
||||
|
||||
int GetIndex( const char *name ) const;
|
||||
|
||||
const char *GetName( int index ) const;
|
||||
|
||||
private:
|
||||
CUtlHashDict<int, false, false> m_NameIndexMap;
|
||||
const char *m_IndexNameMap[ECstrike15UserMessages_ARRAYSIZE];
|
||||
const google::protobuf::Message *m_Prototypes[ECstrike15UserMessages_ARRAYSIZE];
|
||||
};
|
||||
|
||||
extern CCstrike15UsermessageHelpers g_Cstrike15UsermessageHelpers;
|
||||
|
||||
#endif // CSTRIKE15_UM_HELPERS
|
||||
Loading…
Reference in New Issue
Block a user