home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / qerplugin.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  25.9 KB  |  545 lines

  1. // QERadiant PlugIns
  2. //
  3. //
  4.  
  5. #ifndef __QERPLUGIN_H__
  6. #define __QERPLUGIN_H__
  7.  
  8. #include <windows.h>
  9. #include "qertypes.h"
  10.  
  11. #define QER_PLUG_VERSION_1 1.00
  12. #define QER_PLUG_VERSION 1.70f
  13.  
  14. #define QER_MAX_NAMELEN 1024
  15.  
  16. // the editor will look for plugins in two places, the plugins path 
  17. // under the application path, and the path under the basepath as defined
  18. // in the project (.qe4) file.
  19. //
  20. // you can drop any number of new texture, model format DLL's in the standard plugin path
  21. // but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc.. 
  22. // should be used at one time.. if multiples are loaded then the last one loaded will be the 
  23. // active one
  24. //
  25. // type of services the plugin supplies, pass any combo of these flags
  26. // it is assumed the plugin will have a matching function as defined below
  27. // to correlate to the implied functionality
  28. // 
  29. // FIXME: after specing this crap i went to a simpler model so this may disappear
  30. #define QER_PLUG_GAME_TEXTURE       0x0001      // defines new texture format
  31. #define QER_PLUG_GAME_MODEL         0x0002      // defines new model format
  32. #define QER_PLUG_GAME_MAP           0x0004      // handles map load/save
  33. #define QER_PLUG_GAME_SURFACEDLG    0x0008      // handles surface dialog
  34. #define QER_PLUG_GAME_SURFACEFLAGS  0x0010      // renames surface/content names
  35.  
  36. // basics
  37. #define QERPLUG_INIT "QERPlug_Init"
  38. #define QERPLUG_GETNAME "QERPlug_GetName"
  39. #define QERPLUG_GETCOMMANDLIST "QERPlug_GetCommandList"
  40. #define QERPLUG_DISPATCH "QERPlug_Dispatch"
  41. #define QERPLUG_GETFUNCTABLE "QERPlug_GetFuncTable"
  42.  
  43. // FIXME: not used, probably should remove
  44. #define QERPLUG_GETSERVICETPE "QERPlug_GetServiceType"
  45.  
  46. // game stuff
  47. #define QERPLUG_GETTEXTUREINFO "QERPlug_GetTextureInfo"   // gets a texture info structure
  48. #define QERPLUG_LOADTEXTURE    "QERPlug_LoadTexture"      // loads a texture, will return an RGBA structure
  49.                                                           // and any surface flags/contents for it
  50. #define QERPLUG_GETTMODELINFO "QERPlug_GetModelInfo"      // gets a model info structure
  51. #define QERPLUG_LOADMODEL     "QERPlug_LoadModel"         // loads model data from a plugin
  52. #define QERPLUG_DOSURFACEDLG  "QERPlug_DoSurfaceDlg"      // runs the surface dialog in a plugin
  53.                                                           // this is going to get icky
  54. #define QERPLUG_GETSURFACEFLAGS "QERPlug_GetSurfaceFlags" // gets a list of surface/content flag names from a plugin
  55.  
  56. struct _QERTextureInfo
  57. {
  58.   char m_TextureExtension[QER_MAX_NAMELEN];   // the extension these textures have
  59.   qboolean m_bHiColor;    // if textures are NOT high color, the default 
  60.                       // palette (as described inthe qe4 file will be used for gamma correction)
  61.                       // if they are high color, gamma and shading are computed on the fly 
  62.                       // based on the rgba data
  63.   //--bool m_bIsShader;   // will probably do q3 shaders this way when i merge
  64.   qboolean m_bWadStyle;   // if this is true, the plugin will be presented with the texture path
  65.                       // defined in the .qe4 file and is expected to preload all the textures
  66.   qboolean m_bHalfLife;   // causes brushes to be saved/parsed without the surface contents/flags/value
  67. };
  68.  
  69. struct _QERTextureLoad    // returned by a plugin
  70. {
  71.   _QERTextureLoad()
  72.   { 
  73.     memset(reinterpret_cast<void*>(this), 0, sizeof(_QERTextureLoad));
  74.   };
  75.  
  76.   ~_QERTextureLoad()
  77.   {
  78.     delete []m_pRGBA;
  79.     delete []m_pName;
  80.   };
  81.  
  82.   void makeSpace(int nSize)
  83.   {
  84.     m_pRGBA = new unsigned char[nSize+1];
  85.   };
  86.  
  87.   void setName(const char* p)
  88.   {
  89.     m_pName = new char[strlen(p)+1];
  90.     strcpy(m_pName, p);
  91.   };
  92.  
  93.  
  94.   unsigned char *m_pRGBA; // rgba data (alpha channel is supported and drawn appropriately)
  95.   int m_nWidth;           // width
  96.   int m_nHeight;          // height
  97.   int m_nContents;        // default contents
  98.   int m_nFlags;           // "" flags
  99.   int m_nValue;           // "" value
  100.   char *m_pName;          // name to be referenced in map, build tools, etc.
  101. };
  102.  
  103. struct _QERModelInfo
  104. {
  105.   char m_ModelExtension[QER_MAX_NAMELEN];
  106.   bool m_bSkinned;
  107.   bool m_bMultipart;
  108. };
  109.  
  110. struct _QERModelLoad
  111. {
  112.   // vertex and skin data
  113. };
  114.  
  115.  
  116. // hook functions
  117. // FIXME: none of the hook stuff works for v1.00
  118. #define  QERPLUG_MAPLOAD "QERPlug_MapLoad"
  119. #define  QERPLUG_MAPSAVE "QERPlug_MapSave"
  120.  
  121. //=========================================
  122. // plugin functions version 1.0
  123. typedef LPCSTR (WINAPI* PFN_QERPLUG_INIT)(HMODULE hApp, HWND hwndMain);
  124. typedef LPCSTR (WINAPI* PFN_QERPLUG_GETNAME)();
  125. typedef LPCSTR (WINAPI* PFN_QERPLUG_GETCOMMANDLIST)();
  126. typedef void (WINAPI* PFN_QERPLUG_DISPATCH)(LPCSTR p, vec3_t vMin, vec3_t vMax, BOOL bSingleBrush);
  127. typedef LPVOID (WINAPI* PFN_QERPLUG_GETFUNCTABLE)();
  128. typedef void (WINAPI* PFN_QERPLUG_MAPLOAD)();
  129. typedef void (WINAPI* PFN_QERPLUG_MAPSAVE)();
  130.  
  131. // editor defined plugin dispatches
  132. // these are used to signal the completion after a 'Get' function is called in the editor
  133. #define QERPLUG_DISPATCH_POINTDONE "PointDone"
  134. #define QERPLUG_DISPATCH_BRUSHDONE "BrushDone"
  135.  
  136. // v1.5
  137. //
  138. // Texture loading
  139. // returns a ptr to _QERTextureInfo
  140. typedef LPVOID (WINAPI* PFN_QERPLUG_GETTEXTUREINFO)();
  141. //
  142. // loads a texture by calling the texture load func in the editor (defined below)
  143. // transparency (for water, fog, lava, etc.. ) can be emulated in the editor
  144. // by passing in appropriate alpha data or by setting the appropriate surface flags
  145. // expected by q2 (which the editor will use.. )
  146. typedef void (WINAPI* PFN_QERPLUG_LOADTEXTURE)(LPCSTR pFilename); 
  147.  
  148. // v1.6
  149. typedef LPVOID (WINAPI* PFN_QERPLUG_GETSURFACEFLAGS)();
  150.  
  151. // v1.7
  152. // if exists in plugin, gets called between INIT and GETCOMMANDLIST
  153. // the plugin can register the EClasses he wants to handle
  154. //++timo TODO: this has got to move into the table, and be requested by QERPlug_RequestInterface
  155. //++timo FIXME: the LPVOID parameter must be casted to an IEpair interface
  156. #define QERPLUG_REGISTERPLUGINENTITIES "QERPlug_RegisterPluginEntities"
  157. typedef void (WINAPI* PFN_QERPLUG_REGISTERPLUGINENTITIES)( LPVOID );
  158. // if exists in plugin, gets called between INIT and GETCOMMANDLIST
  159. // the plugin can Init all it needs for surface properties
  160. #define QERPLUG_INITSURFACEPROPERTIES "QERPlug_InitSurfaceProperties"
  161. typedef void (WINAPI* PFN_QERPLUG_INITSURFACEPROPERTIES)();
  162. // if Radiant needs to use a particular set of commands, it can request the plugin to fill a func table
  163. // this is similar to PFN_QERAPP_REQUESTINTERFACE
  164. #define QERPLUG_REQUESTINTERFACE "QERPlug_RequestInterface"
  165. typedef int (WINAPI* PFN_QERPLUG_REQUESTINTERFACE)( REFGUID, LPVOID );
  166.  
  167. //=========================================
  168. // editor functions
  169.  
  170. // There are 3 potential brush handle lists
  171. // 1. the list that contains brushes a plugin creates using CreateBrushHandle
  172. // 2. the selected brush list (brushes the user has selected)
  173. // 3. the active brush list (brushes in the map that are not selected)
  174. // 
  175. // In general, the same things can be done to brush handles (face manip, delete brushhandle, etc.. ) in each
  176. // list. There are a few exceptions. 
  177. // 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map. 
  178. // 2. You cannot bind brush handles from the selected or active brush list to an entity. As of v1.0 of the plugins
  179. // the only way for a plugin to create entities is to create a brush handles (or a list of handles) and then bind
  180. // them to an entity. This will commit the brush(s) and/or the entities to the map as well.
  181. // 
  182. // To use the active or selected brush lists, you must first allocate them (which returns a count) and then
  183. // release them when you are finish manipulating brushes in one of those lists. 
  184.  
  185. //++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor
  186.  
  187. // brush manipulation routines
  188. #define QERAPP_CREATEBRUSH "QERApp_CreateBrush"
  189. #define QERAPP_CREATEBRUSHHANDLE "QERApp_CreateBrushHandle"
  190. #define QERAPP_DELETEBRUSHHANDLE "QERApp_DeleteBrushHandle"
  191. #define QERAPP_COMMITBRUSHHANDLETOMAP "QERApp_CommitBrushHandleToMap"
  192. //++timo not implemented .. remove
  193. // #define QERAPP_BINDHANDLESTOENTITY "QERApp_BindHandlesToEntity"
  194. #define QERAPP_ADDFACE "QERApp_AddFace"
  195. #define QERAPP_ADDFACEDATA "QERApp_AddFaceData"
  196. #define QERAPP_GETFACECOUNT "QERApp_GetFaceCount"
  197. #define QERAPP_GETFACEDATA "QERApp_GetFaceData"
  198. #define QERAPP_SETFACEDATA "QERApp_SetFaceData"
  199. #define QERAPP_DELETEFACE "QERApp_DeleteFace"
  200. #define QERAPP_TEXTUREBRUSH "QERApp_TextureBrush"
  201. #define QERAPP_BUILDBRUSH "QERApp_BuildBrush"                    // PGM
  202. #define QERAPP_SELECTEDBRUSHCOUNT "QERApp_SelectedBrushCount"
  203. #define QERAPP_ALLOCATESELECTEDBRUSHHANDLES "QERApp_AllocateSelectedBrushHandles"
  204. #define QERAPP_RELEASESELECTEDBRUSHHANDLES "QERApp_ReleaseSelectedBrushHandles"
  205. #define QERAPP_GETSELECTEDBRUSHHANDLE "QERApp_GetSelectedBrushHandle"
  206. #define QERAPP_ACTIVEBRUSHCOUNT "QERApp_ActiveBrushCount"
  207. #define QERAPP_ALLOCATEACTIVEBRUSHHANDLES "QERApp_AllocateActiveBrushHandles"
  208. #define QERAPP_RELEASEACTIVEBRUSHHANDLES "QERApp_ReleaseActiveBrushHandles"
  209. #define QERAPP_GETACTIVEBRUSHHANDLE "QERApp_GetActiveBrushHandle"
  210.  
  211. // texture stuff
  212. #define QERAPP_TEXTURECOUNT "QERApp_TextureCount"
  213. #define QERAPP_GETTEXTURE "QERApp_GetTexture"
  214. #define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture"
  215. #define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture"
  216.  
  217. // selection 
  218. #define QERAPP_DELETESELECTION "QERApp_DeleteSelection"
  219. #define QERAPP_SELECTBRUSH "QERApp_SelectBrush"                    // PGM
  220. #define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush"                // PGM
  221. #define QERAPP_DESELECTALLBRUSHES "QERApp_DeselectAllBrushes"    // PGM
  222.  
  223. // data gathering
  224. #define QERAPP_GETPOINTS "QERApp_GetPoints"
  225. #define QERAPP_SELECTBRUSHES "QERApp_GetBrushes"
  226.  
  227. // entity class stuff
  228. // the entity handling is very basic for 1.0
  229. #define QERAPP_GETECLASSCOUNT "QERApp_GetEClassCount"
  230. #define QERAPP_GETECLASS "QERApp_GetEClass"
  231.  
  232. // misc
  233. #define QERAPP_SYSMSG "QERApp_SysMsg"
  234. #define QERAPP_INFOMSG "QERApp_InfoMsg"
  235. #define QERAPP_HIDEINFOMSG "QERApp_HideInfoMsg"
  236. #define QERAPP_POSITIONVIEW    "QERApp_PositionView"            // PGM
  237. #define QERAPP_RESET_PLUGINS "QERApp_ResetPlugins"
  238.  
  239. // texture loading
  240. #define QERAPP_LOADTEXTURERGBA "QERApp_LoadTextureRGBA"
  241.  
  242. // FIXME: the following are not implemented yet
  243. // hook registrations
  244. #define QERAPP_REGISTER_MAPLOADFUNC "QERApp_Register_MapLoadFunc"
  245. #define QERAPP_REGISTER_MAPSAVEFUNC "QERApp_Register_MapSaveFunc"
  246.  
  247. // FIXME: the following are not implemented yet
  248. #define QERAPP_REGISTER_PROJECTLOADFUNC "QERApp_Register_ProjectLoadFunc"
  249. #define QERAPP_REGISTER_MOUSEHANDLER "QERApp_Register_MouseHandler"
  250. #define QERAPP_REGISTER_KEYHANDLER "QERApp_Register_KeyHandler"
  251.  
  252. // FIXME: new primtives do not work in v1.00
  253. // primitives are new types of things in the map
  254. // for instance, the Q3 curves could have been done as 
  255. // primitives instead of being built in 
  256. // it will be a plugins responsibility to hook the map load and save funcs to load
  257. // and/or save any additional data (like new primitives of some type)
  258. // the editor will call each registered renderer during the rendering process to repaint
  259. // any primitives the plugin owns
  260. // each primitive object has a temporary sibling brush that lives in the map
  261. // FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner
  262. // basically a plugin will hook the map load and save and will add the primitives to the map.. this will
  263. // produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the 
  264. // edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex
  265. // mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler
  266. // so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the 
  267. // sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives
  268. // as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check
  269. // here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that
  270. // crap but it looks like a nice place for a mess)
  271. #define QERAPP_REGISTER_PRIMITIVE "QERApp_Register_Primitive"
  272. #define QERAPP_REGISTER_RENDERER "QERApp_Register_Renderer"
  273. #define QERAPP_REGISTER_EDITHANDLER "QERApp_Register_EditHandler"
  274. #define QERAPP_REGISTER_VERTEXMAKER "QERApp_Register_VertexMaker"
  275. #define QERAPP_ADDPRIMITIVE "QERApp_AddPrimitive"
  276.  
  277. // v1.70
  278. #define QERAPP_GETENTITYCOUNT "QERApp_GetEntityCount"
  279. #define QERAPP_GETENTITYHANDLE "QERApp_GetEntityHandle"
  280. //++timo not implemented for the moment
  281. // #define QERAPP_GETENTITYINFO "QERApp_GetEntityInfo"
  282. //++timo does the keyval need some more funcs to add/remove ?
  283. // get the pointer and do the changes yourself
  284. #define QERAPP_GETENTITYKEYVALLIST "QERApp_GetKeyValList"
  285. #define QERAPP_ALLOCATEEPAIR "QERApp_AllocateEpair"
  286. // will check current KeyVal list is NULL, otherwise use GetKeyValList
  287. #define QERAPP_SETENTITYKEYVALLIST "QERApp_SetKeyValList"
  288. #define QERAPP_ALLOCATEENTITYBRUSHHANDLES "QERApp_AllocateEntityBrushHandles"
  289. #define QERAPP_RELEASEENTITYBRUSHHANDLES "QERApp_ReleaseEntityBrushHandles"
  290. #define QERAPP_GETENTITYBRUSHHANDLE "QERApp_GetEntityBrushHandle"
  291. #define QERAPP_CREATEENTITYHANDLE "QERApp_CreateEntityHandle"
  292. #define QERAPP_COMMITBRUSHHANDLETOENTITY "QERApp_CommitBrushHandleToEntity"
  293. #define QERAPP_COMMITENTITYHANDLETOMAP "QERApp_CommitEntityHandleToMap"
  294. #define QERAPP_SETSCREENUPDATE "QERApp_SetScreenUpdate"
  295. #define QERAPP_BUILDBRUSH2 "QERApp_BuildBrush2"
  296.  
  297. struct _QERPointData
  298. {
  299.   int     m_nCount;
  300.   vec3_t *m_pVectors;
  301. };
  302.  
  303. struct _QERFaceData
  304. {
  305.   char  m_TextureName[QER_MAX_NAMELEN];
  306.   int   m_nContents;
  307.   int   m_nFlags;
  308.   int   m_nValue;
  309.   float m_fShift[2];
  310.   float m_fRotate;
  311.   float m_fScale[2];
  312.   vec3_t m_v1, m_v2, m_v3;
  313.   // brush primitive additions
  314.   qboolean m_bBPrimit;
  315.   brushprimit_texdef_t brushprimit_texdef;
  316. };
  317.  
  318. typedef void (WINAPI* PFN_QERAPP_CREATEBRUSH)(vec3_t vMin, vec3_t vMax);
  319.  
  320. typedef LPVOID (WINAPI* PFN_QERAPP_CREATEBRUSHHANDLE)();
  321. typedef void (WINAPI* PFN_QERAPP_DELETEBRUSHHANDLE)(LPVOID pv);
  322. typedef void (WINAPI* PFN_QERAPP_COMMITBRUSHHANDLETOMAP)(LPVOID pv);
  323. typedef void (WINAPI* PFN_QERAPP_ADDFACE)(LPVOID pv, vec3_t v1, vec3_t v2, vec3_t v3);
  324.  
  325. typedef void (WINAPI* PFN_QERAPP_ADDFACEDATA)(LPVOID pv, _QERFaceData *pData);
  326. typedef int  (WINAPI* PFN_QERAPP_GETFACECOUNT)(LPVOID pv);
  327. typedef _QERFaceData* (WINAPI* PFN_QERAPP_GETFACEDATA)(LPVOID pv, int nFaceIndex);
  328. typedef void (WINAPI* PFN_QERAPP_SETFACEDATA)(LPVOID pv, int nFaceIndex, _QERFaceData *pData);
  329. typedef void (WINAPI* PFN_QERAPP_DELETEFACE)(LPVOID pv, int nFaceIndex);
  330. typedef void (WINAPI* PFN_QERAPP_TEXTUREBRUSH)(LPVOID pv, LPCSTR pName);
  331. typedef void (WINAPI* PFN_QERAPP_BUILDBRUSH)(LPVOID pv);        // PGM
  332. typedef void (WINAPI* PFN_QERAPP_SELECTBRUSH)(LPVOID pv);        // PGM
  333. typedef void (WINAPI* PFN_QERAPP_DESELECTBRUSH)(LPVOID pv);        // PGM
  334. typedef void (WINAPI* PFN_QERAPP_DESELECTALLBRUSHES)();            // PGM
  335.  
  336. typedef void (WINAPI* PFN_QERAPP_DELETESELECTION)();
  337. typedef void (WINAPI* PFN_QERAPP_GETPOINTS)(int nMax, _QERPointData *pData, LPCSTR pMsg);
  338. typedef void (WINAPI* PFN_QERAPP_SYSMSG)(LPCSTR pMsg);
  339. typedef void (WINAPI* PFN_QERAPP_INFOMSG)(LPCSTR pMsg);
  340. typedef void (WINAPI* PFN_QERAPP_HIDEINFOMSG)();
  341. typedef void (WINAPI* PFN_QERAPP_POSITIONVIEW)(vec3_t v1, vec3_t v2);    //PGM
  342.  
  343. typedef int  (WINAPI* PFN_QERAPP_SELECTEDBRUSHCOUNT)();
  344. typedef int (WINAPI* PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES)();
  345. typedef void (WINAPI* PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES)();
  346. typedef LPVOID (WINAPI* PFN_QERAPP_GETSELECTEDBRUSHHANDLE)(int nIndex);
  347.  
  348. typedef int  (WINAPI* PFN_QERAPP_ACTIVEBRUSHCOUNT)();
  349. typedef int (WINAPI* PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES)();
  350. typedef void (WINAPI* PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES)();
  351. typedef LPVOID (WINAPI* PFN_QERAPP_GETACTIVEBRUSHHANDLE)(int nIndex);
  352.  
  353. typedef int  (WINAPI* PFN_QERAPP_TEXTURECOUNT)();
  354. typedef LPCSTR (WINAPI* PFN_QERAPP_GETTEXTURE)(int nIndex);
  355. typedef LPCSTR (WINAPI* PFN_QERAPP_GETCURRENTTEXTURE)();
  356. typedef void (WINAPI* PFN_QERAPP_SETCURRENTTEXTURE)(LPCSTR pName);
  357.  
  358. typedef void (WINAPI* PFN_QERAPP_REGISTERMAPLOAD)(LPVOID vp);
  359. typedef void (WINAPI* PFN_QERAPP_REGISTERMAPSAVE)(LPVOID vp);
  360.  
  361. typedef int (WINAPI* PFN_QERAPP_GETECLASSCOUNT)();
  362. typedef LPCSTR (WINAPI* PFN_QERAPP_GETECLASS)(int nIndex);
  363.  
  364. typedef void (WINAPI* PFN_QERAPP_RESETPLUGINS)();
  365. //--typedef int (WINAPI* PFN_QERAPP_GETENTITYCOUNT)();
  366.  
  367.  
  368. // called by texture loaders for each texture loaded
  369. typedef void (WINAPI* PFN_QERAPP_LOADTEXTURERGBA)(LPVOID vp);
  370.  
  371. //--typedef LPCSTR (WINAPI* PFN_QERAPP_GETENTITY)(int nIndex);
  372.  
  373. // v1.70
  374. typedef int (WINAPI* PFN_QERAPP_GETENTITYCOUNT)();
  375. typedef LPVOID (WINAPI* PFN_QERAPP_GETENTITYHANDLE)(int nIndex);
  376. typedef epair_t** (WINAPI* PFN_QERAPP_GETENTITYKEYVALLIST)(LPVOID vp);
  377. typedef epair_t* (WINAPI* PFN_QERAPP_ALLOCATEEPAIR)( char*, char* );
  378. typedef void (WINAPI* PFN_QERAPP_SETENTITYKEYVALLIST)(LPVOID vp, epair_t* ep);
  379. typedef int (WINAPI* PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES)(LPVOID vp);
  380. typedef void (WINAPI* PFN_QERAPP_RELEASEENTITYBRUSHHANDLES)();
  381. typedef LPVOID (WINAPI* PFN_QERAPP_GETENTITYBRUSHHANDLE)(int nIndex);
  382. typedef LPVOID (WINAPI* PFN_QERAPP_CREATEENTITYHANDLE)();
  383. typedef void (WINAPI* PFN_QERAPP_COMMITBRUSHHANDLETOENTITY)( LPVOID vpBrush, LPVOID vpEntity);
  384. typedef void (WINAPI* PFN_QERAPP_COMMITENTITYHANDLETOMAP)(LPVOID vp);
  385. typedef void (WINAPI* PFN_QERAPP_SETSCREENUPDATE)(int bScreenUpdate);
  386. // this one uses window flags defined in qertypes.h
  387. typedef void (WINAPI* PFN_QERAPP_SYSUPDATEWINDOWS)(int bits);
  388. //++timo remove this one
  389. typedef void (WINAPI* PFN_QERAPP_BUILDBRUSH2)(LPVOID vp, int bConvert);
  390. // Radiant functions for Plugin Entities
  391. // will look for the value of the correponding key in the project epairs
  392. typedef char* (WINAPI* PFN_QERAPP_READPROJECTKEY)(char* );
  393. // will scan the file, parse the first EClass found, and associate it to the caller plugin
  394. // will only read first EClass in the file, and return true/false
  395. typedef int (WINAPI* PFN_QERAPP_SCANFILEFORECLASS)(char* );
  396. // plugins can request additional interfaces from the editor when they need specific services
  397. typedef int (WINAPI* PFN_QERAPP_REQUESTINTERFACE)( REFGUID, LPVOID );
  398. // use this one for errors, Radiant will stop after the "edit preferences" dialog
  399. typedef void (WINAPI* PFN_QERAPP_ERRORMSG)(LPCSTR pMsg);
  400. // use to gain read access to the project epairs
  401. // FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface
  402. // typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **);
  403. // used to allocate and read a buffer
  404. //++timo NOTE: perhaps this would need moving to some kind of dedicated interface
  405. typedef int (WINAPI* PFN_QERAPP_LOADFILE)(const char *pLocation, void ** buffer);
  406. typedef char* (WINAPI* PFN_QERAPP_EXPANDRELETIVEPATH)(char *);
  407. typedef void (WINAPI* PFN_QERAPP_QECONVERTDOSTOUNIXNAME)( char *dst, const char *src );
  408. typedef int (WINAPI* PFN_QERAPP_HASSHADER)(const char *);
  409. typedef int (WINAPI* PFN_QERAPP_TEXTURELOADSKIN)(char *pName, int *pnWidth, int *pnHeight);
  410. // free memory previously allocated by Radiant
  411. // NOTE: this is dirty
  412. typedef void (WINAPI* PFN_QERAPP_RADIANTFREE)( void * );
  413. // retrieves the path to the engine from the preferences dialog box
  414. typedef char* (WINAPI* PFN_QERAPP_GETGAMEPATH)();
  415. // retrieves full Radiant path
  416. typedef char* (WINAPI* PFN_QERAPP_GETQERPATH)();
  417.  
  418. // patches in/out
  419. // NOTE: this is a bit different from the brushes in/out, no LPVOID handles this time
  420. // use int indexes instead
  421. // if you call AllocateActivePatchHandles, you'll be playing with active patches
  422. // AllocateSelectedPatcheHandles for selected stuff
  423. // a call to CreatePatchHandle will move you to a seperate index table
  424. typedef int                (WINAPI* PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES)        ();
  425. typedef int                (WINAPI* PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES)    ();
  426. typedef void            (WINAPI* PFN_QERAPP_RELEASEPATCHHANDLES)            ();
  427. typedef patchMesh_t*    (WINAPI* PFN_QERAPP_GETPATCHDATA)                    (int);
  428. typedef void            (WINAPI* PFN_QERAPP_DELETEPATCH)                    (int);
  429. typedef int                (WINAPI* PFN_QERAPP_CREATEPATCHHANDLE)                ();
  430. // when commiting, only a few patchMesh_t members are relevant:
  431. //  int    width, height;        // in control points, not patches
  432. //  int   contents, flags, value, type;
  433. //  drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
  434. // once you have commited the index is still available, if the patch handle was allocated by you
  435. //   then you can re-use the index to commit other patches .. otherwise you can change existing patches
  436. // NOTE: the handle thing for plugin-allocated patches is a bit silly (nobody's perfect)
  437. // TODO: change current behaviour to an index = 0 to tell Radiant to allocate, other indexes to existing patches
  438. // patch is selected after a commit
  439. // you can add an optional texture / shader name .. if NULL will use the current texture
  440. typedef void            (WINAPI* PFN_QERAPP_COMMITPATCHHANDLETOMAP)            (int, patchMesh_t* pMesh, char *texName);
  441.  
  442. // FIXME:
  443. // add map format extensions
  444. // add texture format handlers
  445. // add surface dialog handler
  446. // add model handler/displayer
  447.  
  448. // v1 func table
  449. // Plugins need to declare one of these and implement the getfunctable as described above
  450. struct _QERFuncTable_1
  451. {
  452.   float m_fVersion;
  453.   int   m_nSize;
  454.   PFN_QERAPP_CREATEBRUSH            m_pfnCreateBrush;
  455.   PFN_QERAPP_CREATEBRUSHHANDLE      m_pfnCreateBrushHandle;
  456.   PFN_QERAPP_DELETEBRUSHHANDLE      m_pfnDeleteBrushHandle;
  457.   PFN_QERAPP_COMMITBRUSHHANDLETOMAP m_pfnCommitBrushHandle;
  458.   PFN_QERAPP_ADDFACE                m_pfnAddFace;
  459.   PFN_QERAPP_ADDFACEDATA            m_pfnAddFaceData;
  460.   PFN_QERAPP_GETFACEDATA            m_pfnGetFaceData;
  461.   PFN_QERAPP_GETFACECOUNT           m_pfnGetFaceCount;
  462.   PFN_QERAPP_SETFACEDATA            m_pfnSetFaceData;
  463.   PFN_QERAPP_DELETEFACE             m_pfnDeleteFace;
  464.   PFN_QERAPP_TEXTUREBRUSH           m_pfnTextureBrush;
  465.   PFN_QERAPP_BUILDBRUSH                m_pfnBuildBrush;                // PGM
  466.   PFN_QERAPP_SELECTBRUSH            m_pfnSelectBrush;                // PGM
  467.   PFN_QERAPP_DESELECTBRUSH            m_pfnDeselectBrush;                // PGM
  468.   PFN_QERAPP_DESELECTALLBRUSHES        m_pfnDeselectAllBrushes;        // PGM
  469.  
  470.   PFN_QERAPP_DELETESELECTION        m_pfnDeleteSelection;
  471.   PFN_QERAPP_GETPOINTS              m_pfnGetPoints;
  472.   PFN_QERAPP_SYSMSG                 m_pfnSysMsg;
  473.   PFN_QERAPP_INFOMSG                m_pfnInfoMsg;
  474.   PFN_QERAPP_HIDEINFOMSG            m_pfnHideInfoMsg;
  475.   PFN_QERAPP_POSITIONVIEW            m_pfnPositionView;                // PGM
  476.  
  477.   PFN_QERAPP_SELECTEDBRUSHCOUNT           m_pfnSelectedBrushCount;
  478.   PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES m_pfnAllocateSelectedBrushHandles;
  479.   PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES  m_pfnReleaseSelectedBrushHandles;
  480.   PFN_QERAPP_GETSELECTEDBRUSHHANDLE       m_pfnGetSelectedBrushHandle;
  481.  
  482.   PFN_QERAPP_ACTIVEBRUSHCOUNT             m_pfnActiveBrushCount;
  483.   PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES   m_pfnAllocateActiveBrushHandles;
  484.   PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES    m_pfnReleaseActiveBrushHandles;
  485.   PFN_QERAPP_GETACTIVEBRUSHHANDLE         m_pfnGetActiveBrushHandle;
  486.  
  487.   //++timo this would need to be removed and replaced by the IShaders interface
  488.   PFN_QERAPP_TEXTURECOUNT                 m_pfnTextureCount;
  489.   PFN_QERAPP_GETTEXTURE                   m_pfnGetTexture;
  490.   PFN_QERAPP_GETCURRENTTEXTURE            m_pfnGetCurrentTexture;
  491.   PFN_QERAPP_SETCURRENTTEXTURE            m_pfnSetCurrentTexture;
  492.  
  493.   PFN_QERAPP_GETECLASSCOUNT         m_pfnGetEClassCount;
  494.   PFN_QERAPP_GETECLASS              m_pfnGetEClass;
  495.   PFN_QERAPP_RESETPLUGINS           m_pfnResetPlugins;
  496.   // v1.00 ends here
  497.   // v1.50 starts here
  498.   PFN_QERAPP_LOADTEXTURERGBA        m_pfnLoadTextureRGBA;
  499.   // v1.50 ends here
  500.   // v1.70 starts here
  501.   PFN_QERAPP_GETENTITYCOUNT            m_pfnGetEntityCount;
  502.   PFN_QERAPP_GETENTITYHANDLE        m_pfnGetEntityHandle;
  503.   PFN_QERAPP_GETENTITYKEYVALLIST    m_pfnGetEntityKeyValList;
  504.   PFN_QERAPP_SETENTITYKEYVALLIST    m_pfnSetEntityKeyValList;
  505.   PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES    m_pfnAllocateEntityBrushHandles;
  506.   PFN_QERAPP_RELEASEENTITYBRUSHHANDLES    m_pfnReleaseEntityBrushHandles;
  507.   PFN_QERAPP_GETENTITYBRUSHHANDLE    m_pfnGetEntityBrushHandle;
  508.   PFN_QERAPP_CREATEENTITYHANDLE        m_pfnCreateEntityHandle;
  509.   PFN_QERAPP_COMMITBRUSHHANDLETOENTITY    m_pfnCommitBrushHandleToEntity;
  510.   PFN_QERAPP_COMMITENTITYHANDLETOMAP    m_pfnCommitEntityHandleToMap;
  511.   PFN_QERAPP_ALLOCATEEPAIR            m_pfnAllocateEpair;
  512.   PFN_QERAPP_SETSCREENUPDATE        m_pfnSetScreenUpdate;
  513.   PFN_QERAPP_SYSUPDATEWINDOWS        m_pfnSysUpdateWindows;
  514.   PFN_QERAPP_BUILDBRUSH2            m_pfnBuildBrush2;
  515.   // Radiant functions for Plugin Entities
  516.   PFN_QERAPP_READPROJECTKEY            m_pfnReadProjectKey;
  517.   PFN_QERAPP_SCANFILEFORECLASS        m_pfnScanFileForEClass;
  518.   // plugins can request additional interfaces
  519.   PFN_QERAPP_REQUESTINTERFACE        m_pfnRequestInterface;
  520.   PFN_QERAPP_ERRORMSG                m_pfnErrorMsg;
  521.   // loading a file into a buffer
  522.   PFN_QERAPP_LOADFILE                m_pfnLoadFile;
  523.   PFN_QERAPP_EXPANDRELETIVEPATH        m_pfnExpandReletivePath;
  524.   PFN_QERAPP_QECONVERTDOSTOUNIXNAME    m_pfnQE_ConvertDOSToUnixName;
  525.   PFN_QERAPP_HASSHADER                m_pfnHasShader;
  526.   PFN_QERAPP_TEXTURELOADSKIN        m_pfnTexture_LoadSkin;
  527.   PFN_QERAPP_RADIANTFREE            m_pfnRadiantFree;
  528.   PFN_QERAPP_GETGAMEPATH            m_pfnGetGamePath;
  529.   PFN_QERAPP_GETQERPATH                m_pfnGetQERPath;
  530.   // patches in / out
  531.   PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES        m_pfnAllocateActivePatchHandles;
  532.   PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES    m_pfnAllocateSelectedPatchHandles;
  533.   PFN_QERAPP_RELEASEPATCHHANDLES            m_pfnReleasePatchHandles;
  534.   PFN_QERAPP_GETPATCHDATA                    m_pfnGetPatchData;
  535.   PFN_QERAPP_DELETEPATCH                    m_pfnDeletePatch;
  536.   PFN_QERAPP_CREATEPATCHHANDLE                m_pfnCreatePatchHandle;
  537.   PFN_QERAPP_COMMITPATCHHANDLETOMAP            m_pfnCommitPatchHandleToMap;
  538. };
  539.  
  540.  
  541. //--typedef int (WINAPI*      PFN_QERAPP_BRUSHCOUNT     )();
  542. //--typedef brush_t* (WINAPI* PFN_QERAPP_GETBRUSH       )();
  543. //--typedef void (WINAPI*     PFN_QERAPP_DELETEBRUSH    )();
  544.  
  545. #endif