networking fixes
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "netprotocol.h"
|
||||
|
||||
static C_BaseEntity *s_pLocalEntity;
|
||||
|
||||
CEntitySystem *EntitySystem()
|
||||
{
|
||||
@@ -122,6 +123,7 @@ IEntityFactory *CEntitySystem::GetFactoryByClassname( const char *szName )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CEntitySystem::DestroyEntityByIndex( uint32_t uIndex )
|
||||
{
|
||||
if ( uIndex >= MAX_EDICTS )
|
||||
@@ -129,6 +131,8 @@ void CEntitySystem::DestroyEntityByIndex( uint32_t uIndex )
|
||||
if (m_pEntities[uIndex])
|
||||
{
|
||||
V_printf("Deleting: %i\n", uIndex);
|
||||
if (m_pEntities[uIndex] == s_pLocalEntity)
|
||||
s_pLocalEntity = 0;
|
||||
delete m_pEntities[uIndex];
|
||||
m_pEntities[uIndex] = 0;
|
||||
}
|
||||
@@ -174,9 +178,6 @@ searchIndex:
|
||||
return (char*)pEntity+pCurrentMap->m_pFields[uCurrentIndex].m_uOffset;
|
||||
}
|
||||
|
||||
|
||||
static C_BaseEntity *s_pLocalEntity;
|
||||
|
||||
void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
|
||||
{
|
||||
PlayerPacket_t *pPlayerPacket = (PlayerPacket_t*)pPacket->pData;
|
||||
|
||||
@@ -23,7 +23,8 @@ void C_MOBAPlayer::Think( float fDelta )
|
||||
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
|
||||
|
||||
|
||||
m_vMovementVector.x = m_bIsForward - m_bIsBack;
|
||||
m_vMovementVector.z = m_bIsForward - m_bIsBack;
|
||||
m_vMovementVector.x = m_bIsLeft - m_bIsRight;
|
||||
|
||||
if (pEntity == this)
|
||||
{
|
||||
@@ -84,3 +85,44 @@ static void IN_BackUp( int c, char **v ) {
|
||||
((C_MOBAPlayer*)pPlayer)->m_bIsBack = false;
|
||||
}
|
||||
static ConCommand endback("-back", IN_BackUp);
|
||||
|
||||
static void IN_RightDown( int c, char **v ) {
|
||||
C_BaseEntity *pPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pPlayer)
|
||||
return;
|
||||
if (!dynamic_cast<C_MOBAPlayer*>(pPlayer))
|
||||
return;
|
||||
((C_MOBAPlayer*)pPlayer)->m_bIsRight = true;
|
||||
}
|
||||
static ConCommand startright("+right", IN_RightDown);
|
||||
|
||||
static void IN_RightUp( int c, char **v ) {
|
||||
C_BaseEntity *pPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pPlayer)
|
||||
return;
|
||||
if (!dynamic_cast<C_MOBAPlayer*>(pPlayer))
|
||||
return;
|
||||
((C_MOBAPlayer*)pPlayer)->m_bIsRight = false;
|
||||
}
|
||||
static ConCommand endright("-right", IN_RightUp);
|
||||
|
||||
|
||||
static void IN_LeftDown( int c, char **v ) {
|
||||
C_BaseEntity *pPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pPlayer)
|
||||
return;
|
||||
if (!dynamic_cast<C_MOBAPlayer*>(pPlayer))
|
||||
return;
|
||||
((C_MOBAPlayer*)pPlayer)->m_bIsLeft = true;
|
||||
}
|
||||
static ConCommand startleft("+left", IN_LeftDown);
|
||||
|
||||
static void IN_LeftUp( int c, char **v ) {
|
||||
C_BaseEntity *pPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pPlayer)
|
||||
return;
|
||||
if (!dynamic_cast<C_MOBAPlayer*>(pPlayer))
|
||||
return;
|
||||
((C_MOBAPlayer*)pPlayer)->m_bIsLeft = false;
|
||||
}
|
||||
static ConCommand endleft("-left", IN_LeftUp);
|
||||
|
||||
Reference in New Issue
Block a user