qerplugin.h 26 KB

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