]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/DEntity.h
1eb3fec23f3fe2a9c1ec23a21044f3a9a286d3b4
[xonotic/netradiant.git] / contrib / bobtoolz / DEntity.h
1 /*
2    BobToolz plugin for GtkRadiant
3    Copyright (C) 2001 Gordon Biggans
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 // DEntity.h: interface for the DEntity class.
21 //
22 //////////////////////////////////////////////////////////////////////
23
24 #if !defined( AFX_DENTITY_H__35B2C523_F0A7_11D4_ACF7_004095A18133__INCLUDED_ )
25 #define AFX_DENTITY_H__35B2C523_F0A7_11D4_ACF7_004095A18133__INCLUDED_
26
27 #if _MSC_VER > 1000
28 #pragma once
29 #endif // _MSC_VER > 1000
30
31 #include <list>
32 #include "str.h"
33 #include "mathlib.h"
34
35 class DEPair;
36
37 class DBrush;
38
39 class DPlane;
40
41 class DPatch;
42
43 class Entity;
44
45 namespace scene {
46     class Node;
47 }
48 class _QERFaceData;
49
50 class DEntity {
51 public:
52     void RemoveFromRadiant();
53
54     scene::Node *QER_Entity;
55     int m_nID;
56
57 //      Constrcution/Destruction
58     DEntity(const char *classname = "worldspawn", int ID = -1);   // sets classname
59     virtual ~DEntity();
60 //      ---------------------------------------------
61
62 //      epair functions........
63     void LoadEPairList(Entity *epl);
64
65     void AddEPair(const char *key, const char *value);
66
67     void ClearEPairs();
68
69     DEPair *FindEPairByKey(const char *keyname);
70 //      ---------------------------------------------
71
72 //      random functions........
73     bool
74     ResetTextures(const char *textureName, float fScale[2], float fShift[2], int rotation, const char *newTextureName,
75                   int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation, bool rebuild);
76
77     void SaveToFile(FILE *pFile);
78
79     void SetClassname(const char *classname);
80
81     int GetIDMax();
82
83     void BuildInRadiant(bool allowDestruction);
84
85     void ResetChecks(std::list<Str> *exclusionList);
86
87     void RemoveNonCheckBrushes(std::list<Str> *exclusionList, bool useDetail);
88
89     DPlane *
90     AddFaceToBrush(vec3_t va, vec3_t vb, vec3_t vc, _QERFaceData *faceData, int ID);      // slow, try not to use much
91     int GetBrushCount(void);
92
93     DBrush *FindBrushByPointer(scene::Node &brush);
94 //      ---------------------------------------------
95
96
97 //      bool list functions
98     void SelectBrushes(bool *selectList);
99
100     bool *BuildDuplicateList();
101
102     bool *BuildIntersectList();
103 //      ---------------------------------------------
104
105
106 //      brush operations
107     void ClearBrushes();        // clears brush list and frees memory for brushes
108
109     DBrush *GetBrushForID(int ID);
110
111     DBrush *NewBrush(int ID = -1);
112 //      ---------------------------------------------
113
114 //      patch operations
115     void ClearPatches();
116
117     DPatch *NewPatch();
118 //      ---------------------------------------------
119
120 //      vars
121     std::list<DEPair *> epairList;
122     std::list<DBrush *> brushList;
123 // new patches, wahey!!!
124     std::list<DPatch *> patchList;
125     Str m_Classname;
126 //      ---------------------------------------------
127
128
129     int FixBrushes();
130
131     bool LoadFromEntity(scene::Node &ent, bool bLoadPatches = false);
132
133     void LoadSelectedBrushes();
134
135     void LoadSelectedPatches();
136
137     bool LoadFromPrt(char *filename);
138
139 //      ---------------------------------------------
140     void SpawnString(const char *key, const char *defaultstring, const char **out);
141
142     void SpawnInt(const char *key, const char *defaultstring, int *out);
143
144     void SpawnFloat(const char *key, const char *defaultstring, float *out);
145
146     void SpawnVector(const char *key, const char *defaultstring, vec_t *out);
147 };
148
149 #endif // !defined(AFX_DENTITY_H__35B2C523_F0A7_11D4_ACF7_004095A18133__INCLUDED_)