networking fixes
This commit is contained in:
@@ -113,7 +113,7 @@ IEntityFactory *CEntitySystem::GetFactoryByClassname( const char *szName )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CEntitySystem::Think()
|
||||
void CEntitySystem::Think( float fDelta )
|
||||
{
|
||||
CBaseEntity *pEntity;
|
||||
int i;
|
||||
@@ -128,7 +128,7 @@ void CEntitySystem::Think()
|
||||
if ( !pEntity->m_pfnThink )
|
||||
continue;
|
||||
|
||||
(pEntity->*pEntity->m_pfnThink)(0);
|
||||
(pEntity->*pEntity->m_pfnThink)(fDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual IEntityFactory *GetFactoryByClassname( const char *szName );
|
||||
|
||||
virtual void Think();
|
||||
virtual void Think( float fDelta );
|
||||
virtual CBaseEntity **GetEntities();
|
||||
|
||||
virtual void NetRecvPacket( NetPacket_t *pPacket );
|
||||
|
||||
@@ -162,12 +162,11 @@ void NET_ProcessPacket( INetworkBase *pBase )
|
||||
if (g_pCurrentConnection)
|
||||
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), 0, PACKET_MUST_ARRIVE});
|
||||
}
|
||||
return;
|
||||
break;
|
||||
case MESSAGE_ENTITY_DATA_SYNC:
|
||||
EntitySystem()->NetRecvPacket(&packet);
|
||||
pBase->RecievePacket();
|
||||
break;
|
||||
default:
|
||||
pBase->RecievePacket();
|
||||
break;
|
||||
}
|
||||
pBase->RecievePacket();
|
||||
@@ -208,7 +207,7 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
if (g_pCurrentConnection)
|
||||
{
|
||||
g_pPhysicsWorld->Frame(fTickRate);
|
||||
EntitySystem()->Think();
|
||||
EntitySystem()->Think(fTickRate);
|
||||
EntitySystem()->NetSendThink(g_pCurrentConnection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
void CMOBAPlayer::Spawn()
|
||||
{
|
||||
CPhysicsProp::Spawn();
|
||||
CBaseEntity::Spawn();
|
||||
SetModel("game/core/models/cube.fmdl");
|
||||
SetScale(1);
|
||||
SetThink(Think);
|
||||
@@ -14,8 +14,14 @@ void CMOBAPlayer::Spawn()
|
||||
|
||||
void CMOBAPlayer::Think( float fDelta )
|
||||
{
|
||||
V_printf("%f %f %f\n", m_vMovementVector.x, m_vMovementVector.y, m_vMovementVector.z);
|
||||
CPhysicsProp::Think(fDelta);
|
||||
Vector vPosition = GetAbsOrigin();
|
||||
// player might lie to us
|
||||
m_vMovementVector.x = glm_clamp(m_vMovementVector.x, -1, 1);
|
||||
m_vMovementVector.y = glm_clamp(m_vMovementVector.y, -1, 1);
|
||||
|
||||
vPosition.x += m_vMovementVector.x*fDelta*5;
|
||||
vPosition.z += m_vMovementVector.z*fDelta*5;
|
||||
SetAbsOrigin(vPosition);
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(player, CMOBAPlayer)
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "physicsprop.h"
|
||||
|
||||
class CMOBAPlayer: public CPhysicsProp
|
||||
class CMOBAPlayer: public CBaseModelEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(CMOBAPlayer, CPhysicsProp);
|
||||
DECLARE_CLASS(CMOBAPlayer, CBaseModelEntity);
|
||||
DECLARE_DATADESC();
|
||||
DECLARE_SERVERCLASS()
|
||||
|
||||
|
||||
0
game/server/worldsystem.cpp
Normal file
0
game/server/worldsystem.cpp
Normal file
0
game/server/worldsystem.h
Normal file
0
game/server/worldsystem.h
Normal file
Reference in New Issue
Block a user