-/*\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
-// QERadiant PlugIns\r
-//\r
-//\r
-\r
-#ifndef __QERPLUGIN_H__\r
-#define __QERPLUGIN_H__\r
-\r
-/*!\r
-\todo this header is intended to be turned into a header for the core editor functionality\r
-some portability related code should be moved to synapse (such as the GUID stuff)\r
-*/\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-// TTimo\r
-// ideally the plugin API would be UI toolkit independent, but removing the dependency with GLib seems tricky right now..\r
-#include <glib.h>\r
-#include "qertypes.h"\r
-\r
-// FIXME TTimo:\r
-// GUID declaration here should be trashed, it is in synapse.h\r
-#ifdef _WIN32\r
-#include <wtypes.h>\r
-#endif\r
-\r
-#define QER_MAX_NAMELEN 1024\r
-\r
-#ifndef _WIN32\r
-#include "misc_def.h"\r
-#endif\r
-\r
-// the editor will look for plugins in two places, the plugins path \r
-// under the application path, and the path under the basepath as defined\r
-// in the project (.qe4) file.\r
-//\r
-// you can drop any number of new texture, model format DLL's in the standard plugin path\r
-// but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc.. \r
-// should be used at one time.. if multiples are loaded then the last one loaded will be the \r
-// active one\r
-//\r
-// type of services the plugin supplies, pass any combo of these flags\r
-// it is assumed the plugin will have a matching function as defined below\r
-// to correlate to the implied functionality\r
-// \r
-\r
-#define RADIANT_MAJOR "radiant"\r
-\r
-// basics\r
-#define QERPLUG_INIT "QERPlug_Init"\r
-#define QERPLUG_GETNAME "QERPlug_GetName"\r
-#define QERPLUG_GETCOMMANDLIST "QERPlug_GetCommandList"\r
-#define QERPLUG_DISPATCH "QERPlug_Dispatch"\r
-#define QERPLUG_GETFUNCTABLE "QERPlug_GetFuncTable"\r
-\r
-// game stuff\r
-#define QERPLUG_GETTEXTUREINFO "QERPlug_GetTextureInfo" // gets a texture info structure\r
-#define QERPLUG_LOADTEXTURE "QERPlug_LoadTexture" // loads a texture, will return an RGBA structure\r
- // and any surface flags/contents for it\r
-#define QERPLUG_GETSURFACEFLAGS "QERPlug_GetSurfaceFlags" // gets a list of surface/content flag names from a plugin\r
-\r
-struct _QERTextureInfo\r
-{\r
- char m_TextureExtension[QER_MAX_NAMELEN]; // the extension these textures have\r
- qboolean m_bHiColor; // if textures are NOT high color, the default \r
- // palette (as described inthe qe4 file will be used for gamma correction)\r
- // if they are high color, gamma and shading are computed on the fly \r
- // based on the rgba data\r
- //--bool m_bIsShader; // will probably do q3 shaders this way when i merge\r
- qboolean m_bWadStyle; // if this is true, the plugin will be presented with the texture path\r
- // defined in the .qe4 file and is expected to preload all the textures\r
- qboolean m_bHalfLife; // causes brushes to be saved/parsed without the surface contents/flags/value\r
-};\r
-\r
-struct _QERTextureLoad // returned by a plugin\r
-{\r
- _QERTextureLoad()\r
- { \r
- memset(reinterpret_cast<void*>(this), 0, sizeof(_QERTextureLoad));\r
- };\r
-\r
- ~_QERTextureLoad()\r
- {\r
- delete []m_pRGBA;\r
- delete []m_pName;\r
- };\r
-\r
- void makeSpace(int nSize)\r
- {\r
- m_pRGBA = new unsigned char[nSize+1];\r
- };\r
-\r
- void setName(const char* p)\r
- {\r
- m_pName = new char[strlen(p)+1];\r
- strcpy(m_pName, p);\r
- };\r
-\r
-\r
- unsigned char *m_pRGBA; // rgba data (alpha channel is supported and drawn appropriately)\r
- int m_nWidth; // width\r
- int m_nHeight; // height\r
- int m_nContents; // default contents\r
- int m_nFlags; // "" flags\r
- int m_nValue; // "" value\r
- char *m_pName; // name to be referenced in map, build tools, etc.\r
-};\r
-\r
-struct _QERModelInfo\r
-{\r
- char m_ModelExtension[QER_MAX_NAMELEN];\r
- bool m_bSkinned;\r
- bool m_bMultipart;\r
-};\r
-\r
-struct _QERModelLoad\r
-{\r
- // vertex and skin data\r
-};\r
-\r
-\r
-//=========================================\r
-// plugin functions\r
-#if 0\r
-// NOTE TTimo: hack to make old plugin tech and new plugin tech live together\r
-#ifndef _IPLUGIN_H_\r
-// toolkit-independant interface, cast hwndMain to GtkWidget*\r
-typedef const char* (WINAPI *PFN_QERPLUG_INIT)(void* hApp, void* hwndMain);\r
-typedef const char* (WINAPI *PFN_QERPLUG_GETNAME)();\r
-typedef const char* (WINAPI *PFN_QERPLUG_GETCOMMANDLIST)();\r
-typedef void (WINAPI *PFN_QERPLUG_DISPATCH)(const char* p, vec3_t vMin, vec3_t vMax, bool bSingleBrush);\r
-#endif\r
-#endif\r
-\r
-typedef char* (WINAPI *PFN_QERPLUG_GETFUNCTABLE)();\r
-\r
-// v1.5\r
-//\r
-// Texture loading\r
-// returns a ptr to _QERTextureInfo\r
-typedef void* (WINAPI *PFN_QERPLUG_GETTEXTUREINFO)();\r
-//\r
-// loads a texture by calling the texture load func in the editor (defined below)\r
-// transparency (for water, fog, lava, etc.. ) can be emulated in the editor\r
-// by passing in appropriate alpha data or by setting the appropriate surface flags\r
-// expected by q2 (which the editor will use.. )\r
-typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename); \r
-\r
-// v1.6\r
-typedef void* (WINAPI *PFN_QERPLUG_GETSURFACEFLAGS)();\r
-\r
-// v1.7\r
-// if exists in plugin, gets called between INIT and GETCOMMANDLIST\r
-// the plugin can register the EClasses he wants to handle\r
-//++timo TODO: this has got to move into the table, and be requested by QERPlug_RequestInterface\r
-//++timo FIXME: the LPVOID parameter must be casted to an IEpair interface\r
-#define QERPLUG_REGISTERPLUGINENTITIES "QERPlug_RegisterPluginEntities"\r
-typedef void (WINAPI * PFN_QERPLUG_REGISTERPLUGINENTITIES)( void* );\r
-\r
-// if exists in plugin, gets called between INIT and GETCOMMANDLIST\r
-// the plugin can Init all it needs for surface properties\r
-#define QERPLUG_INITSURFACEPROPERTIES "QERPlug_InitSurfaceProperties"\r
-typedef void (WINAPI * PFN_QERPLUG_INITSURFACEPROPERTIES)();\r
-\r
-// if Radiant needs to use a particular set of commands, it can request the plugin to fill a func table\r
-// this is similar to PFN_QERAPP_REQUESTINTERFACE\r
-#define QERPLUG_REQUESTINTERFACE "QERPlug_RequestInterface"\r
-typedef int (WINAPI * PFN_QERPLUG_REQUESTINTERFACE) (REFGUID refGUID, void* pInterface, const char *version_name);\r
-\r
-// Load an image file\r
-typedef void (* PFN_QERAPP_LOADIMAGE) (const char *name, unsigned char **pic, int *width, int *height);\r
-\r
-// TTimo FIXME: the logic for this is in synapse now\r
-\r
-// MODULES specific:\r
-// if it exports this entry point, will be considered as a module\r
-// a module is a plugin that provides some REQUIRED interfaces to Radiant, such as the shader module\r
-// Radiant will call QERPLUG_LISTINTERFACES to get a list of the interfaces a given plugin implements\r
-// then it will call PFN_QERPLUG_REQUESTINTERFACE to actually get them\r
-\r
-// following leo's code .. looks ok to use a string to identify the various versions of a same interface\r
-// obviously it would be handy to have the same string naming for the interfaces.\r
-// best way would be to have the names come in when you list the interfaces\r
-// NOTE: we might have a problem with the order in which the interfaces are filled in\r
-// there's some kind of dependency graph, the shader module expects to find the VFS ready etc.\r
-typedef struct moduleentry_s {\r
- const GUID *interface_GUID;\r
- const char* interface_name;\r
- const char* version_name; \r
-} moduleentry_t;\r
-\r
-#define QERPLUG_LISTINTERFACES "QERPlug_ListInterfaces"\r
-#define MAX_QERPLUG_INTERFACES 10\r
-typedef int (WINAPI* PFN_QERPLUG_LISTINTERFACES) (moduleentry_t table[MAX_QERPLUG_INTERFACES]);\r
-\r
-// ========================================\r
-// GTK+ helper functions\r
-\r
-// NOTE: parent can be NULL in all functions but it's best to set them\r
-\r
-// simple Message Box, see above for the 'type' flags\r
-// toolkit-independent, cast parent ot a GtkWidget*\r
-typedef gint (WINAPI* PFN_QERAPP_MESSAGEBOX) (void *parent, const char* text,\r
- const char* caption, guint32 type, const char *URL);\r
-\r
-// file and directory selection functions return NULL if the user hits cancel\r
-// or a gchar* string that must be g_free'd by the user\r
-// - 'title' is the dialog title (can be NULL)\r
-// - 'path' is used to set the initial directory (can be NULL)\r
-// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples\r
-// TTimo 04/01/2001 toolkit-independant, cast parent to a GtkWidget*\r
-typedef const gchar* (* PFN_QERAPP_FILEDIALOG) (void *parent, gboolean open, const char* title,\r
- const char* path, const char* pattern);\r
-typedef gchar* (WINAPI* PFN_QERAPP_DIRDIALOG) (void *parent, const char* title,\r
- const char* path);\r
-\r
-// return true if the user closed the dialog with 'Ok'\r
-// 'color' is used to set the initial value and store the selected value\r
-typedef bool (WINAPI* PFN_QERAPP_COLORDIALOG) (void *parent, float *color,\r
- const char* title);\r
-\r
-// load a .bmp file and store the results in 'gdkpixmap' and 'mask'\r
-// returns TRUE on success but even if it fails, it creates an empty pixmap\r
-// NOTE: 'filename' is relative to <radiant_path>/plugins/bitmaps/\r
-// TTimo 04/01/2001 toolkit-independant, cast gkpixmap to GdkPixmap and mask to GdkBitmap\r
-typedef bool (WINAPI* PFN_QERAPP_LOADBITMAP) (const char* filename, void **gdkpixmap, void **mask);\r
-\r
-// ========================================\r
-// read/write preferences file\r
-\r
-// use this function to get the directory where the preferences file are stored\r
-typedef const char* (WINAPI* PFN_QERAPP_PROFILE_GETDIR) ();\r
-\r
-// 'filename' is the absolute path\r
-typedef bool (WINAPI* PFN_QERAPP_PROFILE_SAVEINT) (const char *filename, const char *section,\r
- const char *key, int value);\r
-typedef bool (WINAPI* PFN_QERAPP_PROFILE_SAVESTR) (const char *filename, const char *section,\r
- const char *key, const char *value);\r
-typedef int (WINAPI* PFN_QERAPP_PROFILE_LOADINT) (const char *filename, const char *section,\r
- const char *key, int default_value);\r
-typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const char *section,\r
- const char *key, const char *default_value);\r
-\r
-//=========================================\r
-// editor functions\r
-\r
-// There are 3 potential brush handle lists\r
-// 1. the list that contains brushes a plugin creates using CreateBrushHandle\r
-// 2. the selected brush list (brushes the user has selected)\r
-// 3. the active brush list (brushes in the map that are not selected)\r
-// \r
-// In general, the same things can be done to brush handles (face manip, delete brushhandle, etc.. ) in each\r
-// list. There are a few exceptions. \r
-// 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map. \r
-// 2. You cannot bind brush handles from the selected or active brush list to an entity. As of v1.0 of the plugins\r
-// the only way for a plugin to create entities is to create a brush handles (or a list of handles) and then bind\r
-// them to an entity. This will commit the brush(s) and/or the entities to the map as well.\r
-// \r
-// To use the active or selected brush lists, you must first allocate them (which returns a count) and then\r
-// release them when you are finish manipulating brushes in one of those lists. \r
-\r
-//++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor\r
-#if 0\r
-// brush manipulation routines\r
-#define QERAPP_CREATEBRUSH "QERApp_CreateBrush"\r
-#define QERAPP_CREATEBRUSHHANDLE "QERApp_CreateBrushHandle"\r
-#define QERAPP_DELETEBRUSHHANDLE "QERApp_DeleteBrushHandle"\r
-#define QERAPP_COMMITBRUSHHANDLETOMAP "QERApp_CommitBrushHandleToMap"\r
-//++timo not implemented .. remove\r
-// #define QERAPP_BINDHANDLESTOENTITY "QERApp_BindHandlesToEntity"\r
-#define QERAPP_ADDFACE "QERApp_AddFace"\r
-#define QERAPP_ADDFACEDATA "QERApp_AddFaceData"\r
-#define QERAPP_GETFACECOUNT "QERApp_GetFaceCount"\r
-#define QERAPP_GETFACEDATA "QERApp_GetFaceData"\r
-#define QERAPP_SETFACEDATA "QERApp_SetFaceData"\r
-#define QERAPP_DELETEFACE "QERApp_DeleteFace"\r
-#define QERAPP_TEXTUREBRUSH "QERApp_TextureBrush"\r
-#define QERAPP_BUILDBRUSH "QERApp_BuildBrush" // PGM\r
-#define QERAPP_SELECTEDBRUSHCOUNT "QERApp_SelectedBrushCount"\r
-#define QERAPP_ALLOCATESELECTEDBRUSHHANDLES "QERApp_AllocateSelectedBrushHandles"\r
-#define QERAPP_RELEASESELECTEDBRUSHHANDLES "QERApp_ReleaseSelectedBrushHandles"\r
-#define QERAPP_GETSELECTEDBRUSHHANDLE "QERApp_GetSelectedBrushHandle"\r
-#define QERAPP_ACTIVEBRUSHCOUNT "QERApp_ActiveBrushCount"\r
-#define QERAPP_ALLOCATEACTIVEBRUSHHANDLES "QERApp_AllocateActiveBrushHandles"\r
-#define QERAPP_RELEASEACTIVEBRUSHHANDLES "QERApp_ReleaseActiveBrushHandles"\r
-#define QERAPP_GETACTIVEBRUSHHANDLE "QERApp_GetActiveBrushHandle"\r
-\r
-// texture stuff\r
-#define QERAPP_TEXTURECOUNT "QERApp_TextureCount"\r
-#define QERAPP_GETTEXTURE "QERApp_GetTexture"\r
-#define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture"\r
-#define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture"\r
-\r
-// selection \r
-#define QERAPP_DELETESELECTION "QERApp_DeleteSelection"\r
-#define QERAPP_SELECTBRUSH "QERApp_SelectBrush" // PGM\r
-#define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush" // PGM\r
-#define QERAPP_DESELECTALLBRUSHES "QERApp_DeselectAllBrushes" // PGM\r
-\r
-// data gathering\r
-#define QERAPP_GETPOINTS "QERApp_GetPoints"\r
-#define QERAPP_SELECTBRUSHES "QERApp_GetBrushes"\r
-\r
-// entity class stuff\r
-// the entity handling is very basic for 1.0\r
-#define QERAPP_GETECLASSCOUNT "QERApp_GetEClassCount"\r
-#define QERAPP_GETECLASS "QERApp_GetEClass"\r
-\r
-// misc\r
-#define QERAPP_SYSMSG "QERApp_SysMsg"\r
-#define QERAPP_INFOMSG "QERApp_InfoMsg"\r
-#define QERAPP_HIDEINFOMSG "QERApp_HideInfoMsg"\r
-#define QERAPP_RESET_PLUGINS "QERApp_ResetPlugins"\r
-\r
-// texture loading\r
-#define QERAPP_LOADTEXTURERGBA "QERApp_LoadTextureRGBA"\r
-\r
-// FIXME: the following are not implemented yet\r
-// hook registrations\r
-#define QERAPP_REGISTER_MAPLOADFUNC "QERApp_Register_MapLoadFunc"\r
-#define QERAPP_REGISTER_MAPSAVEFUNC "QERApp_Register_MapSaveFunc"\r
-\r
-// FIXME: the following are not implemented yet\r
-#define QERAPP_REGISTER_PROJECTLOADFUNC "QERApp_Register_ProjectLoadFunc"\r
-#define QERAPP_REGISTER_MOUSEHANDLER "QERApp_Register_MouseHandler"\r
-#define QERAPP_REGISTER_KEYHANDLER "QERApp_Register_KeyHandler"\r
-\r
-// FIXME: new primtives do not work in v1.00\r
-// primitives are new types of things in the map\r
-// for instance, the Q3 curves could have been done as \r
-// primitives instead of being built in \r
-// it will be a plugins responsibility to hook the map load and save funcs to load\r
-// and/or save any additional data (like new primitives of some type)\r
-// the editor will call each registered renderer during the rendering process to repaint\r
-// any primitives the plugin owns\r
-// each primitive object has a temporary sibling brush that lives in the map\r
-// FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner\r
-// basically a plugin will hook the map load and save and will add the primitives to the map.. this will\r
-// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the \r
-// edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex\r
-// mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler\r
-// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the \r
-// sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives\r
-// as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check\r
-// here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that\r
-// crap but it looks like a nice place for a mess)\r
-#define QERAPP_REGISTER_PRIMITIVE "QERApp_Register_Primitive"\r
-#define QERAPP_REGISTER_RENDERER "QERApp_Register_Renderer"\r
-#define QERAPP_REGISTER_EDITHANDLER "QERApp_Register_EditHandler"\r
-#define QERAPP_REGISTER_VERTEXMAKER "QERApp_Register_VertexMaker"\r
-#define QERAPP_ADDPRIMITIVE "QERApp_AddPrimitive"\r
-\r
-// v1.70\r
-#define QERAPP_GETENTITYCOUNT "QERApp_GetEntityCount"\r
-#define QERAPP_GETENTITYHANDLE "QERApp_GetEntityHandle"\r
-//++timo not implemented for the moment\r
-// #define QERAPP_GETENTITYINFO "QERApp_GetEntityInfo"\r
-//++timo does the keyval need some more funcs to add/remove ?\r
-// get the pointer and do the changes yourself\r
-#define QERAPP_ALLOCATEEPAIR "QERApp_AllocateEpair"\r
-#define QERAPP_ALLOCATEENTITYBRUSHHANDLES "QERApp_AllocateEntityBrushHandles"\r
-#define QERAPP_RELEASEENTITYBRUSHHANDLES "QERApp_ReleaseEntityBrushHandles"\r
-#define QERAPP_GETENTITYBRUSHHANDLE "QERApp_GetEntityBrushHandle"\r
-#define QERAPP_CREATEENTITYHANDLE "QERApp_CreateEntityHandle"\r
-#define QERAPP_COMMITBRUSHHANDLETOENTITY "QERApp_CommitBrushHandleToEntity"\r
-#define QERAPP_COMMITENTITYHANDLETOMAP "QERApp_CommitEntityHandleToMap"\r
-#define QERAPP_SETSCREENUPDATE "QERApp_SetScreenUpdate"\r
-#define QERAPP_BUILDBRUSH2 "QERApp_BuildBrush2"\r
-#endif\r
-\r
-// v1.80\r
-#define QERAPP_GETDISPATCHPARAMS "QERApp_GetDispatchParams"\r
-\r
-struct _QERPointData\r
-{\r
- int m_nCount;\r
- vec3_t *m_pVectors;\r
-};\r
-\r
-struct _QERFaceData\r
-{\r
- char m_TextureName[QER_MAX_NAMELEN];\r
- int m_nContents;\r
- int m_nFlags;\r
- int m_nValue;\r
- float m_fShift[2];\r
- float m_fRotate;\r
- float m_fScale[2];\r
- vec3_t m_v1, m_v2, m_v3;\r
- // brush primitive additions\r
- qboolean m_bBPrimit;\r
- brushprimit_texdef_t brushprimit_texdef;\r
-};\r
-\r
-typedef void (WINAPI * PFN_QERAPP_CREATEBRUSH)(vec3_t vMin, vec3_t vMax);\r
-\r
-typedef void* (WINAPI * PFN_QERAPP_CREATEBRUSHHANDLE)();\r
-typedef void (WINAPI * PFN_QERAPP_DELETEBRUSHHANDLE)(void* pv);\r
-typedef void (WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOMAP)(void* pv);\r
-typedef void (WINAPI * PFN_QERAPP_ADDFACE)(void* pv, vec3_t v1, vec3_t v2, vec3_t v3);\r
-\r
-typedef void (WINAPI * PFN_QERAPP_ADDFACEDATA)(void* pv, _QERFaceData *pData);\r
-typedef int (WINAPI * PFN_QERAPP_GETFACECOUNT)(void* pv);\r
-typedef _QERFaceData* (WINAPI * PFN_QERAPP_GETFACEDATA)(void* pv, int nFaceIndex);\r
-typedef void (WINAPI * PFN_QERAPP_SETFACEDATA)(void* pv, int nFaceIndex, _QERFaceData *pData);\r
-typedef void (WINAPI * PFN_QERAPP_DELETEFACE)(void* pv, int nFaceIndex);\r
-typedef void (WINAPI * PFN_QERAPP_TEXTUREBRUSH)(void* pv, char* pName);\r
-typedef void (WINAPI * PFN_QERAPP_BUILDBRUSH)(void* pv); // PGM\r
-typedef void (WINAPI * PFN_QERAPP_SELECTBRUSH)(void* pv); // PGM\r
-typedef void (WINAPI * PFN_QERAPP_DESELECTBRUSH)(void* pv); // PGM\r
-typedef void (WINAPI * PFN_QERAPP_DESELECTALLBRUSHES)(); // PGM\r
-\r
-typedef void (WINAPI * PFN_QERAPP_DELETESELECTION)();\r
-typedef void (WINAPI * PFN_QERAPP_GETPOINTS)(int nMax, _QERPointData *pData, char* pMsg);\r
-\r
-typedef int (WINAPI * PFN_QERAPP_SELECTEDBRUSHCOUNT)();\r
-typedef int (WINAPI * PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES)();\r
-typedef void (WINAPI * PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES)();\r
-typedef void* (WINAPI * PFN_QERAPP_GETSELECTEDBRUSHHANDLE)(int nIndex);\r
-\r
-typedef int (WINAPI * PFN_QERAPP_ACTIVEBRUSHCOUNT)();\r
-typedef int (WINAPI * PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES)();\r
-typedef void (WINAPI * PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES)();\r
-typedef void* (WINAPI * PFN_QERAPP_GETACTIVEBRUSHHANDLE)(int nIndex);\r
-\r
-typedef int (WINAPI * PFN_QERAPP_TEXTURECOUNT)();\r
-typedef char* (WINAPI * PFN_QERAPP_GETTEXTURE)(int nIndex);\r
-typedef char* (WINAPI * PFN_QERAPP_GETCURRENTTEXTURE)();\r
-typedef void (WINAPI * PFN_QERAPP_SETCURRENTTEXTURE)(char* pName);\r
-\r
-typedef void (WINAPI * PFN_QERAPP_REGISTERMAPLOAD)(void* vp);\r
-typedef void (WINAPI * PFN_QERAPP_REGISTERMAPSAVE)(void* vp);\r
-\r
-typedef int (WINAPI * PFN_QERAPP_GETECLASSCOUNT)();\r
-typedef char* (WINAPI * PFN_QERAPP_GETECLASS)(int nIndex);\r
-\r
-typedef void (WINAPI * PFN_QERAPP_RESETPLUGINS)();\r
-//--typedef int (WINAPI* PFN_QERAPP_GETENTITYCOUNT)();\r
-\r
-/*!\r
-\fn LoadTextureRGBA\r
-\param pPixels is the raw RGBA pixel data (24bits, 8 bit depth)\r
-\param nWidth image width\r
-\param nHeight image height\r
-this will work from the RGBA data and create a GL texture (accessed through a GL bind number)\r
-it takes care of creating the mipmapping levels too\r
-see http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=575 for some related issues\r
-*/\r
-typedef qtexture_t* (* PFN_QERAPP_LOADTEXTURERGBA)(unsigned char* pPixels, int nWidth, int nHeight);\r
-\r
-//--typedef LPCSTR (WINAPI* PFN_QERAPP_GETENTITY)(int nIndex);\r
-\r
-// v1.70\r
-typedef int (WINAPI * PFN_QERAPP_GETENTITYCOUNT)();\r
-typedef void* (WINAPI * PFN_QERAPP_GETENTITYHANDLE)(int nIndex);\r
-// FIXME: those two are fairly outdated, you get the epairs\r
-// but you don't have a clean epair read/write query\r
-// and you rely on the C structs directly, which might go away soon\r
-// ok now, stop using, it's bad for your karma (see iepairs.h instead)\r
-typedef epair_t* (WINAPI * PFN_QERAPP_ALLOCATEEPAIR)( char*, char* );\r
-typedef int (WINAPI * PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES)(void* vp);\r
-typedef void (WINAPI * PFN_QERAPP_RELEASEENTITYBRUSHHANDLES)();\r
-typedef void* (WINAPI * PFN_QERAPP_GETENTITYBRUSHHANDLE)(int nIndex);\r
-typedef void* (WINAPI * PFN_QERAPP_CREATEENTITYHANDLE)();\r
-typedef void (WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOENTITY)( void* vpBrush, void* vpEntity);\r
-typedef void (WINAPI * PFN_QERAPP_COMMITENTITYHANDLETOMAP)(void* vp);\r
-typedef void (WINAPI * PFN_QERAPP_SETSCREENUPDATE)(int bScreenUpdate);\r
-// this one uses window flags defined in qertypes.h\r
-typedef void (WINAPI * PFN_QERAPP_SYSUPDATEWINDOWS)(int bits);\r
-//++timo remove this one\r
-typedef void (WINAPI * PFN_QERAPP_BUILDBRUSH2)(void* vp, int bConvert);\r
-\r
-// v1.80\r
-typedef void (WINAPI * PFN_QERAPP_GETDISPATCHPARAMS)(vec3_t vMin, vec3_t vMax, bool *bSingleBrush);\r
-\r
-typedef int (WINAPI * PFN_QERAPP_REQUESTINTERFACE)( REFGUID, void* );\r
-// use this one for errors, Radiant will stop after the "edit preferences" dialog\r
-typedef void (WINAPI * PFN_QERAPP_ERROR)(char* pMsg, ...);\r
-// use to gain read access to the project epairs\r
-// FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface\r
-// typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **);\r
-// used to allocate and read a buffer\r
-//++timo NOTE: perhaps this would need moving to some kind of dedicated interface\r
-typedef int (WINAPI * PFN_QERAPP_LOADFILE)(const char *pLocation, void ** buffer);\r
-typedef char* (WINAPI * PFN_QERAPP_EXPANDRELETIVEPATH)(char *);\r
-typedef void (WINAPI * PFN_QERAPP_QECONVERTDOSTOUNIXNAME)( char *dst, const char *src );\r
-typedef int (WINAPI * PFN_QERAPP_HASSHADER)(const char *);\r
-typedef int (WINAPI * PFN_QERAPP_TEXTURELOADSKIN)(char *pName, int *pnWidth, int *pnHeight);\r
-// retrieves the path to the engine from the preferences dialog box\r
-typedef const char* (WINAPI * PFN_QERAPP_GETGAMEPATH)();\r
-// retrieves full Radiant path\r
-typedef const char* (WINAPI * PFN_QERAPP_GETQERPATH)();\r
-// retieves .game name of current active game\r
-typedef const char* (WINAPI * PFN_QERAPP_GETGAMEFILE)();\r
-\r
-// patches in/out\r
-// NOTE: this is a bit different from the brushes in/out, no LPVOID handles this time\r
-// use int indexes instead\r
-// if you call AllocateActivePatchHandles, you'll be playing with active patches\r
-// AllocateSelectedPatcheHandles for selected stuff\r
-// a call to CreatePatchHandle will move you to a seperate index table\r
-typedef int (WINAPI * PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES) ();\r
-typedef int (WINAPI * PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES) ();\r
-typedef void (WINAPI * PFN_QERAPP_RELEASEPATCHHANDLES) ();\r
-typedef patchMesh_t* (WINAPI * PFN_QERAPP_GETPATCHDATA) (int);\r
-typedef patchMesh_t* (WINAPI * PFN_QERAPP_GETPATCHHANDLE) (int);\r
-typedef void (WINAPI * PFN_QERAPP_DELETEPATCH) (int);\r
-typedef int (WINAPI * PFN_QERAPP_CREATEPATCHHANDLE) ();\r
-// when commiting, only a few patchMesh_t members are relevant:\r
-// int width, height; // in control points, not patches\r
-// int contents, flags, value, type;\r
-// drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];\r
-// once you have commited the index is still available, if the patch handle was allocated by you\r
-// then you can re-use the index to commit other patches .. otherwise you can change existing patches\r
-// NOTE: the handle thing for plugin-allocated patches is a bit silly (nobody's perfect)\r
-// TODO: change current behaviour to an index = 0 to tell Radiant to allocate, other indexes to existing patches\r
-// patch is selected after a commit\r
-// you can add an optional texture / shader name .. if NULL will use the current texture\r
-typedef void (WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOMAP) (int, patchMesh_t* pMesh, char *texName);\r
-typedef void (WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOENTITY) (int, patchMesh_t* pMesh, char *texName, void* vpEntity);\r
-\r
-// console output\r
-#define SYS_VRB 0 ///< verbose support (on/off)\r
-#define SYS_STD 1 ///< standard print level - this is the default\r
-#define SYS_WRN 2 ///< warnings\r
-#define SYS_ERR 3 ///< error\r
-#define SYS_NOCON 4 ///< no console, only print to the file (useful whenever Sys_Printf and output IS the problem)\r
-typedef void (WINAPI* PFN_QERAPP_SYSPRINTF) (const char *text, ...);\r
-typedef void (WINAPI* PFN_QERAPP_SYSFPRINTF) (int flag, const char *text, ...);\r
-\r
-typedef void (WINAPI* PFN_QERAPP_SYSBEGINWAIT) ();\r
-typedef void (WINAPI* PFN_QERAPP_SYSENDWAIT) ();\r
-\r
-typedef void (* PFN_QERAPP_SYSBEEP) ();\r
-\r
-typedef void (* PFN_QERAPP_SYSSTATUS) (const char *psz, int part );\r
-\r
-// core map functionality\r
-typedef void (* PFN_QERAPP_MAPNEW) ();\r
-typedef void (* PFN_QERAPP_MAPFREE) ();\r
-typedef void (* PFN_QERAPP_MAPBUILDBRUSHDATA) ();\r
-typedef qboolean (* PFN_QERAPP_MAPISBRUSHFILTERED) (brush_t *);\r
-typedef void (* PFN_QERAPP_MAPSTARTPOSITION) ();\r
-typedef void (* PFN_QERAPP_MAPREGIONOFF) ();\r
-//typedef void (* PFN_QERAPP_SAVEASDIALOG) (bool bRegion);\r
-typedef void (* PFN_QERAPP_SETBUILDWINDINGSNOTEXBUILD) (bool);\r
-typedef void (* PFN_QERAPP_POINTFILECLEAR) ();\r
-\r
-typedef void (* PFN_QERAPP_SYSSETTITLE) (const char *text);\r
-\r
-typedef void (* PFN_QERAPP_CSGMAKEHOLLOW) ();\r
-\r
-typedef void (* PFN_QERAPP_REGIONSPAWNPOINT) (FILE *f);\r
-\r
-/*!\r
-access to a portable GetTickCount\r
-*/\r
-typedef unsigned long (* PFN_QERAPP_GETTICKCOUNT) ();\r
-\r
-class IModelCache\r
-{\r
-public:\r
- virtual entity_interfaces_t *GetByID(const char *id, const char* version) = 0;\r
- virtual void DeleteByID(const char *id, const char* version) = 0;\r
- virtual void RefreshAll() = 0;\r
-};\r
-\r
-typedef IModelCache* (* PFN_GETMODELCACHE)();\r
-\r
-class IFileTypeList\r
-{\r
-public:\r
- virtual void addType(filetype_t type) = 0;\r
-};\r
-\r
-class IFileTypeRegistry\r
-{\r
-public:\r
- virtual void addType(const char* key, filetype_t type) = 0;\r
- virtual void getTypeList(const char* key, IFileTypeList* typelist) = 0;\r
-private:\r
-};\r
-\r
-typedef IFileTypeRegistry* (* PFN_GETFILETYPEREGISTRY)();\r
-\r
-typedef const char* (* PFN_QERAPP_READPROJECTKEY)(const char* key);\r
-\r
-typedef char* (* PFN_GETMAPFILENAME)();\r
-\r
- // FIXME:\r
-// add map format extensions\r
-// add texture format handlers\r
-// add surface dialog handler\r
-// add model handler/displayer\r
-\r
-// v1 func table\r
-// Plugins need to declare one of these and implement the getfunctable as described above\r
-struct _QERFuncTable_1\r
-{\r
- int m_nSize;\r
- PFN_QERAPP_CREATEBRUSH m_pfnCreateBrush;\r
- PFN_QERAPP_CREATEBRUSHHANDLE m_pfnCreateBrushHandle;\r
- PFN_QERAPP_DELETEBRUSHHANDLE m_pfnDeleteBrushHandle;\r
- PFN_QERAPP_COMMITBRUSHHANDLETOMAP m_pfnCommitBrushHandle;\r
- PFN_QERAPP_ADDFACE m_pfnAddFace;\r
- PFN_QERAPP_ADDFACEDATA m_pfnAddFaceData;\r
- PFN_QERAPP_GETFACEDATA m_pfnGetFaceData;\r
- PFN_QERAPP_GETFACECOUNT m_pfnGetFaceCount;\r
- PFN_QERAPP_SETFACEDATA m_pfnSetFaceData;\r
- PFN_QERAPP_DELETEFACE m_pfnDeleteFace;\r
- PFN_QERAPP_TEXTUREBRUSH m_pfnTextureBrush;\r
- PFN_QERAPP_BUILDBRUSH m_pfnBuildBrush; // PGM\r
- PFN_QERAPP_SELECTBRUSH m_pfnSelectBrush; // PGM\r
- PFN_QERAPP_DESELECTBRUSH m_pfnDeselectBrush; // PGM\r
- PFN_QERAPP_DESELECTALLBRUSHES m_pfnDeselectAllBrushes; // PGM\r
-\r
- PFN_QERAPP_DELETESELECTION m_pfnDeleteSelection;\r
- PFN_QERAPP_GETPOINTS m_pfnGetPoints;\r
-\r
- PFN_QERAPP_SELECTEDBRUSHCOUNT m_pfnSelectedBrushCount;\r
- PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES m_pfnAllocateSelectedBrushHandles;\r
- PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES m_pfnReleaseSelectedBrushHandles;\r
- PFN_QERAPP_GETSELECTEDBRUSHHANDLE m_pfnGetSelectedBrushHandle;\r
-\r
- PFN_QERAPP_ACTIVEBRUSHCOUNT m_pfnActiveBrushCount;\r
- PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES m_pfnAllocateActiveBrushHandles;\r
- PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES m_pfnReleaseActiveBrushHandles;\r
- PFN_QERAPP_GETACTIVEBRUSHHANDLE m_pfnGetActiveBrushHandle;\r
-\r
- //++timo this would need to be removed and replaced by the IShaders interface\r
- PFN_QERAPP_TEXTURECOUNT m_pfnTextureCount;\r
- PFN_QERAPP_GETTEXTURE m_pfnGetTexture;\r
- PFN_QERAPP_GETCURRENTTEXTURE m_pfnGetCurrentTexture;\r
- PFN_QERAPP_SETCURRENTTEXTURE m_pfnSetCurrentTexture;\r
-\r
- PFN_QERAPP_GETECLASSCOUNT m_pfnGetEClassCount;\r
- PFN_QERAPP_GETECLASS m_pfnGetEClass;\r
- PFN_QERAPP_RESETPLUGINS m_pfnResetPlugins;\r
- // v1.00 ends here\r
- // v1.50 starts here\r
- PFN_QERAPP_LOADTEXTURERGBA m_pfnLoadTextureRGBA;\r
- // v1.50 ends here\r
- // v1.70 starts here\r
- PFN_QERAPP_GETENTITYCOUNT m_pfnGetEntityCount;\r
- PFN_QERAPP_GETENTITYHANDLE m_pfnGetEntityHandle;\r
- PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES m_pfnAllocateEntityBrushHandles;\r
- PFN_QERAPP_RELEASEENTITYBRUSHHANDLES m_pfnReleaseEntityBrushHandles;\r
- PFN_QERAPP_GETENTITYBRUSHHANDLE m_pfnGetEntityBrushHandle;\r
- PFN_QERAPP_CREATEENTITYHANDLE m_pfnCreateEntityHandle;\r
- PFN_QERAPP_COMMITBRUSHHANDLETOENTITY m_pfnCommitBrushHandleToEntity;\r
- PFN_QERAPP_COMMITENTITYHANDLETOMAP m_pfnCommitEntityHandleToMap;\r
- PFN_QERAPP_ALLOCATEEPAIR m_pfnAllocateEpair;\r
- PFN_QERAPP_SETSCREENUPDATE m_pfnSetScreenUpdate;\r
- PFN_QERAPP_BUILDBRUSH2 m_pfnBuildBrush2;\r
- // v1.70 ends here\r
- // v1.80 starts here\r
- PFN_QERAPP_GETDISPATCHPARAMS m_pfnGetDispatchParams;\r
-\r
- // plugins can request additional interfaces\r
- PFN_QERAPP_REQUESTINTERFACE m_pfnRequestInterface;\r
- PFN_QERAPP_ERROR m_pfnError;\r
- // loading a file into a buffer\r
- PFN_QERAPP_LOADFILE m_pfnLoadFile;\r
- PFN_QERAPP_EXPANDRELETIVEPATH m_pfnExpandReletivePath;\r
- PFN_QERAPP_QECONVERTDOSTOUNIXNAME m_pfnQE_ConvertDOSToUnixName;\r
- PFN_QERAPP_HASSHADER m_pfnHasShader;\r
- PFN_QERAPP_TEXTURELOADSKIN m_pfnTexture_LoadSkin;\r
- PFN_QERAPP_GETGAMEPATH m_pfnGetGamePath;\r
- PFN_QERAPP_GETQERPATH m_pfnGetQERPath;\r
- PFN_QERAPP_GETGAMEFILE m_pfnGetGameFile;\r
- // patches in / out\r
- PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES m_pfnAllocateActivePatchHandles;\r
- PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES m_pfnAllocateSelectedPatchHandles;\r
- PFN_QERAPP_RELEASEPATCHHANDLES m_pfnReleasePatchHandles;\r
- PFN_QERAPP_GETPATCHDATA m_pfnGetPatchData;\r
- PFN_QERAPP_GETPATCHHANDLE m_pfnGetPatchHandle;\r
- PFN_QERAPP_DELETEPATCH m_pfnDeletePatch;\r
- PFN_QERAPP_CREATEPATCHHANDLE m_pfnCreatePatchHandle;\r
- PFN_QERAPP_COMMITPATCHHANDLETOMAP m_pfnCommitPatchHandleToMap;\r
- PFN_QERAPP_COMMITPATCHHANDLETOENTITY m_pfnCommitPatchHandleToEntity;\r
-\r
- PFN_QERAPP_LOADIMAGE m_pfnLoadImage;\r
-\r
- // GTK+ functions\r
- PFN_QERAPP_MESSAGEBOX m_pfnMessageBox;\r
- PFN_QERAPP_FILEDIALOG m_pfnFileDialog;\r
- PFN_QERAPP_DIRDIALOG m_pfnDirDialog;\r
- PFN_QERAPP_COLORDIALOG m_pfnColorDialog;\r
- PFN_QERAPP_LOADBITMAP m_pfnLoadBitmap;\r
-\r
- // Profile functions\r
- PFN_QERAPP_PROFILE_GETDIR m_pfnProfileGetDirectory;\r
- PFN_QERAPP_PROFILE_SAVEINT m_pfnProfileSaveInt;\r
- PFN_QERAPP_PROFILE_SAVESTR m_pfnProfileSaveString;\r
- PFN_QERAPP_PROFILE_LOADINT m_pfnProfileLoadInt;\r
- PFN_QERAPP_PROFILE_LOADSTR m_pfnProfileLoadString;\r
-\r
- // Sys_ functions\r
- PFN_QERAPP_SYSUPDATEWINDOWS m_pfnSysUpdateWindows;\r
- PFN_QERAPP_SYSBEEP m_pfnSysBeep;\r
- PFN_QERAPP_SYSPRINTF m_pfnSysPrintf;\r
- PFN_QERAPP_SYSFPRINTF m_pfnSysFPrintf;\r
- PFN_QERAPP_SYSBEGINWAIT m_pfnSysBeginWait;\r
- PFN_QERAPP_SYSENDWAIT m_pfnSysEndWait;\r
- PFN_QERAPP_SYSSETTITLE m_pfnSys_SetTitle;\r
- PFN_QERAPP_SYSSTATUS m_pfnSys_Status;\r
-\r
- // some core functionality on the map\r
- PFN_QERAPP_MAPNEW m_pfnMapNew;\r
- PFN_QERAPP_MAPFREE m_pfnMapFree;\r
- PFN_QERAPP_MAPBUILDBRUSHDATA m_pfnMapBuildBrushData;\r
- PFN_QERAPP_MAPISBRUSHFILTERED m_pfnMap_IsBrushFiltered;\r
- PFN_QERAPP_MAPSTARTPOSITION m_pfnMapStartPosition;\r
- PFN_QERAPP_MAPREGIONOFF m_pfnMapRegionOff;\r
- PFN_QERAPP_SETBUILDWINDINGSNOTEXBUILD m_pfnSetBuildWindingsNoTexBuild;\r
-// PFN_QERAPP_SAVEASDIALOG m_pfnSaveAsDialog;\r
- PFN_QERAPP_POINTFILECLEAR m_pfnPointFileClear;\r
-\r
- // FIXME TTimo prolly want to move that somewhere else\r
- PFN_QERAPP_CSGMAKEHOLLOW m_pfnCSG_MakeHollow;\r
-\r
- PFN_QERAPP_REGIONSPAWNPOINT m_pfnRegionSpawnPoint;\r
- PFN_QERAPP_GETTICKCOUNT m_pfnQGetTickCount;\r
- PFN_GETMODELCACHE m_pfnGetModelCache;\r
- PFN_GETFILETYPEREGISTRY m_pfnGetFileTypeRegistry;\r
-\r
- PFN_QERAPP_READPROJECTKEY m_pfnReadProjectKey;\r
-\r
- // digibob from the old _QERAppBSPFrontendTable table\r
- PFN_GETMAPFILENAME m_pfnGetMapName;\r
-};\r
-\r
-// macros to access those faster in plugins\r
-#ifdef USE_QERTABLE_DEFINE\r
-#ifndef __QERTABLENAME\r
-#define __QERTABLENAME g_FuncTable\r
-#endif\r
-#define CSG_MakeHollow __QERTABLENAME.m_pfnCSG_MakeHollow\r
-#define Sys_Beep __QERTABLENAME.m_pfnSysBeep\r
-#define Sys_Printf __QERTABLENAME.m_pfnSysPrintf\r
-#define Sys_FPrintf __QERTABLENAME.m_pfnSysFPrintf\r
-#define Sys_BeginWait __QERTABLENAME.m_pfnSysBeginWait\r
-#define Sys_EndWait __QERTABLENAME.m_pfnSysEndWait\r
-#define Sys_UpdateWindows __QERTABLENAME.m_pfnSysUpdateWindows\r
-#define Sys_SetTitle __QERTABLENAME.m_pfnSys_SetTitle\r
-#define Sys_Status __QERTABLENAME.m_pfnSys_Status\r
-#define Select_Deselect __QERTABLENAME.m_pfnDeselectAllBrushes\r
-#define Map_New __QERTABLENAME.m_pfnMapNew\r
-#define Map_Free __QERTABLENAME.m_pfnMapFree\r
-#define Map_IsBrushFiltered __QERTABLENAME.m_pfnMap_IsBrushFiltered\r
-#define Map_BuildBrushData __QERTABLENAME.m_pfnMapBuildBrushData\r
-#define Map_StartPosition __QERTABLENAME.m_pfnMapStartPosition\r
-#define Map_RegionOff __QERTABLENAME.m_pfnMapRegionOff\r
-#define QE_ConvertDOSToUnixName __QERTABLENAME.m_pfnQE_ConvertDOSToUnixName\r
-#define SetBuildWindingsNoTexBuild __QERTABLENAME.m_pfnSetBuildWindingsNoTexBuild\r
-//#define SaveAsDialog __QERTABLENAME.m_pfnSaveAsDialog\r
-#define Pointfile_Clear __QERTABLENAME.m_pfnPointFileClear\r
-#define SetScreenUpdate __QERTABLENAME.m_pfnSetScreenUpdate\r
-#define Region_SpawnPoint __QERTABLENAME.m_pfnRegionSpawnPoint\r
-#define QGetTickCount __QERTABLENAME.m_pfnGetTickCount\r
-#define GetModelCache __QERTABLENAME.m_pfnGetModelCache\r
-#define GetFileTypeRegistry __QERTABLENAME.m_pfnGetFileTypeRegistry\r
-#else\r
-IFileTypeRegistry* GetFileTypeRegistry();\r
-#endif\r
-\r
-#endif\r
+/*
+ Copyright (C) 1999-2006 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
+ */
+
+// QERadiant PlugIns
+//
+//
+
+#ifndef __QERPLUGIN_H__
+#define __QERPLUGIN_H__
+
+#include "uilib/uilib.h"
+#include "generic/constant.h"
+
+
+// ========================================
+// GTK+ helper functions
+
+// NOTE: parent can be 0 in all functions but it's best to set them
+
+// this API does not depend on gtk+ or glib
+
+enum EMessageBoxType
+{
+ eMB_OK,
+ eMB_OKCANCEL,
+ eMB_YESNO,
+ eMB_YESNOCANCEL,
+ eMB_NOYES,
+};
+
+enum EMessageBoxIcon
+{
+ eMB_ICONDEFAULT,
+ eMB_ICONERROR,
+ eMB_ICONWARNING,
+ eMB_ICONQUESTION,
+ eMB_ICONASTERISK,
+};
+
+enum EMessageBoxReturn
+{
+ eIDOK,
+ eIDCANCEL,
+ eIDYES,
+ eIDNO,
+};
+
+// simple Message Box, see above for the 'type' flags
+
+typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( ui::Window parent, const char* text, const char* caption /* = RADIANT_NAME */, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
+
+// file and directory selection functions return null if the user hits cancel
+// - 'title' is the dialog title (can be null)
+// - 'path' is used to set the initial directory (can be null)
+// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
+typedef const char* ( *PFN_QERAPP_FILEDIALOG )( ui::Window parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
+
+// returns a gchar* string that must be g_free'd by the user
+typedef char* ( *PFN_QERAPP_DIRDIALOG )( ui::Window parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
+
+// return true if the user closed the dialog with 'Ok'
+// 'color' is used to set the initial value and store the selected value
+template<typename Element> class BasicVector3;
+typedef BasicVector3<float> Vector3;
+typedef bool ( *PFN_QERAPP_COLORDIALOG )( ui::Window parent, Vector3& color,
+ const char* title /* = "Choose Color"*/ );
+
+// load a .bmp file and create a GtkImage widget from it
+// NOTE: 'filename' is relative to <radiant_path>/plugins/bitmaps/
+typedef ui::Image ( *PFN_QERAPP_NEWIMAGE )( const char* filename );
+
+// ========================================
+
+namespace scene
+{
+class Node;
+}
+
+class ModuleObserver;
+
+#include "signal/signalfwd.h"
+#include "windowobserver.h"
+#include "generic/vector.h"
+
+typedef SignalHandler3<const WindowVector&, ButtonIdentifier, ModifierFlags> MouseEventHandler;
+typedef SignalFwd<MouseEventHandler>::handler_id_type MouseEventHandlerId;
+
+enum VIEWTYPE
+{
+ YZ = 0,
+ XZ = 1,
+ XY = 2
+};
+
+// the radiant core API
+struct _QERFuncTable_1
+{
+ INTEGER_CONSTANT( Version, 1 );
+ STRING_CONSTANT( Name, "radiant" );
+
+ const char* ( *getEnginePath )( );
+ const char* ( *getLocalRcPath )( );
+ const char* ( *getGameToolsPath )( );
+ const char* ( *getAppPath )( );
+ const char* ( *getDataPath )( );
+ const char* ( *getSettingsPath )( );
+ const char* ( *getMapsPath )( );
+
+ const char* ( *getGameFile )( );
+ const char* ( *getGameName )( );
+ const char* ( *getGameMode )( );
+
+ const char* ( *getMapName )( );
+ scene::Node& ( *getMapWorldEntity )( );
+ float ( *getGridSize )();
+
+ const char* ( *getGameDescriptionKeyValue )(const char* key);
+ const char* ( *getRequiredGameDescriptionKeyValue )(const char* key);
+
+ SignalHandlerId ( *XYWindowDestroyed_connect )( const SignalHandler& handler );
+ void ( *XYWindowDestroyed_disconnect )( SignalHandlerId id );
+ MouseEventHandlerId ( *XYWindowMouseDown_connect )( const MouseEventHandler& handler );
+ void ( *XYWindowMouseDown_disconnect )( MouseEventHandlerId id );
+ VIEWTYPE ( *XYWindow_getViewType )();
+ Vector3 ( *XYWindow_windowToWorld )( const WindowVector& position );
+ const char* ( *TextureBrowser_getSelectedShader )( );
+
+ // GTK+ functions
+ PFN_QERAPP_MESSAGEBOX m_pfnMessageBox;
+ PFN_QERAPP_FILEDIALOG m_pfnFileDialog;
+ PFN_QERAPP_DIRDIALOG m_pfnDirDialog;
+ PFN_QERAPP_COLORDIALOG m_pfnColorDialog;
+ PFN_QERAPP_NEWIMAGE m_pfnNewImage;
+
+};
+
+#include "modulesystem.h"
+
+template<typename Type>
+class GlobalModule;
+typedef GlobalModule<_QERFuncTable_1> GlobalRadiantModule;
+
+template<typename Type>
+class GlobalModuleRef;
+typedef GlobalModuleRef<_QERFuncTable_1> GlobalRadiantModuleRef;
+
+inline _QERFuncTable_1& GlobalRadiant(){
+ return GlobalRadiantModule::getTable();
+}
+
+#endif