some stuff
This commit is contained in:
@@ -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
40
game/shared/game.cpp
Normal 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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user