some stuff

This commit is contained in:
2026-03-05 21:25:59 +02:00
parent 2da75ebdd8
commit 99f68e655f
41 changed files with 706 additions and 324 deletions

View File

@@ -81,6 +81,8 @@ private:
Vector m_vPosition;
Quat m_vRotation;
Vector m_vScale;
uint64_t m_uSlot;
};
#endif

View File

@@ -15,6 +15,8 @@ DECLARE_BUILD_STAGE(Client)
compileProject.m_szName = "client";
compileProject.files = {
"../shared/game.cpp",
"game.cpp",
"baseentity.cpp",

View File

@@ -10,6 +10,8 @@
#include "string.h"
#include "stdlib.h"
#include "netprotocol.h"
CEntitySystem *EntitySystem()
{
@@ -155,7 +157,96 @@ void CEntitySystem::Think()
}
}
static void *UTIL_GetNetMapData(C_BaseEntity *pEntity, netmap_t *pMap, uint32_t uIndex )
{
netmap_t *pCurrentMap = pMap;
uint32_t uCurrentIndex = uIndex;
searchIndex:
if (uCurrentIndex >= pCurrentMap->m_uFieldCount || pCurrentMap->m_pBase )
{
uCurrentIndex -= pCurrentMap->m_uFieldCount;
pCurrentMap = pCurrentMap->m_pBase;
if (!pCurrentMap)
return NULL;
goto 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;
C_BaseEntity *pEntity;
switch (pPlayerPacket->m_eType)
{
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
);
if (pEntity == NULL)
break;
pEntity->Spawn();
break;
case MESSAGE_ENTITY_DATA_SYNC:
pEntity = m_pEntities[pPlayerPacket->m_entityData.m_uIndex];
if (pEntity == NULL)
break;
union {
void *pData;
char *pcCurrentData;
EntityDataSyncValue_t *pcSyncValue;
};
pData = pPlayerPacket;
pcCurrentData += sizeof(EntityDataSync_t);
// too bad
// this shall be reworked
for ( uint32_t u = 0; u < pPlayerPacket->m_entityData.m_uCount; u++ )
{
uint32_t uVariableSize = pcSyncValue->m_uVariableSize;
void *pValueData = (float*)UTIL_GetNetMapData(
pEntity,
pEntity->GetRecvMap(),
pcSyncValue->m_uVariableIndex);
pcCurrentData += sizeof(EntityDataSyncValue_t);
if (pValueData)
V_memcpy(pValueData, pcCurrentData, uVariableSize);
pcCurrentData += (uVariableSize+7) & ~7;
}
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];
default:
break;
}
}
void CEntitySystem::NetSendThink()
{
}
C_BaseEntity **CEntitySystem::GetEntities()
{
return m_pEntities;
};
C_BaseEntity *UTIL_GetLocalPlayer()
{
return s_pLocalEntity;
}

View File

@@ -8,6 +8,7 @@
#define ENTITIES_H
#include "stdint.h"
#include "networkbase.h"
class IEntityFactory;
class C_BaseEntity;
@@ -29,6 +30,10 @@ public:
virtual void DestroyEntityByPtr( C_BaseEntity *pEntity );
virtual void Think();
virtual void NetRecvPacket( NetPacket_t *pPacket );
virtual void NetSendThink();
virtual C_BaseEntity **GetEntities();
private:
C_BaseEntity *m_pEntities[MAX_EDICTS];
@@ -37,4 +42,6 @@ private:
CEntitySystem *EntitySystem();
C_BaseEntity *UTIL_GetLocalPlayer();
#endif

View File

@@ -15,21 +15,6 @@
#include "steam/steam_gameserver.h"
#endif
IFileSystem *filesystem;
IRenderContext *g_pRenderContext;
IGameWindow *g_pMainWindow;
static CEngineVars s_vars;
CEngineVars *g_pEngineVars = &s_vars;
EngineConsts_t *g_pEngineConstants;
INetworkBase *g_pServerBridge;
INetworkBase *g_pServerConnection;
IPhysics *g_pPhysics;
IPhysicsWorld *g_pPhysicsWorld;
class CFunnyGameBridge: public IEngineBridge
{
virtual void Init() override;
@@ -44,6 +29,35 @@ class CFunnyGameBridge: public IEngineBridge
};
class CFunnyInput: public IHumanDeviceInput
{
virtual EInputType GetInputType() override { return k_EInput_Game; };
virtual void OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override;
virtual void OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override;
virtual void OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override;
virtual void OnButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override {};
virtual void OnAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override {};
virtual void OnAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override {};
virtual void OnTextWriteUTF8( uint32_t uCode ) override {};
};
void CFunnyInput::OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed )
{
}
void CFunnyInput::OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue)
{
}
void CFunnyInput::OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
{
}
IEngineBridge *EngineBridge()
{
static CFunnyGameBridge s_bridge;
@@ -52,6 +66,7 @@ IEngineBridge *EngineBridge()
EXPOSE_INTERFACE_FN(EngineBridge, IEngineBridge, ENGINE_BRIDGE_INTERFACE_VERSION)
static CFunnyInput s_mainInput;
void CFunnyGameBridge::Init()
{
@@ -79,30 +94,14 @@ void CFunnyGameBridge::Init()
CreateInterfaceFn fnPhysicsFactory = Sys_GetFactory("RapierPhysics");
g_pPhysics = (IPhysics*)fnPhysicsFactory(PHYSICS_INTERFACE_VERSION, NULL);
g_pPhysicsWorld = g_pPhysics->CreateWorld();
g_pHumanDeviceManager->SetDefaultInput(&s_mainInput);
}
void CFunnyGameBridge::Tick( float fDelta )
{
}
void *ENT_GetNetMapData(C_BaseEntity *pEntity, netmap_t *pMap, uint32_t uIndex )
{
netmap_t *pCurrentMap = pMap;
uint32_t uCurrentIndex = uIndex;
searchIndex:
if (uCurrentIndex >= pCurrentMap->m_uFieldCount)
{
if (!pCurrentMap->m_uFieldCount)
return NULL;
uCurrentIndex -= pCurrentMap->m_uFieldCount;
pCurrentMap = pCurrentMap->m_pBase;
if (!pCurrentMap)
return NULL;
goto searchIndex;
}
return (char*)pEntity+pCurrentMap->m_pFields[uCurrentIndex].m_uOffset;
}
void CFunnyGameBridge::TryToConnectToServer()
{
@@ -111,27 +110,25 @@ void CFunnyGameBridge::TryToConnectToServer()
{
if (m_bIsConnectedToSteamRelay != 0 )
return;
if ( SteamNetworkingUtils()->GetRelayNetworkStatus(NULL) == k_ESteamNetworkingAvailability_Current)
if ( SteamNetworkingUtils()->GetRelayNetworkStatus(NULL) != k_ESteamNetworkingAvailability_Current)
return;
m_bIsConnectedToSteamRelay = 1;
if (!CommandLine()->ParamValue("-steam-connect"))
return;
V_printf("%llu\n", SteamUser()->GetSteamID().ConvertToUint64());
char *pEnd = NULL;
uint64_t uValue = strtoull(CommandLine()->ParamValue("-steam-connect"), &pEnd, 10);
g_pServerConnection = g_pEngineConstants->ConnectSteamServer(uValue, FUNNY_SECURE_PORT);
if (g_pServerConnection)
{
m_bIsConnectedToSteamRelay = 1;
V_printf("%llu\n", SteamUser()->GetSteamID().ConvertToUint64());
if (CommandLine()->ParamValue("-steam-connect"))
{
char *pEnd = NULL;
uint64_t uValue = strtoull(CommandLine()->ParamValue("-steam-connect"), &pEnd, 10);
g_pServerConnection = g_pEngineConstants->ConnectSteamServer(uValue, FUNNY_SECURE_PORT);
if (g_pServerConnection)
{
m_bIsConnectedToServer = true;
C_BaseEntity **ppEntities = EntitySystem()->GetEntities();
for ( int i = 0; i < MAX_EDICTS; i++ )
{
EntitySystem()->DestroyEntityByIndex(i);
}
}
return;
m_bIsConnectedToServer = true;
C_BaseEntity **ppEntities = EntitySystem()->GetEntities();
for ( int i = 0; i < MAX_EDICTS; i++ )
{
EntitySystem()->DestroyEntityByIndex(i);
}
}
return;
}
#endif
}
@@ -158,53 +155,19 @@ void CFunnyGameBridge::Frame( float fDelta )
while ( pCurrentServer->BHasUpdates() )
{
NetPacket_t packet = pCurrentServer->PeekPacket();
// discard it
if (packet.uSize < sizeof (EMessageType))
continue;
PlayerPacket_t *pPacket = (PlayerPacket_t*)packet.pData;
C_BaseEntity *pEntity;
switch (pPacket->m_eType)
{
case MESSAGE_ENTITY_CLASS_SYNC:
V_printf("MESSAGE_ENTITY_CLASS_SYNC: %u = %s\n", (uint32_t)pPacket->m_entityClass.m_uIndex, pPacket->m_entityClass.m_szEntityName);
pEntity = EntitySystem()->CreateByClassnameWithIndex(
(char*)pPacket->m_entityClass.m_szEntityName, pPacket->m_entityClass.m_uIndex
);
if (pEntity == NULL)
{
pCurrentServer->RecievePacket();
continue;
}
pEntity->Spawn();
pCurrentServer->RecievePacket();
break;
case MESSAGE_ENTITY_DATA_SYNC:
pEntity = EntitySystem()->GetEntities()[pPacket->m_entityData.m_uIndex];
if (pEntity == NULL)
{
pCurrentServer->RecievePacket();
continue;
}
union {
void *pData;
char *pcCurrentData;
EntityDataSyncValue_t *pcSyncValue;
};
pData = pPacket;
pcCurrentData += sizeof(EntityDataSync_t);
for ( uint32_t u = 0; u < pPacket->m_entityData.m_uCount; u++ )
{
uint32_t uVariableSize = pcSyncValue->m_uVariableSize;
void *pValueData = (float*)ENT_GetNetMapData(
pEntity,
pEntity->GetRecvMap(),
pcSyncValue->m_uVariableIndex);
pcCurrentData += sizeof(EntityDataSyncValue_t);
if (pValueData)
V_memcpy(pValueData, pcCurrentData, uVariableSize);
pcCurrentData += (uVariableSize+7) & ~7;
}
case k_EMessage_PlayerSetLocalEntity:
EntitySystem()->NetRecvPacket(&packet);
pCurrentServer->RecievePacket();
break;
default:
@@ -227,8 +190,9 @@ void CFunnyGameBridge::Shutdown()
#define CONNECT_INTERFACE(szName, pGlobal) if (!V_strcmp(psz, szName)) { pGlobal = (typeof(pGlobal))pInterface; return; }
void CFunnyGameBridge::ConnectInterface( const char *psz, void *pInterface )
{
CONNECT_INTERFACE(RENDER_CONTEXT_INTERFACE_VERSION, g_pRenderContext);
CONNECT_INTERFACE(FILESYSTEM_INTERFACE_VERSION, filesystem);
CONNECT_INTERFACE(RENDER_CONTEXT_INTERFACE_VERSION, g_pRenderContext);
CONNECT_INTERFACE(HUMAN_DEVICE_MANAGER_INTERFACE_VERSION, g_pHumanDeviceManager);
CONNECT_INTERFACE("MainWindow", g_pMainWindow);
CONNECT_INTERFACE("EngineConstants", g_pEngineConstants);
}

View File

@@ -1,6 +1,7 @@
#include "player.h"
#include "cglm/cglm.h"
#include "assetmgr.h"
#include "game.h"
void C_MOBAPlayer::Precache()
{
@@ -12,12 +13,19 @@ void C_MOBAPlayer::Spawn()
{
BaseClass::Spawn();
SetThink(Think);
g_pWorldRenderer->SetCameraPosition({0, 0, -20});
};
void C_MOBAPlayer::Think( float fDelta )
{
BaseClass::Think(fDelta);
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
if (pEntity == this)
{
Vector vCameraPos = GetAbsOrigin();
vCameraPos.z -= 20;
g_pWorldRenderer->SetCameraPosition(vCameraPos);
}
};
LINK_ENTITY_TO_CLASS(player, C_MOBAPlayer)
@@ -26,7 +34,21 @@ BEGIN_DATADESC(C_MOBAPlayer)
END_DATADESC()
IMPLEMENT_RECV_DT(C_MOBAPlayer)
NetPropFloat(m_fTimer),
END_RECV_DT()
IMPLEMENT_EMPTY_SEND_DT(C_MOBAPlayer)
static void IN_ForwardDown( int c, char **v ) {
}
static ConCommand startforward("+forward", IN_ForwardDown);
static void IN_ForwardUp( int c, char **v ) {
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
if (pEntity)
{
}
}
static ConCommand endforward("-forward", IN_ForwardUp);

View File

@@ -15,7 +15,6 @@ public:
virtual void Spawn( void ) override;
void Think( float fDelta );
float m_fTimer;
int m_bIsShooting;
float m_fFBWalkingDirection;
float m_fLRWalkingDirection;

View File

@@ -1,10 +1,10 @@
#include "worldrender.h"
#include "tier1/utlstring.h"
#include "engine.h"
#include "cglm/cglm.h"
#include "cglm/quat.h"
#include "cglm/mat4.h"
#include "game.h"
struct ViewBuffer_t
{

View File

@@ -16,6 +16,8 @@ DECLARE_BUILD_STAGE(Server)
compileProject.m_szName = "server";
compileProject.files = {
"../shared/game.cpp",
"game.cpp",
"assetmgr.cpp",

View File

@@ -9,7 +9,7 @@
#include "stddef.h"
#include "string.h"
#include "stdlib.h"
#include "engine.h"
#include "game.h"
#include "netprotocol.h"
@@ -56,7 +56,7 @@ void CEntitySystem::RegisterEntityClass( IEntityFactory *pEntityFactory, const c
s_pEntitiesRegistry = pRegistry;
}
CBaseEntity *CEntitySystem::CreateByClassname( const char *szName )
CBaseEntity *CEntitySystem::CreateByClassname( const char *szName, int *pOutputIndex )
{
IEntityFactory *pFactory;
CBaseEntity *pEntity;
@@ -87,6 +87,9 @@ CBaseEntity *CEntitySystem::CreateByClassname( const char *szName )
m_pEntities[iSelectedSlot] = pEntity;
m_nEntityCount++;
if (pOutputIndex)
*pOutputIndex = iSelectedSlot;
EntityClass_t stClassSync = {
MESSAGE_ENTITY_CLASS_SYNC,
iSelectedSlot,

View File

@@ -20,7 +20,7 @@ public:
CEntitySystem();
virtual void RegisterEntityClass( IEntityFactory *pEntityFactory, const char *szClassName );
virtual CBaseEntity *CreateByClassname( const char *szName );
virtual CBaseEntity *CreateByClassname( const char *szName, int *pOutputIndex );
virtual IEntityFactory *GetFactoryByClassname( const char *szName );

View File

@@ -12,23 +12,6 @@
#include "steam/steam_gameserver.h"
#endif
IFileSystem *filesystem;
IRenderContext *g_pRenderContext;
IGameWindow *g_pMainWindow;
static CEngineVars s_vars;
CEngineVars *g_pEngineVars = &s_vars;
EngineConsts_t *g_pEngineConstants;
INetworkBase *g_pClientBridge;
INetworkBase *g_pPublicConnection;
INetworkBase *g_pCurrentConnection;
IPhysics *g_pPhysics;
IPhysicsWorld *g_pPhysicsWorld;
class CFunnyGameBridge: public IEngineBridge
{
virtual void Init() override;
@@ -81,9 +64,17 @@ uint32_t NET_ServerCallback( NetCallback_t *pCallback )
g_pCurrentConnection->SendPacket({&stClassSync, sizeof(stClassSync), pCallback->m_ullUserConnection, PACKET_MUST_ARRIVE});
}
int iIndex = -1;
CBaseEntity *pEntity;
pEntity = EntitySystem()->CreateByClassname("player");
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
pEntity->Spawn();
SetLocalEntity_t stLocalEntity = {
k_EMessage_PlayerSetLocalEntity,
iIndex,
};
if (g_pCurrentConnection)
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), pCallback->m_ullUserConnection, PACKET_MUST_ARRIVE});
return 1;
}
return 0;
@@ -149,13 +140,29 @@ void NET_ProcessPacket( INetworkBase *pBase )
switch (pPacket->m_eType)
{
case MESSAGE_PLAYER_JOINED:
// online packets don't generate these
if (g_pEngineConstants->m_bIsDedicated)
break;
pBase->RecievePacket();
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
pEntity = EntitySystem()->CreateByClassname("player");
pEntity->Spawn();
{
// online packets don't generate these
if (g_pEngineConstants->m_bIsDedicated)
break;
pBase->RecievePacket();
int iIndex = -1;
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
for ( int i = 0; i < 2; i++ )
{
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
pEntity->Spawn();
}
SetLocalEntity_t stLocalEntity = {
k_EMessage_PlayerSetLocalEntity,
iIndex,
};
if (g_pCurrentConnection)
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), 0, PACKET_MUST_ARRIVE});
}
return;
default:
break;

View File

@@ -1,19 +1,20 @@
#include "player.h"
#include "game.h"
#include "entitysystem.h"
void CMOBAPlayer::Spawn()
{
CPhysicsProp::Spawn();
SetModel("game/core/models/cube.fmdl");
SetScale(1);
SetThink(Think);
m_fTimer = 0;
};
void CMOBAPlayer::Think( float fDelta )
{
BaseClass::Think(fDelta);
SetScale(1);
CPhysicsProp::Think(fDelta);
};
LINK_ENTITY_TO_CLASS(player, CMOBAPlayer)
@@ -22,7 +23,6 @@ BEGIN_DATADESC(CMOBAPlayer)
END_DATADESC()
IMPLEMENT_SEND_DT(CMOBAPlayer)
NetPropFloat(m_fTimer)
END_SEND_DT()
IMPLEMENT_EMPTY_RECV_DT(CMOBAPlayer)

View File

@@ -1,12 +1,12 @@
#ifndef MILMOBA_PLAYER_H
#define MILMOBA_PLAYER_H
#include "basemodelentity.h"
#include "physicsprop.h"
class CMOBAPlayer: public CBaseModelEntity
class CMOBAPlayer: public CPhysicsProp
{
public:
DECLARE_CLASS(CMOBAPlayer, CBaseModelEntity);
DECLARE_CLASS(CMOBAPlayer, CPhysicsProp);
DECLARE_DATADESC();
DECLARE_SERVERCLASS()

View File

@@ -9,6 +9,7 @@ void CPhysicsProp::Precache()
void CPhysicsProp::Spawn()
{
CBaseEntity::Spawn();
SetThink(Think);
}

View File

@@ -1,28 +0,0 @@
#ifndef ENGINE_H
#define ENGINE_H
#include "tier2/ifilesystem.h"
#include "materialsystem/imaterialsystem.h"
#include "materialsystem/igamewindow.h"
#include "networkbase.h"
struct EngineConsts_t
{
bool m_bIsDedicated;
bool m_bIsSteam;
INetworkBase *(LaunchLocalBridge)(uint16_t uPort);
INetworkBase *(LaunchServer)(uint16_t uPort);
INetworkBase *(ConnectLocalBridge)(uint16_t uPort);
INetworkBase *(ConnectSteamServer)(uint64_t uServer, uint16_t uPort);
};
extern IFileSystem *filesystem;
extern IRenderContext *g_pRenderContext;
extern IGameWindow *g_pMainWindow;
extern EngineConsts_t *g_pEngineConstants;
extern INetworkBase *g_pServerBridge;
extern INetworkBase *g_pClientBridge;
extern INetworkBase *g_pPublicConnection;
extern INetworkBase *g_pCurrentConnection;
#endif

40
game/shared/game.cpp Normal file
View File

@@ -0,0 +1,40 @@
#include "game.h"
IFileSystem *filesystem;
IRenderContext *g_pRenderContext;
IGameWindow *g_pMainWindow;
IHumanDeviceManager *g_pHumanDeviceManager;
INetworkBase *g_pServerBridge;
INetworkBase *g_pClientBridge;
INetworkBase *g_pServerConnection;
INetworkBase *g_pPublicConnection;
INetworkBase *g_pCurrentConnection;
static CEngineVars s_vars;
CEngineVars *g_pEngineVars = &s_vars;
EngineConsts_t *g_pEngineConstants;
IPhysics *g_pPhysics;
IPhysicsWorld *g_pPhysicsWorld;
CreateInterfaceFn GetEngineFactory()
{
return Sys_GetFactory("engine");
};
// we need it to run before everything else
static IConsole *s_pConsole =
(IConsole*)GetEngineFactory()(CONSOLE_INTERFACE_VERSION, NULL);
IConsole *g_pConsole = s_pConsole;
EXPOSE_INTERFACE_GLOBALVAR(IConsole, IConsole, CONSOLE_INTERFACE_VERSION, g_pConsole)
IConsole *Console()
{
static IConsole *s_pConsole =
(IConsole*)GetEngineFactory()(CONSOLE_INTERFACE_VERSION, NULL);
return s_pConsole;
}

View File

@@ -1,11 +1,14 @@
#ifndef GAME_H
#define GAME_H
#include "tier2/ifilesystem.h"
#include "enginebridge.h"
#include "icvar.h"
#include "materialsystem/imaterialsystem.h"
#include "materialsystem/igamewindow.h"
#include "networkbase.h"
#include "iphysics.h"
extern IRenderContext *g_pRenderContext;
extern IFileSystem *filesystem;
extern IGameWindowManager *g_pWindowManager;
#include "ihumandevice.h"
class CEngineVars
{
@@ -14,7 +17,24 @@ public:
double m_fDeltaTime;
};
extern IFileSystem *filesystem;
extern IRenderContext *g_pRenderContext;
extern IGameWindow *g_pMainWindow;
extern INetworkBase *g_pServerBridge;
extern INetworkBase *g_pClientBridge;
extern INetworkBase *g_pServerConnection;
extern INetworkBase *g_pPublicConnection;
extern INetworkBase *g_pCurrentConnection;
extern CEngineVars *g_pEngineVars;
extern EngineConsts_t *g_pEngineConstants;
extern IPhysics *g_pPhysics;
extern IPhysicsWorld *g_pPhysicsWorld;
@@ -22,4 +42,11 @@ extern IPhysicsWorld *g_pPhysicsWorld;
#define FUNNY_SECURE_PORT 27015
#define FUNNY_QUERY_PORT 27016
#define CON_COMMAND( name, description ) \
static void name( int c, char **v ); \
static ConCommand name##_command(#name, name, description); \
static void name( int c, char **v ) \
CreateInterfaceFn GetEngineFactory();
#endif

View File

@@ -23,6 +23,8 @@ enum EMessageType: uint32_t
MESSAGE_PLAYER_LEFT,
MESSAGE_ENTITY_CLASS_SYNC,
MESSAGE_ENTITY_DATA_SYNC,
k_EMessage_PlayerSetLocalEntity,
};
struct PlayerJoined_t
@@ -53,7 +55,7 @@ struct EntityClass_t
struct EntityDataSync_t
{
EMessageType m_eType;
CNetworkUInt32 m_uIndex;
CNetworkUInt32 m_uIndex;
CNetworkUInt32 m_uCount;
};
@@ -63,6 +65,12 @@ struct EntityDataSyncValue_t
CNetworkUInt32 m_uVariableSize;
};
struct SetLocalEntity_t
{
EMessageType m_eType;
CNetworkUInt32 m_uIndex;
};
union PlayerPacket_t
{
EMessageType m_eType;
@@ -71,6 +79,7 @@ union PlayerPacket_t
PlayerLeft_t m_playerLeft;
EntityClass_t m_entityClass;
EntityDataSync_t m_entityData;
SetLocalEntity_t m_setLocalEntity;
};
#endif