added command line, added basic character
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "input.h"
|
||||
#include "tier1/commandline.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier0/lib.h"
|
||||
@@ -14,6 +15,11 @@ double fPrev = 0;
|
||||
double fCurrent = 0;
|
||||
|
||||
funnyphysics *px;
|
||||
|
||||
IIClient g_localClient;
|
||||
|
||||
CUtlVector<IIClient*> g_clients;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Engine entry point
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -30,6 +36,9 @@ extern "C" void FunnyMain( int argc, char **argv ) {
|
||||
/* deinit is handled explicitly */
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Recieves signals from the system
|
||||
//-----------------------------------------------------------------------------
|
||||
void IEngine_Signal(int sig)
|
||||
{
|
||||
printf("Trapped signal %i\n",sig);
|
||||
@@ -48,7 +57,9 @@ void IEngine_Signal(int sig)
|
||||
_exit(0);
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Initializes engine
|
||||
//-----------------------------------------------------------------------------
|
||||
void IEngine::Init()
|
||||
{
|
||||
/* trap signals */
|
||||
@@ -66,36 +77,52 @@ void IEngine::Init()
|
||||
#endif
|
||||
|
||||
IFileSystem::InitFilesystem();
|
||||
IVideo::Init();
|
||||
px = px_init();
|
||||
|
||||
if (!ICommandLine::CheckParam("-dedicated"))
|
||||
{
|
||||
g_localClient = {
|
||||
|
||||
};
|
||||
IIEngine::ConnectClient(&g_localClient);
|
||||
|
||||
IVideo::Init();
|
||||
IInput::Init();
|
||||
}
|
||||
IServer::LoadGame("funnygame");
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Updates every frame
|
||||
//-----------------------------------------------------------------------------
|
||||
void IEngine::Frame(float fDelta)
|
||||
{
|
||||
IServer::Think(fDelta);
|
||||
IVideo::Frame(fDelta);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Deinitializes engine
|
||||
//-----------------------------------------------------------------------------
|
||||
void IEngine::Shutdown()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Spawns entity in the world
|
||||
//-----------------------------------------------------------------------------
|
||||
CBaseEntity *IIEngine::SpawnEntity( const char *szName )
|
||||
{
|
||||
V_printf("%s\n", szName);
|
||||
for (auto &entity: g_RegisteredEntities)
|
||||
{
|
||||
if (!V_strcmp(entity->m_szName, szName))
|
||||
{
|
||||
CBaseEntity *pEnt = entity->m_pfn();
|
||||
pEnt->Spawn();
|
||||
g_entities.AppendTail(pEnt);
|
||||
if (entity->m_pClientfn)
|
||||
{
|
||||
pEnt->pClientEntity = entity->m_pClientfn();
|
||||
pEnt->pClientEntity->Spawn();
|
||||
pEnt->pClientEntity->pEntity = pEnt;
|
||||
}
|
||||
return pEnt;
|
||||
@@ -104,7 +131,38 @@ CBaseEntity *IIEngine::SpawnEntity( const char *szName )
|
||||
return 0;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Spawns entity without any parameters
|
||||
//-----------------------------------------------------------------------------
|
||||
void IIEngine::InitEntity( CBaseEntity *pEntity )
|
||||
{
|
||||
if (!pEntity)
|
||||
return;
|
||||
pEntity->Spawn();
|
||||
if (pEntity->pClientEntity)
|
||||
pEntity->pClientEntity->Spawn();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Destroys entity
|
||||
//-----------------------------------------------------------------------------
|
||||
void IIEngine::DestroyEntity( CBaseEntity *pEntity )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Connects client to the server
|
||||
//-----------------------------------------------------------------------------
|
||||
void IIEngine::ConnectClient( IIClient *pClient)
|
||||
{
|
||||
g_clients.AppendTail(pClient);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Disconnects client from the server
|
||||
//-----------------------------------------------------------------------------
|
||||
void IIEngine::DisconnectClient( IIClient *pClient)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user