work on the stuff on client
This commit is contained in:
79
game/server/milmoba/baseentity.h
Normal file
79
game/server/milmoba/baseentity.h
Normal file
@@ -0,0 +1,79 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef BASEENTITY_H
|
||||
#define BASEENTITY_H
|
||||
|
||||
#include "entitysystem.h"
|
||||
#include "datamap.h"
|
||||
#include "cglm/cglm.h"
|
||||
#include "trig.h"
|
||||
|
||||
#define DECLARE_CLASS_NOBASE( className ) \
|
||||
typedef className ThisClass;
|
||||
#define DECLARE_CLASS( className, baseName ) \
|
||||
typedef baseName BaseClass; \
|
||||
typedef className ThisClass;
|
||||
|
||||
#define LINK_ENTITY_TO_CLASS( mapClassName, DLLClassName) \
|
||||
static CEntityFactory<DLLClassName> g_EntityFactory_##mapClassName( #mapClassName );
|
||||
|
||||
class CBaseEntity;
|
||||
|
||||
class IEntityFactory
|
||||
{
|
||||
public:
|
||||
virtual CBaseEntity *Create() = 0;
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
class CEntityFactory : public IEntityFactory
|
||||
{
|
||||
public:
|
||||
CEntityFactory( const char *szClassName )
|
||||
{
|
||||
EntitySystem()->RegisterEntityClass(this, szClassName);
|
||||
};
|
||||
virtual CBaseEntity *Create() {
|
||||
return new T;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CBaseEntity;
|
||||
typedef void(*fnThink)( CBaseEntity *pThis );
|
||||
class CBaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS_NOBASE(CBaseEntity);
|
||||
DECLARE_DATADESC_NOBASE()
|
||||
|
||||
typedescription_t *FindDataByName( const char *szName );
|
||||
typedescription_t *FindDataByMapName( const char *szName );
|
||||
|
||||
virtual ~CBaseEntity();
|
||||
virtual void Spawn();
|
||||
|
||||
virtual void SetAbsAngles( float fPitch, float fYaw, float fRoll );
|
||||
virtual void SetAbsOrigin( Vector origin );
|
||||
virtual void SetScale( float fScale );
|
||||
|
||||
virtual QAngle GetAbsAngles( void );
|
||||
virtual Vector GetAbsOrigin( void );
|
||||
virtual float GetScale( void );
|
||||
|
||||
virtual void SetThink( fnThink pfnThink );
|
||||
virtual void SetNextThink( float fThink );
|
||||
|
||||
fnThink m_pfnThink = NULL;
|
||||
private:
|
||||
Vector m_vPosition;
|
||||
Quat m_vRotation;
|
||||
Vector m_vScale;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user