added keybind
This commit is contained in:
@@ -185,9 +185,6 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
||||
{
|
||||
case MESSAGE_ENTITY_CLASS_SYNC:
|
||||
|
||||
V_printf("MESSAGE_ENTITY_CLASS_SYNC: %u = %s\n",
|
||||
(uint32_t)pPlayerPacket->m_entityClass.m_uIndex,
|
||||
pPlayerPacket->m_entityClass.m_szEntityName);
|
||||
pEntity = CreateByClassnameWithIndex(
|
||||
(char*)pPlayerPacket->m_entityClass.m_szEntityName,
|
||||
pPlayerPacket->m_entityClass.m_uIndex
|
||||
@@ -226,7 +223,6 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
||||
}
|
||||
break;
|
||||
case k_EMessage_PlayerSetLocalEntity:
|
||||
V_printf("k_EMessage_PlayerSetLocalEntity: %u\n",(uint32_t)pPlayerPacket->m_setLocalEntity.m_uIndex);
|
||||
if (pPlayerPacket->m_setLocalEntity.m_uIndex > MAX_EDICTS)
|
||||
break;
|
||||
s_pLocalEntity = m_pEntities[pPlayerPacket->m_setLocalEntity.m_uIndex];
|
||||
@@ -235,9 +231,74 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
||||
}
|
||||
}
|
||||
|
||||
void CEntitySystem::NetSendThink()
|
||||
void CEntitySystem::NetSendThink( INetworkBase *pBase )
|
||||
{
|
||||
C_BaseEntity *pEntity;
|
||||
int i;
|
||||
uint32_t u;
|
||||
uint32_t x;
|
||||
uint32_t uSize;
|
||||
netmap_t *pNetMap;
|
||||
void *pData;
|
||||
union {
|
||||
void *pCurrentData;
|
||||
char *pcCurrentData;
|
||||
EntityDataSync_t *pSync;
|
||||
EntityDataSyncValue_t *pValue;
|
||||
};
|
||||
pEntity = UTIL_GetLocalPlayer();
|
||||
if ( pEntity == NULL )
|
||||
return;
|
||||
|
||||
pNetMap = pEntity->GetSendMap();
|
||||
uSize = sizeof(EntityDataSyncValue_t);
|
||||
x = 0;
|
||||
while ( pNetMap )
|
||||
{
|
||||
for ( u = 0; u < pNetMap->m_uFieldCount; u++ )
|
||||
{
|
||||
x++;
|
||||
uSize += (pNetMap->m_pFields[u].m_uSize+7) & ~7;
|
||||
uSize += sizeof(EntityDataSyncValue_t);
|
||||
}
|
||||
pNetMap = pNetMap->m_pBase;
|
||||
}
|
||||
pData = V_malloc(uSize);
|
||||
V_memset(pData, 0, uSize);
|
||||
pCurrentData = pData;
|
||||
pSync->m_eType = MESSAGE_ENTITY_DATA_SYNC;
|
||||
|
||||
for ( i = 0; i < MAX_EDICTS; i++ )
|
||||
{
|
||||
if ( m_pEntities[i] != pEntity )
|
||||
continue;
|
||||
pSync->m_uIndex = i;
|
||||
break;
|
||||
}
|
||||
pSync->m_uCount = x;
|
||||
|
||||
pcCurrentData += sizeof(EntityDataSync_t);
|
||||
pNetMap = pEntity->GetSendMap();
|
||||
x = 0;
|
||||
while ( pNetMap )
|
||||
{
|
||||
for ( u = 0; u < pNetMap->m_uFieldCount; u++ )
|
||||
{
|
||||
pValue->m_uVariableSize = pNetMap->m_pFields[u].m_uSize;
|
||||
pValue->m_uVariableIndex = x;
|
||||
uint32_t uVariableSize;
|
||||
pcCurrentData += sizeof(EntityDataSyncValue_t);
|
||||
V_memcpy(pcCurrentData,
|
||||
pNetMap->m_pFields[u].m_uOffset+(char*)pEntity,
|
||||
pNetMap->m_pFields[u].m_uSize);
|
||||
pcCurrentData += (pNetMap->m_pFields[u].m_uSize+7) & ~7;
|
||||
x++;
|
||||
}
|
||||
pNetMap = pNetMap->m_pBase;
|
||||
}
|
||||
if (pBase)
|
||||
pBase->SendPacket({pData, uSize});
|
||||
V_free(pData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user