]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - include/qertypes.h
eol style
[xonotic/netradiant.git] / include / qertypes.h
index 0c6ebbdb8b12bd57080fadb3cea86727cfcfed91..ad785cfe30bb35f919db7a9813a5946f2d195209 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-// qertypes.h\r
-//\r
-// common types\r
-// merged from brush.h, etc. for plugin support\r
-//\r
-#ifndef _QERTYPES_H_\r
-#define _QERTYPES_H_\r
-\r
-#ifdef _WIN32\r
-#include <wtypes.h>\r
-#endif\r
-\r
-#include <GL/gl.h>\r
-\r
-#include "str.h"\r
-\r
-#ifdef _WIN32\r
-#define PATH_MAX 260\r
-#endif\r
-\r
-// HACK glib-2.0\r
-#define NAME_MAX 255\r
-\r
-typedef bool qboolean;\r
-\r
-#define        MAXPOINTS       16\r
-\r
-// merged from qedefs.h ------\r
-\r
-#define        MAX_EDGES       512\r
-#define        MAX_POINTS      1024\r
-\r
-#define        COLOR_TEXTUREBACK         0\r
-#define        COLOR_GRIDBACK            1\r
-#define        COLOR_GRIDMINOR           2\r
-#define        COLOR_GRIDMAJOR           3\r
-#define        COLOR_CAMERABACK          4\r
-#define COLOR_ENTITY        5\r
-#define COLOR_GRIDBLOCK     6\r
-#define COLOR_GRIDTEXT      7\r
-#define COLOR_BRUSHES       8\r
-#define COLOR_SELBRUSHES    9\r
-#define COLOR_CLIPPER       10\r
-#define COLOR_VIEWNAME      11\r
-#define COLOR_SELBRUSHES3D  12\r
-\r
-#define COLOR_GRIDMINOR_ALT 13\r
-#define COLOR_GRIDMAJOR_ALT 14\r
-\r
-#define COLOR_LAST          15\r
-\r
-// ----------------------------\r
-\r
-typedef float vec_t;\r
-typedef vec_t vec3_t[3];\r
-\r
-// turn this on/off to use a static texdef or a memory one\r
-// THIS MUST BE CONSISTENT throughout a whole build of Radiant / modules / plugins\r
-// DO_TEXDEF_ALLOC is more memory efficient, but I suspect it to be wacky on win32 / C runtime etc.\r
-#define DO_TEXDEF_ALLOC 1\r
-#if DO_TEXDEF_ALLOC\r
-\r
-class texdef_t\r
-{\r
-private:\r
-  char *name;\r
-public:\r
-  texdef_t()\r
-  {\r
-    name = new char[1];\r
-    name[0] = '\0';\r
-    shift[0] = 0.0f;\r
-    shift[1] = 0.0f;\r
-    rotate = 0.0f;\r
-    scale[0] = 1.0f;\r
-    scale[1] = 1.0f;\r
-    contents = 0;\r
-    flags = 0;\r
-    value = 0;\r
-  }\r
-  texdef_t(const texdef_t& other)\r
-  {\r
-    name = NULL;\r
-    SetName(other.name);\r
-    shift[0] = other.shift[0];\r
-    shift[1] = other.shift[1];\r
-    rotate = other.rotate;\r
-    scale[0] = other.scale[0];\r
-    scale[1] = other.scale[1];\r
-    contents = other.contents;\r
-    flags = other.flags;\r
-    value = other.value;\r
-  }\r
-  ~texdef_t()\r
-  {\r
-    if (name)\r
-    {\r
-      delete []name;\r
-      name = (char*)NULL;\r
-    }\r
-  }\r
-\r
-  void SetName(const char *p)\r
-  {\r
-    if (name)\r
-    {\r
-      delete []name;\r
-      name = NULL;\r
-    }\r
-    if (p)\r
-    {\r
-      name = strcpy(new char[strlen(p)+1], p);\r
-    }\r
-    else\r
-    {\r
-      name = new char[1];\r
-      name[0] = '\0';\r
-    }\r
-  }\r
-\r
-  const char * GetName() const\r
-  {\r
-    return name;\r
-  }\r
-\r
-  // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..\r
-  void DropName()\r
-  {\r
-    name = NULL;\r
-    SetName(NULL);\r
-  }\r
-\r
-  texdef_t& operator =(const texdef_t& rhs)\r
-  {\r
-    if (&rhs != this)\r
-    {\r
-      SetName(rhs.name);\r
-      shift[0] = rhs.shift[0];\r
-      shift[1] = rhs.shift[1];\r
-      rotate = rhs.rotate;\r
-      scale[0] = rhs.scale[0];\r
-      scale[1] = rhs.scale[1];\r
-      contents = rhs.contents;\r
-      flags = rhs.flags;\r
-      value = rhs.value;\r
-    }\r
-    return *this;\r
-  }\r
-       float   shift[2];\r
-       float   rotate;\r
-       float   scale[2];\r
-       int             contents;\r
-       int             flags;\r
-       int             value;\r
-};\r
-\r
-#else\r
-\r
-// max length of a vfs texture path\r
-#define QPATH 64\r
-class texdef_t\r
-{\r
-private:\r
-  char name[QPATH];\r
-public:\r
-  texdef_t() { name[0] = '\0'; }\r
-  ~texdef_t() {  }\r
-\r
-  void SetName(const char *p)\r
-  {\r
-    strncpy(name, p, QPATH);\r
-  }\r
-\r
-  const char * GetName() const\r
-  {\r
-    return name;\r
-  }\r
-\r
-  // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..\r
-  void DropName()\r
-  {\r
-    name[0] = '\0';\r
-  }\r
-\r
-  texdef_t& operator =(const texdef_t& rhs)\r
-  {\r
-    if (&rhs != this)\r
-    {\r
-      SetName(rhs.name);\r
-      shift[0] = rhs.shift[0];\r
-      shift[1] = rhs.shift[1];\r
-      rotate = rhs.rotate;\r
-      scale[0] = rhs.scale[0];\r
-      scale[1] = rhs.scale[1];\r
-      contents = rhs.contents;\r
-      flags = rhs.flags;\r
-      value = rhs.value;\r
-    }\r
-    return *this;\r
-  }\r
-       float   shift[2];\r
-       float   rotate;\r
-       float   scale[2];\r
-       int             contents;\r
-       int             flags;\r
-       int             value;\r
-};\r
-\r
-#endif\r
-\r
-// forward declare\r
-class IShader;\r
-\r
-// Timo\r
-// new brush primitive texdef\r
-typedef struct brushprimit_texdef_s\r
-{\r
-       vec_t   coords[2][3];\r
-} brushprimit_texdef_t;\r
-\r
-// this structure is used in Radiant to reflect the state of the texture window\r
-// it gives information on current shader and various flags\r
-class texturewin_t\r
-{\r
-public:\r
-  texturewin_t()\r
-  {\r
-  }\r
-  ~texturewin_t()\r
-  {\r
-  }\r
-       int                     width, height;\r
-       int                     originy;\r
-       // add brushprimit_texdef_t for brush primitive coordinates storage\r
-       brushprimit_texdef_t    brushprimit_texdef;\r
-       int m_nTotalHeight;\r
-       // surface plugin, must be casted to a IPluginTexdef*\r
-       void* pTexdef;\r
-       texdef_t        texdef;\r
-       // shader\r
-       // NOTE: never NULL, initialized in Texture_Init\r
-       // NOTE: the reference name of the shader is texdef.name (see QERApp_ReloadShaders for an example)\r
-       IShader *pShader;\r
-};\r
-\r
-#define QER_TRANS     0x00000001\r
-#define QER_NOCARVE   0x00000002\r
-#define QER_NODRAW    0x00000004\r
-#define QER_NONSOLID  0x00000008\r
-#define QER_WATER     0x00000010\r
-#define QER_LAVA      0x00000020\r
-#define QER_FOG       0x00000040\r
-#define QER_ALPHAFUNC 0x00000080\r
-#define QER_CULL      0x00000100\r
-\r
-\r
-// describes a GL texture that Radiant uses to represent a shader\r
-// NOTE: all qtexture_t are stored in a main list at g_qeglobals.d_qtextures\r
-// shaders have reference couting, but qtexture_t don't (they're way too deep into Radiant)\r
-typedef struct qtexture_s\r
-{\r
-  struct       qtexture_s *next;\r
-  // name of the texture file (the physical image file we are using)\r
-  // NOTE: used for lookup, must be unique .. vfs path of the texture, lowercase, NO FILE EXTENSION\r
-  // ex textures/gothic_wall/iron\r
-  // NOTE: the "textures/" prefix might seem unnecessary .. but it's better to stick to the vfs name\r
-  char           name[64];\r
-  int              width,  height;\r
-  GLuint               texture_number; // gl bind number (the qtexture_t are usually loaded and binded by the shaders module)\r
-  vec3_t               color;                      // for flat shade mode\r
-  qboolean     inuse;                            // true = is present on the level (for the texture browser interface)\r
-} qtexture_t;\r
-\r
-// NOTE: don't trust this definition!\r
-// you should read float points[..][5]\r
-// see NewWinding definition\r
-// WARNING: don't touch anything to this struct unless you looked into winding.cpp and WINDING_SIZE(pt)\r
-#define MAX_POINTS_ON_WINDING 64\r
-typedef struct\r
-{\r
-  int          numpoints;\r
-  int          maxpoints;\r
-  float        points[8][5];                   // variable sized\r
-} winding_t;\r
-\r
-typedef struct\r
-{\r
-  vec3_t       normal;\r
-  double       dist;\r
-  int          type;\r
-} plane_t;\r
-\r
-// pShader is a shortcut to the shader\r
-// it's only up-to-date after a Brush_Build call\r
-// to initialize the pShader, use QERApp_Shader_ForName(texdef.name)\r
-typedef struct face_s\r
-{\r
-       struct face_s                   *next;\r
-       struct face_s                   *prev;\r
-       struct face_s                   *original;              //used for vertex movement\r
-       vec3_t                                  planepts[3];\r
-       texdef_t                                texdef;\r
-       plane_t                                 plane;\r
-       \r
-       // Nurail: Face Undo\r
-       int                             undoId;\r
-       int                             redoId;\r
-\r
-       winding_t                               *face_winding;\r
-\r
-       vec3_t                                  d_color;\r
-  vec_t           d_shade;\r
-  // calls through here have indirections (pure virtual)\r
-  // it would be good if the rendering loop would avoid scanning there (for the GL binding number for example)\r
-       IShader                                 *pShader;\r
-       //++timo FIXME: remove!\r
-       qtexture_t                              *d_texture;\r
-\r
-       // Timo new brush primit texdef\r
-       brushprimit_texdef_t    brushprimit_texdef;\r
-\r
-       // cast this one to an IPluginTexdef if you are using it\r
-       // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h\r
-       // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?\r
-       void                                    *pData;\r
-} face_t;\r
-\r
-typedef struct {\r
-  vec3_t       xyz;\r
-  float        sideST[2];\r
-  float        capST[2];\r
-} curveVertex_t;\r
-\r
-typedef struct {\r
-  curveVertex_t        v[2];\r
-} sideVertex_t;\r
-\r
-\r
-#define        MIN_PATCH_WIDTH         3\r
-#define        MIN_PATCH_HEIGHT        3\r
-\r
-#define        MAX_PATCH_WIDTH         16\r
-#define        MAX_PATCH_HEIGHT        16\r
-\r
-// patch type info\r
-// type in lower 16 bits, flags in upper\r
-// endcaps directly follow this patch in the list\r
-\r
-// types\r
-#define PATCH_GENERIC     0x00000000    // generic flat patch\r
-#define PATCH_CYLINDER    0x00000001    // cylinder\r
-#define PATCH_BEVEL       0x00000002    // bevel\r
-#define PATCH_ENDCAP      0x00000004    // endcap\r
-#define PATCH_HEMISPHERE  0x00000008    // hemisphere\r
-#define PATCH_CONE        0x00000010    // cone\r
-#define PATCH_TRIANGLE    0x00000020    // simple tri, assumes 3x3 patch\r
-\r
-// behaviour styles\r
-#define PATCH_CAP         0x00001000    // flat patch applied as a cap\r
-#define PATCH_SEAM        0x00002000    // flat patch applied as a seam\r
-#define PATCH_THICK       0x00004000    // patch applied as a thick portion\r
-\r
-// styles\r
-#define PATCH_BEZIER      0x00000000    // default bezier\r
-#define PATCH_BSPLINE     0x10000000    // bspline\r
-\r
-#define PATCH_TYPEMASK     0x00000fff    // \r
-#define PATCH_BTYPEMASK    0x0000f000    // \r
-#define PATCH_STYLEMASK    0xffff0000    // \r
-\r
-typedef struct {\r
-  vec3_t       xyz;\r
-  float                st[2];\r
-  float                lightmap[2];\r
-  vec3_t       normal;\r
-} drawVert_t;\r
-\r
-// spog - used for patch LOD trees\r
-\r
-struct BTNode_t\r
-{\r
-       BTNode_t *left, *right;\r
-       drawVert_t info;\r
-       drawVert_t vMid;\r
-};\r
-\r
-struct BTreeList_t\r
-{\r
-       BTreeList_t *next;\r
-       BTNode_t *pBT;\r
-       drawVert_t vLeft, vRight;\r
-};\r
-\r
-struct BTListList_t\r
-{\r
-       BTListList_t *next;\r
-       BTreeList_t *list;\r
-};\r
-\r
-// used in brush primitive AND entities\r
-typedef struct epair_s\r
-{\r
-  struct epair_s       *next;\r
-  char *key;\r
-  char *value;\r
-} epair_t;\r
-\r
-struct brush_s;\r
-typedef struct brush_s brush_t;\r
-\r
-typedef struct {\r
-  int  width, height;          // in control points, not patches\r
-  int   contents, flags, value, type;\r
-  qtexture_t  *d_texture;\r
-  IShader     *pShader;\r
-  drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];\r
-  brush_t *pSymbiot;\r
-  qboolean bSelected;\r
-  qboolean bOverlay;\r
-  qboolean bDirty;\r
-  int  nListID;\r
-  epair_t *epairs;\r
-  // cast this one to an IPluginTexdef if you are using it\r
-  // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h\r
-  // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?\r
-  void                                 *pData;\r
-  // spog - curve LOD binary trees and lists\r
-  BTNode_t *rowLOD[((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT]; // = ((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT\r
-  BTNode_t *colLOD[((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH]; // = ((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH\r
-  bool rowDirty[((MAX_PATCH_WIDTH-1)-1)/2];\r
-  bool colDirty[((MAX_PATCH_HEIGHT-1)-1)/2];\r
-  bool LODUpdated;\r
-  void *drawLists; // pointer to std::list\r
-} patchMesh_t;\r
-\r
-typedef struct brush_s\r
-{\r
-  struct brush_s       *prev, *next;   // links in active/selected\r
-  struct brush_s       *oprev, *onext; // links in entity\r
-  struct entity_s      *owner;\r
-  vec3_t               mins, maxs;\r
-  face_t                *brush_faces;\r
-\r
-  qboolean bModelFailed;\r
-  //\r
-  // curve brush extensions\r
-  // all are derived from brush_faces\r
-  qboolean     patchBrush;\r
-  qboolean     hiddenBrush;\r
-  \r
-  //int nPatchID;\r
-\r
-  patchMesh_t *pPatch;\r
-  struct entity_s *pUndoOwner;\r
-\r
-  int undoId;                                          //undo ID\r
-  int redoId;                                          //redo ID\r
-  int ownerId;                                 //entityId of the owner entity for undo\r
-\r
-  // TTimo: this is not legal, we are not supposed to put UI toolkit dependant stuff in the interfaces\r
-  // NOTE: the grouping stuff never worked, there is embryonary code everywhere though\r
-  int numberId;\r
-  void* itemOwner; // GtkCTreeNode* ?\r
-\r
-  // brush primitive only\r
-  epair_t *epairs;\r
-\r
-  // brush filtered toggle\r
-  bool bFiltered;\r
-  bool bCamCulled;\r
-  bool bBrushDef;\r
-} brush_t;\r
-\r
-#define        MAX_FLAGS       16\r
-\r
-typedef struct vertmodel_t\r
-{\r
-  float v[3];\r
-  float st[2];\r
-  float normal[3];\r
-} vertmodel;\r
-\r
-typedef struct triindex_t\r
-{\r
-  int indexes[3];\r
-} triindex;\r
-\r
-// TTimo: NOTE: we don't have dedicated stuff to copy/allocate/delete this structure like we do for entity_t and brush_t\r
-//   could be necessary, I'm adding GString *strSkin that needs to be copied around\r
-// TTimo 04/01/2001 removing the GString* for toolkit-independent interfaces .. cast it ..\r
-typedef struct entitymodel_t\r
-{\r
-  struct entitymodel_t *pNext;\r
-  int nTriCount;\r
-  //trimodel *pTriList;\r
-  //md3Triangle_t *pTriList;\r
-  triindex *pTriList;\r
-  vertmodel *pVertList;\r
-  int numVerts;\r
-  int nTextureBind;\r
-  void *strSkin; // toolkit-independent .. cast to a GString*\r
-  int nSkinWidth;\r
-  int nSkinHeight;\r
-  int  nModelPosition;\r
-} entitymodel;\r
-\r
-// eclass show flags\r
-\r
-#define     ECLASS_LIGHT      0x00000001\r
-#define     ECLASS_ANGLE      0x00000002\r
-#define     ECLASS_PATH       0x00000004\r
-#define     ECLASS_MISCMODEL  0x00000008\r
-\r
-#ifdef USEPLUGINENTITIES\r
-#define                ECLASS_PLUGINENTITY 0x00000010\r
-#endif // USEPLUGINENTITIES\r
-\r
-typedef struct eclass_s\r
-{\r
-       struct eclass_s *next;\r
-       char    *name;\r
-       qboolean        fixedsize;\r
-       qboolean        unknown;                // wasn't found in source\r
-       vec3_t  mins, maxs;\r
-       vec3_t  color;\r
-       texdef_t        texdef;\r
-       char    *comments;\r
-       char    flagnames[MAX_FLAGS][32];\r
-\r
-  entitymodel *model;\r
-  char *modelpath;\r
-  //++timo NOTE: I don't know what this is used for exactly. But don't trust it for the real skin paths on models (screws up with long/short path names)\r
-  //++hydra NOTE: this, hopefully, will be used to use specific shaders on the bounding boxes of the eclass instead of a color.\r
-  char *skinpath;\r
-  int   nFrame;\r
-  unsigned int nShowFlags;\r
-\r
-  void*        hPlug;\r
-} eclass_t;\r
-\r
-extern eclass_t        *eclass;\r
-\r
-/*\r
-** window bits\r
-*/\r
-#define        W_CAMERA                  0x0001\r
-#define        W_XY                        0x0002\r
-#define        W_XY_OVERLAY    0x0004\r
-#define        W_Z                                 0x0008\r
-#define        W_TEXTURE                 0x0010\r
-#define        W_Z_OVERLAY             0x0020\r
-#define W_CONSOLE                0x0040\r
-#define W_ENTITY                 0x0080\r
-#define W_CAMERA_IFON 0x0100\r
-#define W_XZ          0x0200  //--| only used for patch vertex manip stuff\r
-#define W_YZ          0x0400  //--|\r
-#define W_GROUP       0x0800 \r
-#define W_MEDIA       0x1000 \r
-#define        W_ALL                   0xFFFFFFFF\r
-\r
-// used in some Drawing routines\r
-enum VIEWTYPE {YZ, XZ, XY};\r
-const char g_AxisName[3] = { 'X', 'Y', 'Z' };\r
-\r
-// dynamically allocated string\r
-class string_t\r
-{\r
-public:\r
-  inline string_t()\r
-  {\r
-    copy("");\r
-  }\r
-  inline string_t(const string_t& other)\r
-  {\r
-    copy(other.m_string);\r
-  }\r
-  inline string_t(const char* string)\r
-  {\r
-    copy(string);\r
-  }\r
-  inline ~string_t()\r
-  {\r
-    destroy();\r
-  }\r
-  inline const string_t& operator=(const string_t& other)\r
-  {\r
-    destroy();\r
-    copy(other.m_string);\r
-    return *this;\r
-  }\r
-  inline const string_t& operator=(const char* string)\r
-  {\r
-    destroy();\r
-    copy(string);\r
-    return *this;\r
-  }\r
-  inline bool operator<(const string_t& other) const\r
-  {\r
-    return compare(other) < 0;\r
-  }\r
-  inline bool operator>(const string_t& other) const\r
-  {\r
-    return compare(other) > 0;\r
-  }\r
-  inline bool operator==(const string_t& other) const\r
-  {\r
-    return compare(other) == 0;\r
-  }\r
-  inline bool operator!=(const string_t& other) const\r
-  {\r
-    return compare(other) != 0;\r
-  }\r
-  inline const char* c_str() const\r
-  {\r
-    return m_string;\r
-  }\r
-private:\r
-  inline void copy(const char* string)\r
-  {\r
-    m_string = new char[strlen(string)+1];\r
-    strcpy(m_string, string);\r
-  }\r
-  inline void destroy()\r
-  {\r
-    delete[] m_string;\r
-  }\r
-  inline int compare(const string_t& other) const\r
-  {\r
-    return strcmp(m_string, other.m_string);\r
-  }\r
-\r
-  char* m_string;\r
-};\r
-\r
-class filetype_t\r
-{\r
-public:\r
-  filetype_t()\r
-    : name(""), pattern("")\r
-  {}\r
-  filetype_t(const char* _name, const char* _pattern)\r
-    : name(_name), pattern(_pattern)\r
-  {}\r
-  const char* name;\r
-  const char* pattern;\r
-};\r
-\r
-\r
-/*\r
-** Outline bits\r
-*/\r
-#define OUTLINE_ZBUF  0x01  // zbuffered outline\r
-#define OUTLINE_BSEL  0x02  // selection overlay\r
-\r
-#ifdef USEPLUGINENTITIES\r
-// forward declare this one\r
-class IPluginEntity;\r
-#endif // USEPLUGINENTITIES\r
-\r
-// MODEL\r
-\r
-class IRender;\r
-class ISelect;\r
-class IEdit;\r
-\r
-// NOTE TTimo about ~entity_interfaces_t\r
-// using constructors / destructors on C structs is bad practice\r
-struct entity_interfaces_t\r
-{\r
-  IRender *pRender;\r
-  ISelect *pSelect;\r
-  IEdit *pEdit;\r
-};\r
-// MODEL END\r
-   \r
-typedef struct entity_s\r
-{\r
-  struct entity_s      *prev, *next;\r
-\r
-  /*!\r
-  \todo can use a brushes list, or the blind data below\r
-  for now, blind data should be interpreted as CPtrArray*, only use in the IMAP API\r
-  */\r
-  brush_t              brushes;                                        // head/tail of list\r
-  void *pData;\r
-\r
-  int                  undoId, redoId, entityId;       // used for undo/redo\r
-  vec3_t               origin;\r
-  eclass_t     *eclass;\r
-  epair_t              *epairs;\r
-  entity_interfaces_t model;\r
-#ifdef USEPLUGINENTITIES\r
-  IPluginEntity *pPlugEnt;\r
-#endif // USEPLUGINENTITIES\r
-\r
-  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=252\r
-  // this is cam code addition?\r
-  vec3_t color;\r
-\r
-       // Arnout: HACK-ish and change for 1.3 (in 1.3 we have a blind data pointer according to TTimo)\r
-       float fLightEnvelope1[3];\r
-       float fLightEnvelope2[2];\r
-} entity_t;\r
-\r
-typedef struct\r
-{\r
-  int     p1, p2;\r
-  face_t   *f1, *f2;\r
-} pedge_t;\r
-\r
-// window system independent camera view code\r
-// NOTE TTimo taken from xy.h\r
-typedef struct\r
-{\r
-  int      width, height;\r
-\r
-  qboolean  timing;\r
-\r
-  vec3_t    origin;  // at center of window\r
-  float            scale;\r
-\r
-  float            topclip, bottomclip;\r
-\r
-  qboolean  d_dirty;\r
-} xy_t;\r
-\r
-// spog - struct used for nodes in filters list\r
-struct bfilter_t //c++ style\r
-{\r
-       bfilter_t       *next;\r
-       int             attribute;              // 1=brush->face->pShader->getName()\r
-                                                       // 2=brush->pPatch->pShader->getFlags()\r
-                                                       // 3=brush->owner->eclass->name\r
-                                                       // 4=brush->owner->eclass->nShowFlags\r
-       int             mask;\r
-       char    *string;\r
-       bool    active;\r
-};\r
-\r
-// djbob: no longer any need to add only to end, versioning removed, it is no longer saved as binary\r
-// IMPORTANT: whenever you update this struct, you need to add the relevant load/save code\r
-// preferences.cpp LoadPref / SavePref\r
-typedef struct\r
-{\r
-  int        iTexMenu;         // nearest, linear, etc\r
-  float            fGamma;               // gamma for textures\r
-  vec3_t    colors[COLOR_LAST];\r
-  int       exclude;\r
-  int       include;\r
-  texdef_t  m_SIIncrement;  // increments for the surface inspector\r
-  texdef_t  m_PIIncrement;  // increments for the patch inspector\r
-  vec3_t    AxisColors[3];  // colors used for X, Y Z axis\r
-                            // these are in the View > Show menu with Show coordinates\r
-  qboolean  show_names;\r
-  qboolean  show_coordinates;\r
-  qboolean  show_angles;\r
-  qboolean  show_outline;\r
-  qboolean  show_axis;\r
-  qboolean  bNoSelectedOutlines;\r
-  bfilter_t    *filters; // FIXME spog - might be better in another location?\r
-  int       iSelectedOutlinesStyle;\r
-} SavedInfo_t;\r
-\r
-typedef enum\r
-{\r
-  sel_brush,\r
-  sel_brush_on,\r
-  sel_brush_off,\r
-  // sel_sticky_brush,\r
-  // sel_face,\r
-  sel_vertex,\r
-  sel_edge,\r
-  sel_singlevertex,\r
-  sel_curvepoint,\r
-  sel_area,\r
-  sel_areatall,\r
-  sel_facets_on,\r
-  sel_facets_off,\r
-} select_t;\r
-\r
-// most of the QE globals are stored in this structure\r
-typedef struct\r
-{\r
-  qboolean  d_showgrid;\r
-  float     d_gridsize;\r
-  qboolean  d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids\r
-       \r
-  int      d_num_entities;\r
-       \r
-  entity_t *d_project_entity;\r
-\r
-  // defines the boundaries of the current work area\r
-  // is used to guess brushes and drop points third coordinate when creating from 2D view\r
-  vec3_t    d_work_min,d_work_max;\r
-  // not stored in registry, default is off\r
-  qboolean     d_show_work;\r
-\r
-  vec3_t       d_points[MAX_POINTS];\r
-  int          d_numpoints;\r
-  pedge_t      d_edges[MAX_EDGES];\r
-  int          d_numedges;\r
-\r
-  int          d_num_move_points;\r
-  float        *d_move_points[4096];\r
-\r
-  qtexture_t   *d_qtextures;\r
-  // used to speedup access, specially in QERApp_Try_Texture_ForName\r
-  // must always be kept up-to-date with d_qtextures*\r
-  //++timo FIXME at some point in the future it would even be better to remove d_qtextures and use this instead\r
-  GHashTable *d_qtexmap;\r
-\r
-  texturewin_t d_texturewin;\r
-\r
-  int         d_pointfile_display_list;\r
-\r
-  xy_t         d_xyOld;\r
-\r
-  SavedInfo_t  d_savedinfo;\r
-       \r
-  int          d_workcount;\r
-       \r
-  // connect entities uses the last two brushes selected\r
-  int           d_select_count;\r
-  brush_t      *d_select_order[2];\r
-  vec3_t       d_select_translate;    // for dragging w/o making new display lists\r
-  select_t     d_select_mode;\r
-       \r
-  int          d_parsed_brushes;\r
-       \r
-  qboolean     show_blocks;\r
-  int                 blockSize;\r
-\r
-  // NOTE TTimo\r
-  // a lot of this data should be in a property bag and available to the other modules through an API\r
-  // this is generated from game configuration and the project settings, and should be still be part of it\r
-       \r
-  // tells if we are internally using brush primitive (texture coordinates and map format)\r
-  // this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" )\r
-  // NOTE: must keep the two ones in sync\r
-  bool         m_bBrushPrimitMode;\r
-\r
-  /*!\r
-  win32: engine full path.\r
-  unix: user home full path + engine dir.\r
-  */\r
-  Str         m_strHomeGame;\r
-  /*!\r
-  cache for m_strHomeGame + mod subdirectory.\r
-  */\r
-  Str         m_strHomeMaps;\r
-\r
-  // used while importing brush data from file or memory buffer\r
-  // tells if conversion between map format and internal preferences ( m_bBrushPrimitMode ) is needed\r
-  qboolean     bNeedConvert;\r
-  qboolean     bOldBrushes;\r
-  qboolean     bPrimitBrushes;\r
-       \r
-  vec3_t       d_vAreaTL;\r
-  vec3_t       d_vAreaBR;\r
-       \r
-  // tells if we are using .INI files for prefs instead of registry\r
-  qboolean     use_ini;\r
-  // even in .INI mode we use the registry for all void* prefs\r
-  char         use_ini_registry[64];\r
-  // disabled all INI / registry read write .. used when shutting down after registry cleanup\r
-  qboolean disable_ini;\r
-       \r
-  // tells we are using a BSP frontend plugin\r
-  qboolean     bBSPFrontendPlugin;\r
-\r
-  // handle to the console log file\r
-  // we use low level I/O to get rid of buffering and have everything on file if we crash\r
-  int hLogFile;\r
-\r
-  qboolean bTextureCompressionSupported; // is texture compression supported by hardware?\r
-  GLint texture_components;\r
-\r
-  // temporary values that should be initialised only once at run-time\r
-  // there are too many uneccessary calls to Sys_QGL_ExtensionSupported\r
-  // NOTE TTimo: those are unused atm (set right, but not used)\r
-  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=623\r
-  bool m_bOpenGLCompressionSupported;\r
-  bool m_bS3CompressionSupported;\r
-  \r
-  // set to true after OpenGL has been initialized and extensions have been tested\r
-  bool m_bOpenGLReady;\r
-\r
-} QEGlobals_t;\r
-\r
-#endif // _QERTYPES_H_\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+// qertypes.h
+//
+// common types
+// merged from brush.h, etc. for plugin support
+//
+#ifndef _QERTYPES_H_
+#define _QERTYPES_H_
+
+#ifdef _WIN32
+#include <wtypes.h>
+#endif
+
+#include <GL/gl.h>
+
+#include "str.h"
+
+#ifdef _WIN32
+#define PATH_MAX 260
+#endif
+
+// HACK glib-2.0
+#define NAME_MAX 255
+
+typedef bool qboolean;
+
+#define        MAXPOINTS       16
+
+// merged from qedefs.h ------
+
+#define        MAX_EDGES       512
+#define        MAX_POINTS      1024
+
+#define        COLOR_TEXTUREBACK         0
+#define        COLOR_GRIDBACK            1
+#define        COLOR_GRIDMINOR           2
+#define        COLOR_GRIDMAJOR           3
+#define        COLOR_CAMERABACK          4
+#define COLOR_ENTITY        5
+#define COLOR_GRIDBLOCK     6
+#define COLOR_GRIDTEXT      7
+#define COLOR_BRUSHES       8
+#define COLOR_SELBRUSHES    9
+#define COLOR_CLIPPER       10
+#define COLOR_VIEWNAME      11
+#define COLOR_SELBRUSHES3D  12
+
+#define COLOR_GRIDMINOR_ALT 13
+#define COLOR_GRIDMAJOR_ALT 14
+
+#define COLOR_LAST          15
+
+// ----------------------------
+
+typedef float vec_t;
+typedef vec_t vec3_t[3];
+
+// turn this on/off to use a static texdef or a memory one
+// THIS MUST BE CONSISTENT throughout a whole build of Radiant / modules / plugins
+// DO_TEXDEF_ALLOC is more memory efficient, but I suspect it to be wacky on win32 / C runtime etc.
+#define DO_TEXDEF_ALLOC 1
+#if DO_TEXDEF_ALLOC
+
+class texdef_t
+{
+private:
+  char *name;
+public:
+  texdef_t()
+  {
+    name = new char[1];
+    name[0] = '\0';
+    shift[0] = 0.0f;
+    shift[1] = 0.0f;
+    rotate = 0.0f;
+    scale[0] = 1.0f;
+    scale[1] = 1.0f;
+    contents = 0;
+    flags = 0;
+    value = 0;
+  }
+  texdef_t(const texdef_t& other)
+  {
+    name = NULL;
+    SetName(other.name);
+    shift[0] = other.shift[0];
+    shift[1] = other.shift[1];
+    rotate = other.rotate;
+    scale[0] = other.scale[0];
+    scale[1] = other.scale[1];
+    contents = other.contents;
+    flags = other.flags;
+    value = other.value;
+  }
+  ~texdef_t()
+  {
+    if (name)
+    {
+      delete []name;
+      name = (char*)NULL;
+    }
+  }
+
+  void SetName(const char *p)
+  {
+    if (name)
+    {
+      delete []name;
+      name = NULL;
+    }
+    if (p)
+    {
+      name = strcpy(new char[strlen(p)+1], p);
+    }
+    else
+    {
+      name = new char[1];
+      name[0] = '\0';
+    }
+  }
+
+  const char * GetName() const
+  {
+    return name;
+  }
+
+  // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..
+  void DropName()
+  {
+    name = NULL;
+    SetName(NULL);
+  }
+
+  texdef_t& operator =(const texdef_t& rhs)
+  {
+    if (&rhs != this)
+    {
+      SetName(rhs.name);
+      shift[0] = rhs.shift[0];
+      shift[1] = rhs.shift[1];
+      rotate = rhs.rotate;
+      scale[0] = rhs.scale[0];
+      scale[1] = rhs.scale[1];
+      contents = rhs.contents;
+      flags = rhs.flags;
+      value = rhs.value;
+    }
+    return *this;
+  }
+       float   shift[2];
+       float   rotate;
+       float   scale[2];
+       int             contents;
+       int             flags;
+       int             value;
+};
+
+#else
+
+// max length of a vfs texture path
+#define QPATH 64
+class texdef_t
+{
+private:
+  char name[QPATH];
+public:
+  texdef_t() { name[0] = '\0'; }
+  ~texdef_t() {  }
+
+  void SetName(const char *p)
+  {
+    strncpy(name, p, QPATH);
+  }
+
+  const char * GetName() const
+  {
+    return name;
+  }
+
+  // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..
+  void DropName()
+  {
+    name[0] = '\0';
+  }
+
+  texdef_t& operator =(const texdef_t& rhs)
+  {
+    if (&rhs != this)
+    {
+      SetName(rhs.name);
+      shift[0] = rhs.shift[0];
+      shift[1] = rhs.shift[1];
+      rotate = rhs.rotate;
+      scale[0] = rhs.scale[0];
+      scale[1] = rhs.scale[1];
+      contents = rhs.contents;
+      flags = rhs.flags;
+      value = rhs.value;
+    }
+    return *this;
+  }
+       float   shift[2];
+       float   rotate;
+       float   scale[2];
+       int             contents;
+       int             flags;
+       int             value;
+};
+
+#endif
+
+// forward declare
+class IShader;
+
+// Timo
+// new brush primitive texdef
+typedef struct brushprimit_texdef_s
+{
+       vec_t   coords[2][3];
+} brushprimit_texdef_t;
+
+// this structure is used in Radiant to reflect the state of the texture window
+// it gives information on current shader and various flags
+class texturewin_t
+{
+public:
+  texturewin_t()
+  {
+  }
+  ~texturewin_t()
+  {
+  }
+       int                     width, height;
+       int                     originy;
+       // add brushprimit_texdef_t for brush primitive coordinates storage
+       brushprimit_texdef_t    brushprimit_texdef;
+       int m_nTotalHeight;
+       // surface plugin, must be casted to a IPluginTexdef*
+       void* pTexdef;
+       texdef_t        texdef;
+       // shader
+       // NOTE: never NULL, initialized in Texture_Init
+       // NOTE: the reference name of the shader is texdef.name (see QERApp_ReloadShaders for an example)
+       IShader *pShader;
+};
+
+#define QER_TRANS     0x00000001
+#define QER_NOCARVE   0x00000002
+#define QER_NODRAW    0x00000004
+#define QER_NONSOLID  0x00000008
+#define QER_WATER     0x00000010
+#define QER_LAVA      0x00000020
+#define QER_FOG       0x00000040
+#define QER_ALPHAFUNC 0x00000080
+#define QER_CULL      0x00000100
+
+
+// describes a GL texture that Radiant uses to represent a shader
+// NOTE: all qtexture_t are stored in a main list at g_qeglobals.d_qtextures
+// shaders have reference couting, but qtexture_t don't (they're way too deep into Radiant)
+typedef struct qtexture_s
+{
+  struct       qtexture_s *next;
+  // name of the texture file (the physical image file we are using)
+  // NOTE: used for lookup, must be unique .. vfs path of the texture, lowercase, NO FILE EXTENSION
+  // ex textures/gothic_wall/iron
+  // NOTE: the "textures/" prefix might seem unnecessary .. but it's better to stick to the vfs name
+  char           name[64];
+  int              width,  height;
+  GLuint               texture_number; // gl bind number (the qtexture_t are usually loaded and binded by the shaders module)
+  vec3_t               color;                      // for flat shade mode
+  qboolean     inuse;                            // true = is present on the level (for the texture browser interface)
+} qtexture_t;
+
+// NOTE: don't trust this definition!
+// you should read float points[..][5]
+// see NewWinding definition
+// WARNING: don't touch anything to this struct unless you looked into winding.cpp and WINDING_SIZE(pt)
+#define MAX_POINTS_ON_WINDING 64
+typedef struct
+{
+  int          numpoints;
+  int          maxpoints;
+  float        points[8][5];                   // variable sized
+} winding_t;
+
+typedef struct
+{
+  vec3_t       normal;
+  double       dist;
+  int          type;
+} plane_t;
+
+// pShader is a shortcut to the shader
+// it's only up-to-date after a Brush_Build call
+// to initialize the pShader, use QERApp_Shader_ForName(texdef.name)
+typedef struct face_s
+{
+       struct face_s                   *next;
+       struct face_s                   *prev;
+       struct face_s                   *original;              //used for vertex movement
+       vec3_t                                  planepts[3];
+       texdef_t                                texdef;
+       plane_t                                 plane;
+       
+       // Nurail: Face Undo
+       int                             undoId;
+       int                             redoId;
+
+       winding_t                               *face_winding;
+
+       vec3_t                                  d_color;
+  vec_t           d_shade;
+  // calls through here have indirections (pure virtual)
+  // it would be good if the rendering loop would avoid scanning there (for the GL binding number for example)
+       IShader                                 *pShader;
+       //++timo FIXME: remove!
+       qtexture_t                              *d_texture;
+
+       // Timo new brush primit texdef
+       brushprimit_texdef_t    brushprimit_texdef;
+
+       // cast this one to an IPluginTexdef if you are using it
+       // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
+       // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
+       void                                    *pData;
+} face_t;
+
+typedef struct {
+  vec3_t       xyz;
+  float        sideST[2];
+  float        capST[2];
+} curveVertex_t;
+
+typedef struct {
+  curveVertex_t        v[2];
+} sideVertex_t;
+
+
+#define        MIN_PATCH_WIDTH         3
+#define        MIN_PATCH_HEIGHT        3
+
+#define        MAX_PATCH_WIDTH         16
+#define        MAX_PATCH_HEIGHT        16
+
+// patch type info
+// type in lower 16 bits, flags in upper
+// endcaps directly follow this patch in the list
+
+// types
+#define PATCH_GENERIC     0x00000000    // generic flat patch
+#define PATCH_CYLINDER    0x00000001    // cylinder
+#define PATCH_BEVEL       0x00000002    // bevel
+#define PATCH_ENDCAP      0x00000004    // endcap
+#define PATCH_HEMISPHERE  0x00000008    // hemisphere
+#define PATCH_CONE        0x00000010    // cone
+#define PATCH_TRIANGLE    0x00000020    // simple tri, assumes 3x3 patch
+
+// behaviour styles
+#define PATCH_CAP         0x00001000    // flat patch applied as a cap
+#define PATCH_SEAM        0x00002000    // flat patch applied as a seam
+#define PATCH_THICK       0x00004000    // patch applied as a thick portion
+
+// styles
+#define PATCH_BEZIER      0x00000000    // default bezier
+#define PATCH_BSPLINE     0x10000000    // bspline
+
+#define PATCH_TYPEMASK     0x00000fff    // 
+#define PATCH_BTYPEMASK    0x0000f000    // 
+#define PATCH_STYLEMASK    0xffff0000    // 
+
+typedef struct {
+  vec3_t       xyz;
+  float                st[2];
+  float                lightmap[2];
+  vec3_t       normal;
+} drawVert_t;
+
+// spog - used for patch LOD trees
+
+struct BTNode_t
+{
+       BTNode_t *left, *right;
+       drawVert_t info;
+       drawVert_t vMid;
+};
+
+struct BTreeList_t
+{
+       BTreeList_t *next;
+       BTNode_t *pBT;
+       drawVert_t vLeft, vRight;
+};
+
+struct BTListList_t
+{
+       BTListList_t *next;
+       BTreeList_t *list;
+};
+
+// used in brush primitive AND entities
+typedef struct epair_s
+{
+  struct epair_s       *next;
+  char *key;
+  char *value;
+} epair_t;
+
+struct brush_s;
+typedef struct brush_s brush_t;
+
+typedef struct {
+  int  width, height;          // in control points, not patches
+  int   contents, flags, value, type;
+  qtexture_t  *d_texture;
+  IShader     *pShader;
+  drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
+  brush_t *pSymbiot;
+  qboolean bSelected;
+  qboolean bOverlay;
+  qboolean bDirty;
+  int  nListID;
+  epair_t *epairs;
+  // cast this one to an IPluginTexdef if you are using it
+  // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
+  // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
+  void                                 *pData;
+  // spog - curve LOD binary trees and lists
+  BTNode_t *rowLOD[((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT]; // = ((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT
+  BTNode_t *colLOD[((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH]; // = ((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH
+  bool rowDirty[((MAX_PATCH_WIDTH-1)-1)/2];
+  bool colDirty[((MAX_PATCH_HEIGHT-1)-1)/2];
+  bool LODUpdated;
+  void *drawLists; // pointer to std::list
+} patchMesh_t;
+
+typedef struct brush_s
+{
+  struct brush_s       *prev, *next;   // links in active/selected
+  struct brush_s       *oprev, *onext; // links in entity
+  struct entity_s      *owner;
+  vec3_t               mins, maxs;
+  face_t                *brush_faces;
+
+  qboolean bModelFailed;
+  //
+  // curve brush extensions
+  // all are derived from brush_faces
+  qboolean     patchBrush;
+  qboolean     hiddenBrush;
+  
+  //int nPatchID;
+
+  patchMesh_t *pPatch;
+  struct entity_s *pUndoOwner;
+
+  int undoId;                                          //undo ID
+  int redoId;                                          //redo ID
+  int ownerId;                                 //entityId of the owner entity for undo
+
+  // TTimo: this is not legal, we are not supposed to put UI toolkit dependant stuff in the interfaces
+  // NOTE: the grouping stuff never worked, there is embryonary code everywhere though
+  int numberId;
+  void* itemOwner; // GtkCTreeNode* ?
+
+  // brush primitive only
+  epair_t *epairs;
+
+  // brush filtered toggle
+  bool bFiltered;
+  bool bCamCulled;
+  bool bBrushDef;
+} brush_t;
+
+#define        MAX_FLAGS       16
+
+typedef struct vertmodel_t
+{
+  float v[3];
+  float st[2];
+  float normal[3];
+} vertmodel;
+
+typedef struct triindex_t
+{
+  int indexes[3];
+} triindex;
+
+// TTimo: NOTE: we don't have dedicated stuff to copy/allocate/delete this structure like we do for entity_t and brush_t
+//   could be necessary, I'm adding GString *strSkin that needs to be copied around
+// TTimo 04/01/2001 removing the GString* for toolkit-independent interfaces .. cast it ..
+typedef struct entitymodel_t
+{
+  struct entitymodel_t *pNext;
+  int nTriCount;
+  //trimodel *pTriList;
+  //md3Triangle_t *pTriList;
+  triindex *pTriList;
+  vertmodel *pVertList;
+  int numVerts;
+  int nTextureBind;
+  void *strSkin; // toolkit-independent .. cast to a GString*
+  int nSkinWidth;
+  int nSkinHeight;
+  int  nModelPosition;
+} entitymodel;
+
+// eclass show flags
+
+#define     ECLASS_LIGHT      0x00000001
+#define     ECLASS_ANGLE      0x00000002
+#define     ECLASS_PATH       0x00000004
+#define     ECLASS_MISCMODEL  0x00000008
+
+#ifdef USEPLUGINENTITIES
+#define                ECLASS_PLUGINENTITY 0x00000010
+#endif // USEPLUGINENTITIES
+
+typedef struct eclass_s
+{
+       struct eclass_s *next;
+       char    *name;
+       qboolean        fixedsize;
+       qboolean        unknown;                // wasn't found in source
+       vec3_t  mins, maxs;
+       vec3_t  color;
+       texdef_t        texdef;
+       char    *comments;
+       char    flagnames[MAX_FLAGS][32];
+
+  entitymodel *model;
+  char *modelpath;
+  //++timo NOTE: I don't know what this is used for exactly. But don't trust it for the real skin paths on models (screws up with long/short path names)
+  //++hydra NOTE: this, hopefully, will be used to use specific shaders on the bounding boxes of the eclass instead of a color.
+  char *skinpath;
+  int   nFrame;
+  unsigned int nShowFlags;
+
+  void*        hPlug;
+} eclass_t;
+
+extern eclass_t        *eclass;
+
+/*
+** window bits
+*/
+#define        W_CAMERA                  0x0001
+#define        W_XY                        0x0002
+#define        W_XY_OVERLAY    0x0004
+#define        W_Z                                 0x0008
+#define        W_TEXTURE                 0x0010
+#define        W_Z_OVERLAY             0x0020
+#define W_CONSOLE                0x0040
+#define W_ENTITY                 0x0080
+#define W_CAMERA_IFON 0x0100
+#define W_XZ          0x0200  //--| only used for patch vertex manip stuff
+#define W_YZ          0x0400  //--|
+#define W_GROUP       0x0800 
+#define W_MEDIA       0x1000 
+#define        W_ALL                   0xFFFFFFFF
+
+// used in some Drawing routines
+enum VIEWTYPE {YZ, XZ, XY};
+const char g_AxisName[3] = { 'X', 'Y', 'Z' };
+
+// dynamically allocated string
+class string_t
+{
+public:
+  inline string_t()
+  {
+    copy("");
+  }
+  inline string_t(const string_t& other)
+  {
+    copy(other.m_string);
+  }
+  inline string_t(const char* string)
+  {
+    copy(string);
+  }
+  inline ~string_t()
+  {
+    destroy();
+  }
+  inline const string_t& operator=(const string_t& other)
+  {
+    destroy();
+    copy(other.m_string);
+    return *this;
+  }
+  inline const string_t& operator=(const char* string)
+  {
+    destroy();
+    copy(string);
+    return *this;
+  }
+  inline bool operator<(const string_t& other) const
+  {
+    return compare(other) < 0;
+  }
+  inline bool operator>(const string_t& other) const
+  {
+    return compare(other) > 0;
+  }
+  inline bool operator==(const string_t& other) const
+  {
+    return compare(other) == 0;
+  }
+  inline bool operator!=(const string_t& other) const
+  {
+    return compare(other) != 0;
+  }
+  inline const char* c_str() const
+  {
+    return m_string;
+  }
+private:
+  inline void copy(const char* string)
+  {
+    m_string = new char[strlen(string)+1];
+    strcpy(m_string, string);
+  }
+  inline void destroy()
+  {
+    delete[] m_string;
+  }
+  inline int compare(const string_t& other) const
+  {
+    return strcmp(m_string, other.m_string);
+  }
+
+  char* m_string;
+};
+
+class filetype_t
+{
+public:
+  filetype_t()
+    : name(""), pattern("")
+  {}
+  filetype_t(const char* _name, const char* _pattern)
+    : name(_name), pattern(_pattern)
+  {}
+  const char* name;
+  const char* pattern;
+};
+
+
+/*
+** Outline bits
+*/
+#define OUTLINE_ZBUF  0x01  // zbuffered outline
+#define OUTLINE_BSEL  0x02  // selection overlay
+
+#ifdef USEPLUGINENTITIES
+// forward declare this one
+class IPluginEntity;
+#endif // USEPLUGINENTITIES
+
+// MODEL
+
+class IRender;
+class ISelect;
+class IEdit;
+
+// NOTE TTimo about ~entity_interfaces_t
+// using constructors / destructors on C structs is bad practice
+struct entity_interfaces_t
+{
+  IRender *pRender;
+  ISelect *pSelect;
+  IEdit *pEdit;
+};
+// MODEL END
+   
+typedef struct entity_s
+{
+  struct entity_s      *prev, *next;
+
+  /*!
+  \todo can use a brushes list, or the blind data below
+  for now, blind data should be interpreted as CPtrArray*, only use in the IMAP API
+  */
+  brush_t              brushes;                                        // head/tail of list
+  void *pData;
+
+  int                  undoId, redoId, entityId;       // used for undo/redo
+  vec3_t               origin;
+  eclass_t     *eclass;
+  epair_t              *epairs;
+  entity_interfaces_t model;
+#ifdef USEPLUGINENTITIES
+  IPluginEntity *pPlugEnt;
+#endif // USEPLUGINENTITIES
+
+  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=252
+  // this is cam code addition?
+  vec3_t color;
+
+       // Arnout: HACK-ish and change for 1.3 (in 1.3 we have a blind data pointer according to TTimo)
+       float fLightEnvelope1[3];
+       float fLightEnvelope2[2];
+} entity_t;
+
+typedef struct
+{
+  int     p1, p2;
+  face_t   *f1, *f2;
+} pedge_t;
+
+// window system independent camera view code
+// NOTE TTimo taken from xy.h
+typedef struct
+{
+  int      width, height;
+
+  qboolean  timing;
+
+  vec3_t    origin;  // at center of window
+  float            scale;
+
+  float            topclip, bottomclip;
+
+  qboolean  d_dirty;
+} xy_t;
+
+// spog - struct used for nodes in filters list
+struct bfilter_t //c++ style
+{
+       bfilter_t       *next;
+       int             attribute;              // 1=brush->face->pShader->getName()
+                                                       // 2=brush->pPatch->pShader->getFlags()
+                                                       // 3=brush->owner->eclass->name
+                                                       // 4=brush->owner->eclass->nShowFlags
+       int             mask;
+       char    *string;
+       bool    active;
+};
+
+// djbob: no longer any need to add only to end, versioning removed, it is no longer saved as binary
+// IMPORTANT: whenever you update this struct, you need to add the relevant load/save code
+// preferences.cpp LoadPref / SavePref
+typedef struct
+{
+  int        iTexMenu;         // nearest, linear, etc
+  float            fGamma;               // gamma for textures
+  vec3_t    colors[COLOR_LAST];
+  int       exclude;
+  int       include;
+  texdef_t  m_SIIncrement;  // increments for the surface inspector
+  texdef_t  m_PIIncrement;  // increments for the patch inspector
+  vec3_t    AxisColors[3];  // colors used for X, Y Z axis
+                            // these are in the View > Show menu with Show coordinates
+  qboolean  show_names;
+  qboolean  show_coordinates;
+  qboolean  show_angles;
+  qboolean  show_outline;
+  qboolean  show_axis;
+  qboolean  bNoSelectedOutlines;
+  bfilter_t    *filters; // FIXME spog - might be better in another location?
+  int       iSelectedOutlinesStyle;
+} SavedInfo_t;
+
+typedef enum
+{
+  sel_brush,
+  sel_brush_on,
+  sel_brush_off,
+  // sel_sticky_brush,
+  // sel_face,
+  sel_vertex,
+  sel_edge,
+  sel_singlevertex,
+  sel_curvepoint,
+  sel_area,
+  sel_areatall,
+  sel_facets_on,
+  sel_facets_off,
+} select_t;
+
+// most of the QE globals are stored in this structure
+typedef struct
+{
+  qboolean  d_showgrid;
+  float     d_gridsize;
+  qboolean  d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids
+       
+  int      d_num_entities;
+       
+  entity_t *d_project_entity;
+
+  // defines the boundaries of the current work area
+  // is used to guess brushes and drop points third coordinate when creating from 2D view
+  vec3_t    d_work_min,d_work_max;
+  // not stored in registry, default is off
+  qboolean     d_show_work;
+
+  vec3_t       d_points[MAX_POINTS];
+  int          d_numpoints;
+  pedge_t      d_edges[MAX_EDGES];
+  int          d_numedges;
+
+  int          d_num_move_points;
+  float        *d_move_points[4096];
+
+  qtexture_t   *d_qtextures;
+  // used to speedup access, specially in QERApp_Try_Texture_ForName
+  // must always be kept up-to-date with d_qtextures*
+  //++timo FIXME at some point in the future it would even be better to remove d_qtextures and use this instead
+  GHashTable *d_qtexmap;
+
+  texturewin_t d_texturewin;
+
+  int         d_pointfile_display_list;
+
+  xy_t         d_xyOld;
+
+  SavedInfo_t  d_savedinfo;
+       
+  int          d_workcount;
+       
+  // connect entities uses the last two brushes selected
+  int           d_select_count;
+  brush_t      *d_select_order[2];
+  vec3_t       d_select_translate;    // for dragging w/o making new display lists
+  select_t     d_select_mode;
+       
+  int          d_parsed_brushes;
+       
+  qboolean     show_blocks;
+  int                 blockSize;
+
+  // NOTE TTimo
+  // a lot of this data should be in a property bag and available to the other modules through an API
+  // this is generated from game configuration and the project settings, and should be still be part of it
+       
+  // tells if we are internally using brush primitive (texture coordinates and map format)
+  // this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" )
+  // NOTE: must keep the two ones in sync
+  bool         m_bBrushPrimitMode;
+
+  /*!
+  win32: engine full path.
+  unix: user home full path + engine dir.
+  */
+  Str         m_strHomeGame;
+  /*!
+  cache for m_strHomeGame + mod subdirectory.
+  */
+  Str         m_strHomeMaps;
+
+  // used while importing brush data from file or memory buffer
+  // tells if conversion between map format and internal preferences ( m_bBrushPrimitMode ) is needed
+  qboolean     bNeedConvert;
+  qboolean     bOldBrushes;
+  qboolean     bPrimitBrushes;
+       
+  vec3_t       d_vAreaTL;
+  vec3_t       d_vAreaBR;
+       
+  // tells if we are using .INI files for prefs instead of registry
+  qboolean     use_ini;
+  // even in .INI mode we use the registry for all void* prefs
+  char         use_ini_registry[64];
+  // disabled all INI / registry read write .. used when shutting down after registry cleanup
+  qboolean disable_ini;
+       
+  // tells we are using a BSP frontend plugin
+  qboolean     bBSPFrontendPlugin;
+
+  // handle to the console log file
+  // we use low level I/O to get rid of buffering and have everything on file if we crash
+  int hLogFile;
+
+  qboolean bTextureCompressionSupported; // is texture compression supported by hardware?
+  GLint texture_components;
+
+  // temporary values that should be initialised only once at run-time
+  // there are too many uneccessary calls to Sys_QGL_ExtensionSupported
+  // NOTE TTimo: those are unused atm (set right, but not used)
+  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=623
+  bool m_bOpenGLCompressionSupported;
+  bool m_bS3CompressionSupported;
+  
+  // set to true after OpenGL has been initialized and extensions have been tested
+  bool m_bOpenGLReady;
+
+} QEGlobals_t;
+
+#endif // _QERTYPES_H_