+struct _QERPointData
+{
+ int m_nCount;
+ vec3_t *m_pVectors;
+};
+
+struct _QERFaceData
+{
+ char m_TextureName[QER_MAX_NAMELEN];
+ int m_nContents;
+ int m_nFlags;
+ int m_nValue;
+ float m_fShift[2];
+ float m_fRotate;
+ float m_fScale[2];
+ vec3_t m_v1, m_v2, m_v3;
+ // brush primitive additions
+ qboolean m_bBPrimit;
+ brushprimit_texdef_t brushprimit_texdef;
+};
+
+typedef void ( WINAPI * PFN_QERAPP_CREATEBRUSH )( vec3_t vMin, vec3_t vMax );
+
+typedef void* ( WINAPI * PFN_QERAPP_CREATEBRUSHHANDLE )();
+typedef void ( WINAPI * PFN_QERAPP_DELETEBRUSHHANDLE )( void* pv );
+typedef void ( WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOMAP )( void* pv );
+typedef void ( WINAPI * PFN_QERAPP_ADDFACE )( void* pv, vec3_t v1, vec3_t v2, vec3_t v3 );
+
+typedef void ( WINAPI * PFN_QERAPP_ADDFACEDATA )( void* pv, _QERFaceData *pData );
+typedef int ( WINAPI * PFN_QERAPP_GETFACECOUNT )( void* pv );
+typedef _QERFaceData* ( WINAPI * PFN_QERAPP_GETFACEDATA )( void* pv, int nFaceIndex );
+typedef void ( WINAPI * PFN_QERAPP_SETFACEDATA )( void* pv, int nFaceIndex, _QERFaceData *pData );
+typedef void ( WINAPI * PFN_QERAPP_DELETEFACE )( void* pv, int nFaceIndex );
+typedef void ( WINAPI * PFN_QERAPP_TEXTUREBRUSH )( void* pv, char* pName );
+typedef void ( WINAPI * PFN_QERAPP_BUILDBRUSH )( void* pv ); // PGM
+typedef void ( WINAPI * PFN_QERAPP_SELECTBRUSH )( void* pv ); // PGM
+typedef void ( WINAPI * PFN_QERAPP_DESELECTBRUSH )( void* pv ); // PGM
+typedef void ( WINAPI * PFN_QERAPP_DESELECTALLBRUSHES )(); // PGM
+
+typedef void ( WINAPI * PFN_QERAPP_DELETESELECTION )();
+typedef void ( WINAPI * PFN_QERAPP_GETPOINTS )( int nMax, _QERPointData *pData, char* pMsg );
+
+typedef int ( WINAPI * PFN_QERAPP_SELECTEDBRUSHCOUNT )();
+typedef int ( WINAPI * PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES )();
+typedef void ( WINAPI * PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES )();
+typedef void* ( WINAPI * PFN_QERAPP_GETSELECTEDBRUSHHANDLE )( int nIndex );
+
+typedef int ( WINAPI * PFN_QERAPP_ACTIVEBRUSHCOUNT )();
+typedef int ( WINAPI * PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES )();
+typedef void ( WINAPI * PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES )();
+typedef void* ( WINAPI * PFN_QERAPP_GETACTIVEBRUSHHANDLE )( int nIndex );
+
+typedef int ( WINAPI * PFN_QERAPP_TEXTURECOUNT )();
+typedef char* ( WINAPI * PFN_QERAPP_GETTEXTURE )( int nIndex );
+typedef char* ( WINAPI * PFN_QERAPP_GETCURRENTTEXTURE )();
+typedef void ( WINAPI * PFN_QERAPP_SETCURRENTTEXTURE )( char* pName );
+
+typedef void ( WINAPI * PFN_QERAPP_REGISTERMAPLOAD )( void* vp );
+typedef void ( WINAPI * PFN_QERAPP_REGISTERMAPSAVE )( void* vp );
+
+typedef int ( WINAPI * PFN_QERAPP_GETECLASSCOUNT )();
+typedef char* ( WINAPI * PFN_QERAPP_GETECLASS )( int nIndex );
+
+typedef void ( WINAPI * PFN_QERAPP_RESETPLUGINS )();
+//--typedef int (WINAPI* PFN_QERAPP_GETENTITYCOUNT)();
+
+/*!
+ \fn LoadTextureRGBA
+ \param pPixels is the raw RGBA pixel data (24bits, 8 bit depth)
+ \param nWidth image width
+ \param nHeight image height
+ this will work from the RGBA data and create a GL texture (accessed through a GL bind number)
+ it takes care of creating the mipmapping levels too
+ */
+typedef qtexture_t* ( *PFN_QERAPP_LOADTEXTURERGBA )( unsigned char* pPixels, int nWidth, int nHeight );
+
+//--typedef LPCSTR (WINAPI* PFN_QERAPP_GETENTITY)(int nIndex);
+
+// v1.70
+typedef int ( WINAPI * PFN_QERAPP_GETENTITYCOUNT )();
+typedef void* ( WINAPI * PFN_QERAPP_GETENTITYHANDLE )( int nIndex );
+// FIXME: those two are fairly outdated, you get the epairs
+// but you don't have a clean epair read/write query
+// and you rely on the C structs directly, which might go away soon
+// ok now, stop using, it's bad for your karma (see iepairs.h instead)
+typedef epair_t* ( WINAPI * PFN_QERAPP_ALLOCATEEPAIR )( const char*, const char* );
+typedef int ( WINAPI * PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES )( void* vp );
+typedef void ( WINAPI * PFN_QERAPP_RELEASEENTITYBRUSHHANDLES )();
+typedef void* ( WINAPI * PFN_QERAPP_GETENTITYBRUSHHANDLE )( int nIndex );
+typedef void* ( WINAPI * PFN_QERAPP_CREATEENTITYHANDLE )();
+typedef void ( WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOENTITY )( void* vpBrush, void* vpEntity );
+typedef void ( WINAPI * PFN_QERAPP_COMMITENTITYHANDLETOMAP )( void* vp );
+typedef void ( WINAPI * PFN_QERAPP_SETSCREENUPDATE )( int bScreenUpdate );
+// this one uses window flags defined in qertypes.h
+typedef void ( WINAPI * PFN_QERAPP_SYSUPDATEWINDOWS )( int bits );
+//++timo remove this one
+typedef void ( WINAPI * PFN_QERAPP_BUILDBRUSH2 )( void* vp, int bConvert );
+
+// v1.80
+typedef void ( WINAPI * PFN_QERAPP_GETDISPATCHPARAMS )( vec3_t vMin, vec3_t vMax, bool *bSingleBrush );
+
+typedef int ( WINAPI * PFN_QERAPP_REQUESTINTERFACE )( REFGUID, void* );
+// use this one for errors, Radiant will stop after the "edit preferences" dialog
+typedef void ( WINAPI * PFN_QERAPP_ERROR )( const char* pMsg, ... );
+// use to gain read access to the project epairs
+// FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface
+// typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **);
+// used to allocate and read a buffer
+//++timo NOTE: perhaps this would need moving to some kind of dedicated interface
+typedef int ( WINAPI * PFN_QERAPP_LOADFILE )( const char *pLocation, void ** buffer );
+typedef char* ( WINAPI * PFN_QERAPP_EXPANDRELETIVEPATH )( char * );
+typedef void ( WINAPI * PFN_QERAPP_QECONVERTDOSTOUNIXNAME )( char *dst, const char *src );
+typedef int ( WINAPI * PFN_QERAPP_HASSHADER )( const char * );
+typedef int ( WINAPI * PFN_QERAPP_TEXTURELOADSKIN )( char *pName, int *pnWidth, int *pnHeight );
+// retrieves the path to the engine from the preferences dialog box
+typedef const char* ( WINAPI * PFN_QERAPP_GETGAMEPATH )();
+// retrieves full Radiant path
+typedef const char* ( WINAPI * PFN_QERAPP_GETQERPATH )();
+// retieves .game name of current active game
+typedef const char* ( WINAPI * PFN_QERAPP_GETGAMEFILE )();
+
+// patches in/out
+// NOTE: this is a bit different from the brushes in/out, no LPVOID handles this time
+// use int indexes instead
+// if you call AllocateActivePatchHandles, you'll be playing with active patches
+// AllocateSelectedPatcheHandles for selected stuff
+// a call to CreatePatchHandle will move you to a seperate index table
+typedef int ( WINAPI * PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES )();
+typedef int ( WINAPI * PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES )();
+typedef void ( WINAPI * PFN_QERAPP_RELEASEPATCHHANDLES )();
+typedef patchMesh_t* ( WINAPI * PFN_QERAPP_GETPATCHDATA )( int );
+typedef patchMesh_t* ( WINAPI * PFN_QERAPP_GETPATCHHANDLE )( int );
+typedef void ( WINAPI * PFN_QERAPP_DELETEPATCH )( int );
+typedef int ( WINAPI * PFN_QERAPP_CREATEPATCHHANDLE )();
+// when commiting, only a few patchMesh_t members are relevant:
+// int width, height; // in control points, not patches
+// int contents, flags, value, type;
+// drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
+// once you have commited the index is still available, if the patch handle was allocated by you
+// then you can re-use the index to commit other patches .. otherwise you can change existing patches
+// NOTE: the handle thing for plugin-allocated patches is a bit silly (nobody's perfect)
+// TODO: change current behaviour to an index = 0 to tell Radiant to allocate, other indexes to existing patches
+// patch is selected after a commit
+// you can add an optional texture / shader name .. if NULL will use the current texture
+typedef void ( WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOMAP )( int, patchMesh_t* pMesh, char *texName );
+typedef void ( WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOENTITY )( int, patchMesh_t* pMesh, char *texName, void* vpEntity );
+
+// console output
+#define SYS_VRB 0 ///< verbose support (on/off)
+#define SYS_STD 1 ///< standard print level - this is the default
+#define SYS_WRN 2 ///< warnings
+#define SYS_ERR 3 ///< error
+#define SYS_NOCON 4 ///< no console, only print to the file (useful whenever Sys_Printf and output IS the problem)
+typedef void ( WINAPI * PFN_QERAPP_SYSPRINTF )( const char *text, ... );
+typedef void ( WINAPI * PFN_QERAPP_SYSFPRINTF )( int flag, const char *text, ... );
+
+typedef void ( WINAPI * PFN_QERAPP_SYSBEGINWAIT )();
+typedef void ( WINAPI * PFN_QERAPP_SYSENDWAIT )();
+
+typedef void ( *PFN_QERAPP_SYSBEEP )();
+
+typedef void ( *PFN_QERAPP_SYSSTATUS )( const char *psz, int part );
+
+// core map functionality
+typedef void ( *PFN_QERAPP_MAPNEW )();
+typedef void ( *PFN_QERAPP_MAPFREE )();
+typedef void ( *PFN_QERAPP_MAPBUILDBRUSHDATA )();
+typedef qboolean ( *PFN_QERAPP_MAPISBRUSHFILTERED )( brush_t * );
+typedef void ( *PFN_QERAPP_MAPSTARTPOSITION )();
+typedef void ( *PFN_QERAPP_MAPREGIONOFF )();
+//typedef void (* PFN_QERAPP_SAVEASDIALOG) (bool bRegion);
+typedef void ( *PFN_QERAPP_SETBUILDWINDINGSNOTEXBUILD )( bool );
+typedef void ( *PFN_QERAPP_POINTFILECLEAR )();
+
+typedef void ( *PFN_QERAPP_SYSSETTITLE )( const char *text );
+
+typedef void ( *PFN_QERAPP_CSGMAKEHOLLOW )();
+
+typedef void ( *PFN_QERAPP_REGIONSPAWNPOINT )( FILE *f );
+
+/*!
+ access to a portable GetTickCount
+ */
+typedef unsigned long ( *PFN_QERAPP_GETTICKCOUNT )();
+
+class IModelCache
+{
+public:
+virtual ~IModelCache() { }
+virtual entity_interfaces_t *GetByID( const char *id, const char* version ) = 0;
+virtual void DeleteByID( const char *id, const char* version ) = 0;
+virtual void RefreshAll() = 0;
+};
+
+typedef IModelCache* ( *PFN_GETMODELCACHE )();
+
+class IFileTypeList