Cafu Engine
MapEditor::CompMapEntityT Class Reference

This component houses the Map Editor specific parts of its entity. More...

#include "CompMapEntity.hpp"

Inheritance diagram for MapEditor::CompMapEntityT:

Public Member Functions

 CompMapEntityT (MapDocumentT &MapDoc)
 The constructor. More...
 
 CompMapEntityT (const CompMapEntityT &Comp)
 The copy constructor. More...
 
 ~CompMapEntityT ()
 The destructor. More...
 
CompMapEntityTClone () const
 The virtual copy constructor. More...
 
const char * GetName () const
 Returns the name of this component. More...
 
void Render () const
 
void Load_cmap (TextParserT &TP, MapDocumentT &MapDoc, wxProgressDialog *ProgressDialog, unsigned long EntityNr, unsigned int &cmapVersion, bool IgnoreGroups)
 
void Load_HL1_map (TextParserT &TP, MapDocumentT &MapDoc, wxProgressDialog *ProgressDialog, unsigned long EntityNr)
 
void Load_HL2_vmf (TextParserT &TP, MapDocumentT &MapDoc, wxProgressDialog *ProgressDialog, unsigned long EntityNr)
 This method reads a "world" or "entity" chunk. More...
 
void Load_D3_map (TextParserT &TP, MapDocumentT &MapDoc, wxProgressDialog *ProgressDialog, unsigned long EntityNr)
 
void Save_cmap (const MapDocumentT &MapDoc, std::ostream &OutFile, unsigned long EntityNr, const BoundingBox3fT *Intersecting) const
 
MapDocumentTGetDoc () const
 
bool IsWorld () const
 
const ArrayT< EntPropertyT > & GetProperties () const
 
ArrayT< EntPropertyT > & GetProperties ()
 
EntPropertyTFindProperty (const wxString &Key, int *Index=NULL, bool Create=false)
 Find the property. More...
 
const EntPropertyTFindProperty (const wxString &Key, int *Index=NULL) const
 Find the property. More...
 
void RemoveProperty (const wxString &Key)
 Remove this property. More...
 
std::string GetProperty (const wxString &Key, const char *Default="") const
 Returns the value of this property, using the default if not found. More...
 
std::string GetAndRemove (const wxString &Key, const char *Default="")
 Returns the value of this property, using the default if not found, and removes it. More...
 
MapEntRepresTGetRepres () const
 
const ArrayT< MapPrimitiveT * > & GetPrimitives () const
 
void CopyPrimitives (const CompMapEntityT &MapEnt, bool Recursive=false)
 Creates a copy of each primitive in MapEnt and adds it to this instance. More...
 
void AddPrim (MapPrimitiveT *Prim)
 
void RemovePrim (MapPrimitiveT *Prim)
 
ArrayT< MapElementT * > GetAllMapElements () const
 Returns all map elements (the representation and the primitives) of this entity and of all of its children. More...
 
BoundingBox3fT GetElemsBB () const
 Returns the "overall" bounding-box of this entity. More...
 
- Public Member Functions inherited from cf::GameSys::ComponentBaseT
 ComponentBaseT ()
 The constructor. More...
 
 ComponentBaseT (const ComponentBaseT &Comp)
 The copy constructor. More...
 
virtual ~ComponentBaseT ()
 The virtual destructor. More...
 
EntityTGetEntity () const
 Returns the parent entity that contains this component, or NULL if this component is currently not a part of any entity. More...
 
TypeSys::VarManTGetMemberVars ()
 Returns the variable manager that keeps generic references to our member variables, providing a simple kind of "reflection" or "type introspection" feature. More...
 
template<class T >
void SetMember (const char *Name, const T &Value)
 Sets the member variable with the given name to the given value. More...
 
ArrayT< ApproxBaseT * > & GetInterpolators ()
 Returns the interpolators that have been registered with this component. More...
 
bool InitClientApprox (const char *VarName)
 Registers the member variable with the given name for interpolation over client frames in order to bridge the larger intervals between server frames. More...
 
void Serialize (cf::Network::OutStreamT &Stream) const
 Writes the current state of this component into the given stream. More...
 
void Deserialize (cf::Network::InStreamT &Stream, bool IsIniting)
 Reads the state of this component from the given stream, and updates the component accordingly. More...
 
bool CallLuaMethod (const char *MethodName, int NumExtraArgs, const char *Signature="",...)
 Calls the given Lua method of this component. More...
 
virtual void UpdateDependencies (EntityT *Entity)
 This method is called whenever something "external" to this component has changed: More...
 
virtual unsigned int GetEditorColor () const
 Returns a color that the Map Editor can use to render the representation of this component's entity. More...
 
virtual BoundingBox3fT GetEditorBB () const
 Returns a bounding-box that the Map Editor can use to render the representation of this component's entity and for related hit tests in the 2D and 3D views after mouse clicks. More...
 
virtual BoundingBox3fT GetCullingBB () const
 This method returns a bounding-box that encloses the visual representation of this component. More...
 
virtual const
cf::ClipSys::ClipModelT
GetClipModel ()
 This method returns the clip model of this component, if any. More...
 
virtual void PreCache ()
 Initializes any resources that may be needed on the client or server ahead of time. More...
 
virtual bool Render (bool FirstPersonView, float LodDist) const
 This method implements the graphical output of this component. More...
 
virtual void PostRender (bool FirstPersonView)
 This method provides an opportunity for another render pass. More...
 
virtual void OnPostLoad (bool OnlyStatic)
 This method is called after all entities and their components have been loaded. More...
 
virtual bool OnInputEvent (const CaKeyboardEventT &KE)
 This method handles keyboard input events. More...
 
virtual bool OnInputEvent (const CaMouseEventT &ME, float PosX, float PosY)
 This method handles mouse input events. More...
 
void OnServerFrame (float t)
 Advances the component one frame (one "clock-tick") on the server. More...
 
void OnClientFrame (float t)
 Advances the component one frame (one "clock-tick") on the client. More...
 
virtual const
cf::TypeSys::TypeInfoT
GetType () const
 
- Public Member Functions inherited from RefCountedT
unsigned int GetRefCount () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cf::GameSys::ComponentBaseT
static void * CreateInstance (const cf::TypeSys::CreateParamsT &Params)
 
- Static Public Attributes inherited from cf::GameSys::ComponentBaseT
static const cf::TypeSys::TypeInfoT TypeInfo
 
- Protected Member Functions inherited from RefCountedT
 RefCountedT (const RefCountedT &)
 
RefCountedToperator= (const RefCountedT &)
 
- Static Protected Member Functions inherited from cf::GameSys::ComponentBaseT
static int Get (lua_State *LuaState)
 
static int Set (lua_State *LuaState)
 
static int GetExtraMessage (lua_State *LuaState)
 
static int Interpolate (lua_State *LuaState)
 
static int GetEntity (lua_State *LuaState)
 
static int InitClientApprox (lua_State *LuaState)
 
static int toString (lua_State *LuaState)
 
- Static Protected Attributes inherited from cf::GameSys::ComponentBaseT
static const luaL_Reg MethodsList []
 The list of Lua methods for this class. More...
 
static const char * DocClass
 
static const cf::TypeSys::MethsDocT DocMethods []
 
static const cf::TypeSys::MethsDocT DocCallbacks []
 

Detailed Description

This component houses the Map Editor specific parts of its entity.

It is intended for use by the Map Editor application only, that is, as the "App" component of cf::GameSys::EntityTs. As such, it doesn't integrate with the TypeSys, and thus isn't available for scripting and whereever else we need the related meta-data.

Constructor & Destructor Documentation

CompMapEntityT::CompMapEntityT ( MapDocumentT MapDoc)

The constructor.

CompMapEntityT::CompMapEntityT ( const CompMapEntityT Comp)

The copy constructor.

It creates a new component as a copy of another component.

Note that the new map entity is created without any primitives, that is, the primitives are intentionally not copied from Comp. This is because it is easy to call CopyPrimitives() with the new instance if the user code wants to have the map primitives copied as well, whereas the reverse would be very difficult to handle.

(If primitives were copied per default, having them not copied when they are not wanted would require another parameter to the copy constructor – which had to be passed through by the EntityT copy constructors and Clone() methods as well as by all Clone() methods in the ComponentBaseT hierarchy. This would be difficult to understand and bother large amounts of completely unrelated code.)

Parameters
CompThe component to copy-construct this component from.
CompMapEntityT::~CompMapEntityT ( )

The destructor.

Member Function Documentation

CompMapEntityT * CompMapEntityT::Clone ( ) const
virtual

The virtual copy constructor.

Callers can use this method to create a copy of this component without knowing its concrete type. Overrides in derived classes use a covariant return type to facilitate use when the concrete type is known. The newly cloned component is initially not a part of any entity, even if the source component was.

Reimplemented from cf::GameSys::ComponentBaseT.

void CompMapEntityT::CopyPrimitives ( const CompMapEntityT MapEnt,
bool  Recursive = false 
)

Creates a copy of each primitive in MapEnt and adds it to this instance.

If Recursive is true, the primitives of all child entities are copied recursively (as far as the two entity hierarchies match).

EntPropertyT * CompMapEntityT::FindProperty ( const wxString &  Key,
int *  Index = NULL,
bool  Create = false 
)

Find the property.

const EntPropertyT * CompMapEntityT::FindProperty ( const wxString &  Key,
int *  Index = NULL 
) const

Find the property.

ArrayT< MapElementT * > CompMapEntityT::GetAllMapElements ( ) const

Returns all map elements (the representation and the primitives) of this entity and of all of its children.

std::string CompMapEntityT::GetAndRemove ( const wxString &  Key,
const char *  Default = "" 
)

Returns the value of this property, using the default if not found, and removes it.

BoundingBox3fT CompMapEntityT::GetElemsBB ( ) const

Returns the "overall" bounding-box of this entity.

The returned bounding-box contains all elements (the representation and all primitives) of this entity.

const char* MapEditor::CompMapEntityT::GetName ( ) const
inlinevirtual

Returns the name of this component.

Reimplemented from cf::GameSys::ComponentBaseT.

std::string CompMapEntityT::GetProperty ( const wxString &  Key,
const char *  Default = "" 
) const

Returns the value of this property, using the default if not found.

void CompMapEntityT::Load_HL2_vmf ( TextParserT TP,
MapDocumentT MapDoc,
wxProgressDialog *  ProgressDialog,
unsigned long  EntityNr 
)

This method reads a "world" or "entity" chunk.

The chunk name has already been read from TP, next token must be the opening "{".

void CompMapEntityT::RemoveProperty ( const wxString &  Key)

Remove this property.


The documentation for this class was generated from the following files: