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