2 BobToolz plugin for GtkRadiant
3 Copyright (C) 2001 Gordon Biggans
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.
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.
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
26 typedef struct treeModel_s {
30 #define MAX_TP_MODELS 256
32 class DTreePlanter : public IWindowListener {
34 virtual bool OnMouseMove(guint32 nFlags, gdouble x, gdouble y);
35 virtual bool OnLButtonDown(guint32 nFlags, gdouble x, gdouble y);
36 virtual bool OnMButtonDown(guint32 nFlags, gdouble x, gdouble y);
37 virtual bool OnRButtonDown(guint32 nFlags, gdouble x, gdouble y);
38 virtual bool OnLButtonUp(guint32 nFlags, gdouble x, gdouble y);
39 virtual bool OnMButtonUp(guint32 nFlags, gdouble x, gdouble y);
40 virtual bool OnRButtonUp(guint32 nFlags, gdouble x, gdouble y);
41 virtual bool OnKeyPressed(char *s) { return false; }
42 virtual bool Paint() { return true; }
43 virtual void Close() { }
62 m_world.LoadSelectedBrushes();
65 GetFilename( buffer, "bt/tp_ent.txt" );
67 FILE* file = fopen( buffer, "rb" );
69 fseek( file, 0, SEEK_END );
70 int len = ftell( file );
71 fseek( file, 0, SEEK_SET );
74 char* buf = new char[len+1];
76 // parser will do the cleanup, dont delete.
78 fread( buf, len, 1, file );
81 parser.SetScript( buf );
83 ReadConfig( &parser );
90 #define MT(t) !stricmp( pToken, t )
91 #define GT pToken = pScriptParser->GetToken( true )
92 #define CT if(!*pToken) { return; }
94 void ReadConfig( CScriptParser* pScriptParser ) {
105 if(m_numModels >= MAX_TP_MODELS) {
111 strncpy( m_trees[m_numModels++].name, pToken, MAX_QPATH );
112 } else if(MT("link")) {
115 strncpy( m_linkName, pToken, MAX_QPATH );
118 } else if(MT("entity")) {
121 strncpy( m_entType, pToken, MAX_QPATH );
122 } else if(MT("offset")) {
125 m_offset = atoi(pToken);
126 } else if(MT("pitch")) {
129 m_minPitch = atoi(pToken);
133 m_maxPitch = atoi(pToken);
136 } else if(MT("yaw")) {
139 m_minYaw = atoi(pToken);
143 m_maxYaw = atoi(pToken);
146 } else if(MT("scale")) {
149 m_minScale = static_cast<float>(atof(pToken));
153 m_maxScale = static_cast<float>(atof(pToken));
156 } else if(MT("numlinks")) {
159 m_linkNum = atoi( pToken );
164 virtual ~DTreePlanter() {
168 virtual void IncRef() { m_refCount++; }
169 virtual void DecRef() { m_refCount--; if (m_refCount <= 0) delete this; }
173 g_MessageTable.m_pfnHookWindow( this );
174 m_XYWrapper = g_MessageTable.m_pfnGetXYWndWrapper();
181 g_MessageTable.m_pfnUnHookWindow( this );
187 bool FindDropPoint(vec3_t in, vec3_t out);
188 void DropEntsToGround( void );
189 void MakeChain( void );
190 void SelectChain( void );
193 IXYWndWrapper* m_XYWrapper;
196 treeModel_t m_trees[MAX_TP_MODELS];
206 char m_entType[MAX_QPATH];
207 char m_linkName[MAX_QPATH];