| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef CAFU_MAP_ENTITY_BASE_HPP_INCLUDED |
|---|
| 23 | #define CAFU_MAP_ENTITY_BASE_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "EntProperty.hpp" |
|---|
| 26 | #include "MapElement.hpp" |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | class EntityClassT; |
|---|
| 30 | class MapPrimitiveT; |
|---|
| 31 | class wxProgressDialog; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | class MapEntityBaseT : public MapElementT |
|---|
| 35 | { |
|---|
| 36 | public: |
|---|
| 37 | |
|---|
| 38 | /// The default constructor. |
|---|
| 39 | MapEntityBaseT(const wxColour& Color); |
|---|
| 40 | |
|---|
| 41 | /// The copy constructor for copying a base entity. |
|---|
| 42 | /// @param Ent The base entity to copy-construct this base entity from. |
|---|
| 43 | MapEntityBaseT(const MapEntityBaseT& Ent); |
|---|
| 44 | |
|---|
| 45 | /// The destructor. |
|---|
| 46 | ~MapEntityBaseT(); |
|---|
| 47 | |
|---|
| 48 | // Implementations and overrides for base class methods. |
|---|
| 49 | // MapEntityBaseT* Clone() const; |
|---|
| 50 | void Assign(const MapElementT* Elem); |
|---|
| 51 | |
|---|
| 52 | void Load_cmap (TextParserT& TP, MapDocumentT& MapDoc, wxProgressDialog* ProgressDialog, unsigned long EntityNr); |
|---|
| 53 | void Load_HL1_map(TextParserT& TP, MapDocumentT& MapDoc, wxProgressDialog* ProgressDialog, unsigned long EntityNr); |
|---|
| 54 | void Load_HL2_vmf(TextParserT& TP, MapDocumentT& MapDoc, wxProgressDialog* ProgressDialog, unsigned long EntityNr); |
|---|
| 55 | void Load_D3_map (TextParserT& TP, MapDocumentT& MapDoc, wxProgressDialog* ProgressDialog, unsigned long EntityNr); |
|---|
| 56 | void Save_cmap(const MapDocumentT& MapDoc, std::ostream& OutFile, unsigned long EntityNr, const BoundingBox3fT* Intersecting) const; |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | virtual void SetClass(const EntityClassT* NewClass); |
|---|
| 60 | const EntityClassT* GetClass() const { return m_Class; } |
|---|
| 61 | |
|---|
| 62 | const ArrayT<EntPropertyT>& GetProperties() const { return m_Properties; } |
|---|
| 63 | ArrayT<EntPropertyT>& GetProperties() { return m_Properties; } |
|---|
| 64 | |
|---|
| 65 | EntPropertyT* FindProperty (const wxString& Key, int* Index=NULL, bool Create=false); ///< Find the property. |
|---|
| 66 | const EntPropertyT* FindProperty (const wxString& Key, int* Index=NULL) const; ///< Find the property. |
|---|
| 67 | int FindPropertyIndex(const wxString& Key) const; ///< Get the index of the property. |
|---|
| 68 | |
|---|
| 69 | virtual void SetAngles(const cf::math::AnglesfT& Angles); |
|---|
| 70 | virtual cf::math::AnglesfT GetAngles() const; |
|---|
| 71 | |
|---|
| 72 | const ArrayT<MapPrimitiveT*>& GetPrimitives() const { return m_Primitives; } |
|---|
| 73 | |
|---|
| 74 | void AddPrim(MapPrimitiveT* Prim); |
|---|
| 75 | void RemovePrim(MapPrimitiveT* Prim); |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | // The TypeSys related declarations for this class. |
|---|
| 79 | virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; } |
|---|
| 80 | static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); |
|---|
| 81 | static const cf::TypeSys::TypeInfoT TypeInfo; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | protected: |
|---|
| 85 | |
|---|
| 86 | const EntityClassT* m_Class; ///< The "entity class" of this entity. |
|---|
| 87 | ArrayT<EntPropertyT> m_Properties; ///< The concrete, instantiated properties for this entity, according to its entity class. |
|---|
| 88 | ArrayT<MapPrimitiveT*> m_Primitives; ///< The primitive, atomic elements of this entity (brushes, patches, terrains, models, plants, ...). |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | #endif |
|---|