mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-01-08 10:13:28 +08:00
Added IServerGameClients::DispatchClientMessage + client message protos, generated code, and helpers.
This commit is contained in:
parent
5da322ccfa
commit
12a2c648b6
@ -691,6 +691,10 @@ public:
|
||||
|
||||
// The client has submitted a keyvalues command
|
||||
virtual void ClientCommandKeyValues( edict_t *pEntity, KeyValues *pKeyValues ) = 0;
|
||||
|
||||
virtual void UnknownFunc1() = 0;
|
||||
|
||||
virtual bool DispatchClientMessage( edict_t *pEntity, int msg_type, int size, uint8_t *pData ) = 0;
|
||||
};
|
||||
|
||||
#define INTERFACEVERSION_UPLOADGAMESTATS "ServerUploadGameStats001"
|
||||
|
@ -0,0 +1,68 @@
|
||||
|
||||
#include "dota_clientmessage_helpers.h"
|
||||
|
||||
CDotaClientMessageHelpers g_DotaClientMessageHelpers;
|
||||
|
||||
#define SETUP_DOTA_MESSAGE( msgname ) \
|
||||
m_NameIndexMap.Insert( #msgname, DOTA_CM_##msgname ); \
|
||||
m_IndexNameMap[DOTA_CM_##msgname] = #msgname; \
|
||||
m_Prototypes[DOTA_CM_##msgname] = &CDOTAClientMsg_##msgname::default_instance();
|
||||
|
||||
CDotaClientMessageHelpers::CDotaClientMessageHelpers()
|
||||
{
|
||||
// Clear all so that any unused are inited.
|
||||
memset( m_Prototypes, 0, sizeof(m_Prototypes) );
|
||||
memset( m_IndexNameMap, 0, sizeof(m_IndexNameMap) );
|
||||
|
||||
SETUP_DOTA_MESSAGE( MapLine );
|
||||
SETUP_DOTA_MESSAGE( AspectRatio );
|
||||
SETUP_DOTA_MESSAGE( MapPing );
|
||||
SETUP_DOTA_MESSAGE( UnitsAutoAttack );
|
||||
SETUP_DOTA_MESSAGE( AutoPurchaseItems );
|
||||
SETUP_DOTA_MESSAGE( TestItems );
|
||||
SETUP_DOTA_MESSAGE( SearchString );
|
||||
SETUP_DOTA_MESSAGE( Pause );
|
||||
SETUP_DOTA_MESSAGE( ShopViewMode );
|
||||
SETUP_DOTA_MESSAGE( SetUnitShareFlag );
|
||||
SETUP_DOTA_MESSAGE( SwapRequest );
|
||||
SETUP_DOTA_MESSAGE( SwapAccept );
|
||||
SETUP_DOTA_MESSAGE( WorldLine );
|
||||
SETUP_DOTA_MESSAGE( RequestGraphUpdate );
|
||||
SETUP_DOTA_MESSAGE( ItemAlert );
|
||||
SETUP_DOTA_MESSAGE( ChatWheel );
|
||||
}
|
||||
|
||||
const google::protobuf::Message *CDotaClientMessageHelpers::GetPrototype( int index ) const
|
||||
{
|
||||
if( index >= 0 && index < EDotaClientMessages_ARRAYSIZE )
|
||||
return m_Prototypes[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const google::protobuf::Message *CDotaClientMessageHelpers::GetPrototype( const char *name ) const
|
||||
{
|
||||
int index = GetIndex( name );
|
||||
if( index > -1 )
|
||||
return m_Prototypes[ index ];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CDotaClientMessageHelpers::GetIndex( const char *name ) const
|
||||
{
|
||||
int idx = m_NameIndexMap.Find( name );
|
||||
if( idx != m_NameIndexMap.InvalidHandle() )
|
||||
return m_NameIndexMap[idx];
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *CDotaClientMessageHelpers::GetName( int index ) const
|
||||
{
|
||||
if( index >= 0 && index < EDotaClientMessages_ARRAYSIZE )
|
||||
return m_IndexNameMap[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
#ifndef DOTA_CM_HELPERS
|
||||
#define DOTA_CM_HELPERS
|
||||
|
||||
#include <game/shared/dota/protobuf/dota_clientmessages.pb.h>
|
||||
#include <tier1/utlhashdict.h>
|
||||
|
||||
class CDotaClientMessageHelpers
|
||||
{
|
||||
public:
|
||||
CDotaClientMessageHelpers();
|
||||
|
||||
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[EDotaClientMessages_ARRAYSIZE];
|
||||
const google::protobuf::Message *m_Prototypes[EDotaClientMessages_ARRAYSIZE];
|
||||
};
|
||||
|
||||
extern CDotaClientMessageHelpers g_DotaClientMessageHelpers;
|
||||
|
||||
#endif // DOTA_CM_HELPERS
|
3862
public/game/shared/dota/protobuf/dota_clientmessages.pb.cc
Normal file
3862
public/game/shared/dota/protobuf/dota_clientmessages.pb.cc
Normal file
File diff suppressed because it is too large
Load Diff
1948
public/game/shared/dota/protobuf/dota_clientmessages.pb.h
Normal file
1948
public/game/shared/dota/protobuf/dota_clientmessages.pb.h
Normal file
File diff suppressed because it is too large
Load Diff
172
public/game/shared/dota/protobuf/dota_clientmessages.proto
Normal file
172
public/game/shared/dota/protobuf/dota_clientmessages.proto
Normal file
@ -0,0 +1,172 @@
|
||||
//====== Copyright (c) 2012, Valve Corporation, All rights reserved. ========//
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
// THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//===========================================================================//
|
||||
//
|
||||
// Purpose: The file defines our Google Protocol Buffers which are used in over
|
||||
// the wire messages for the Source engine.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
// We care more about speed than code size
|
||||
option optimize_for = SPEED;
|
||||
|
||||
// We don't use the service generation functionality
|
||||
option cc_generic_services = false;
|
||||
|
||||
|
||||
//
|
||||
// STYLE NOTES:
|
||||
//
|
||||
// Use CamelCase CMsgMyMessageName style names for messages.
|
||||
//
|
||||
// Use lowercase _ delimited names like my_steam_id for field names, this is non-standard for Steam,
|
||||
// but plays nice with the Google formatted code generation.
|
||||
//
|
||||
// Try not to use required fields ever. Only do so if you are really really sure you'll never want them removed.
|
||||
// Optional should be preffered as it will make versioning easier and cleaner in the future if someone refactors
|
||||
// your message and wants to remove or rename fields.
|
||||
//
|
||||
// Use fixed64 for JobId_t, GID_t, or SteamID. This is appropriate for any field that is normally
|
||||
// going to be larger than 2^56. Otherwise use int64 for 64 bit values that are frequently smaller
|
||||
// than 2^56 as it will safe space on the wire in those cases.
|
||||
//
|
||||
// Similar to fixed64, use fixed32 for RTime32 or other 32 bit values that are frequently larger than
|
||||
// 2^28. It will safe space in those cases, otherwise use int32 which will safe space for smaller values.
|
||||
// An exception to this rule for RTime32 is if the value will frequently be zero rather than set to an actual
|
||||
// time.
|
||||
//
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
// for CMsgVector, etc.
|
||||
import "netmessages.proto";
|
||||
|
||||
// for structures shared between user and client messages
|
||||
import "dota_commonmessages.proto";
|
||||
|
||||
//=============================================================================
|
||||
// Dota Client Messages
|
||||
//=============================================================================
|
||||
|
||||
enum EDotaClientMessages
|
||||
{
|
||||
DOTA_CM_MapLine = 1;
|
||||
DOTA_CM_AspectRatio = 2;
|
||||
DOTA_CM_MapPing = 3;
|
||||
DOTA_CM_UnitsAutoAttack = 4;
|
||||
DOTA_CM_AutoPurchaseItems = 5;
|
||||
DOTA_CM_TestItems = 6;
|
||||
DOTA_CM_SearchString = 7;
|
||||
DOTA_CM_Pause = 8;
|
||||
DOTA_CM_ShopViewMode = 9;
|
||||
DOTA_CM_SetUnitShareFlag = 10;
|
||||
DOTA_CM_SwapRequest = 11;
|
||||
DOTA_CM_SwapAccept = 12;
|
||||
DOTA_CM_WorldLine = 13;
|
||||
DOTA_CM_RequestGraphUpdate = 14;
|
||||
DOTA_CM_ItemAlert = 15;
|
||||
DOTA_CM_ChatWheel = 16;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
message CDOTAClientMsg_MapPing
|
||||
{
|
||||
optional CDOTAMsg_LocationPing location_ping = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_ItemAlert
|
||||
{
|
||||
optional CDOTAMsg_ItemAlert item_alert = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_MapLine
|
||||
{
|
||||
optional CDOTAMsg_MapLine mapline = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_AspectRatio
|
||||
{
|
||||
optional float ratio = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_UnitsAutoAttack
|
||||
{
|
||||
optional bool enabled = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_AutoPurchaseItems
|
||||
{
|
||||
optional bool enabled = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_TestItems
|
||||
{
|
||||
optional string key_values = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_SearchString
|
||||
{
|
||||
optional string search = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_Pause
|
||||
{
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_ShopViewMode
|
||||
{
|
||||
optional uint32 mode = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_SetUnitShareFlag
|
||||
{
|
||||
optional uint32 playerID = 1;
|
||||
optional uint32 flag = 2;
|
||||
optional bool state = 3;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_SwapRequest
|
||||
{
|
||||
optional uint32 player_id = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_SwapAccept
|
||||
{
|
||||
optional uint32 player_id = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_WorldLine
|
||||
{
|
||||
optional CDOTAMsg_WorldLine worldline = 1;
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_RequestGraphUpdate
|
||||
{
|
||||
}
|
||||
|
||||
message CDOTAClientMsg_ChatWheel
|
||||
{
|
||||
optional EDOTAChatWheelMessage chat_message = 1 [default = k_EDOTA_CW_Ok];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user