2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 // QERadiant PlugIns
\r
26 #ifndef __QERPLUGIN_H__
\r
27 #define __QERPLUGIN_H__
\r
30 \todo this header is intended to be turned into a header for the core editor functionality
\r
31 some portability related code should be moved to synapse (such as the GUID stuff)
\r
37 // ideally the plugin API would be UI toolkit independent, but removing the dependency with GLib seems tricky right now..
\r
39 #include "qertypes.h"
\r
42 // GUID declaration here should be trashed, it is in synapse.h
\r
47 #define QER_MAX_NAMELEN 1024
\r
50 #include "misc_def.h"
\r
53 // the editor will look for plugins in two places, the plugins path
\r
54 // under the application path, and the path under the basepath as defined
\r
55 // in the project (.qe4) file.
\r
57 // you can drop any number of new texture, model format DLL's in the standard plugin path
\r
58 // but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc..
\r
59 // should be used at one time.. if multiples are loaded then the last one loaded will be the
\r
62 // type of services the plugin supplies, pass any combo of these flags
\r
63 // it is assumed the plugin will have a matching function as defined below
\r
64 // to correlate to the implied functionality
\r
67 #define RADIANT_MAJOR "radiant"
\r
70 #define QERPLUG_INIT "QERPlug_Init"
\r
71 #define QERPLUG_GETNAME "QERPlug_GetName"
\r
72 #define QERPLUG_GETCOMMANDLIST "QERPlug_GetCommandList"
\r
73 #define QERPLUG_DISPATCH "QERPlug_Dispatch"
\r
74 #define QERPLUG_GETFUNCTABLE "QERPlug_GetFuncTable"
\r
77 #define QERPLUG_GETTEXTUREINFO "QERPlug_GetTextureInfo" // gets a texture info structure
\r
78 #define QERPLUG_LOADTEXTURE "QERPlug_LoadTexture" // loads a texture, will return an RGBA structure
\r
79 // and any surface flags/contents for it
\r
80 #define QERPLUG_GETSURFACEFLAGS "QERPlug_GetSurfaceFlags" // gets a list of surface/content flag names from a plugin
\r
82 struct _QERTextureInfo
\r
84 char m_TextureExtension[QER_MAX_NAMELEN]; // the extension these textures have
\r
85 qboolean m_bHiColor; // if textures are NOT high color, the default
\r
86 // palette (as described inthe qe4 file will be used for gamma correction)
\r
87 // if they are high color, gamma and shading are computed on the fly
\r
88 // based on the rgba data
\r
89 //--bool m_bIsShader; // will probably do q3 shaders this way when i merge
\r
90 qboolean m_bWadStyle; // if this is true, the plugin will be presented with the texture path
\r
91 // defined in the .qe4 file and is expected to preload all the textures
\r
92 qboolean m_bHalfLife; // causes brushes to be saved/parsed without the surface contents/flags/value
\r
95 struct _QERTextureLoad // returned by a plugin
\r
99 memset(reinterpret_cast<void*>(this), 0, sizeof(_QERTextureLoad));
\r
108 void makeSpace(int nSize)
\r
110 m_pRGBA = new unsigned char[nSize+1];
\r
113 void setName(const char* p)
\r
115 m_pName = new char[strlen(p)+1];
\r
116 strcpy(m_pName, p);
\r
120 unsigned char *m_pRGBA; // rgba data (alpha channel is supported and drawn appropriately)
\r
121 int m_nWidth; // width
\r
122 int m_nHeight; // height
\r
123 int m_nContents; // default contents
\r
124 int m_nFlags; // "" flags
\r
125 int m_nValue; // "" value
\r
126 char *m_pName; // name to be referenced in map, build tools, etc.
\r
129 struct _QERModelInfo
\r
131 char m_ModelExtension[QER_MAX_NAMELEN];
\r
136 struct _QERModelLoad
\r
138 // vertex and skin data
\r
142 //=========================================
\r
143 // plugin functions
\r
145 // NOTE TTimo: hack to make old plugin tech and new plugin tech live together
\r
146 #ifndef _IPLUGIN_H_
\r
147 // toolkit-independant interface, cast hwndMain to GtkWidget*
\r
148 typedef const char* (WINAPI *PFN_QERPLUG_INIT)(void* hApp, void* hwndMain);
\r
149 typedef const char* (WINAPI *PFN_QERPLUG_GETNAME)();
\r
150 typedef const char* (WINAPI *PFN_QERPLUG_GETCOMMANDLIST)();
\r
151 typedef void (WINAPI *PFN_QERPLUG_DISPATCH)(const char* p, vec3_t vMin, vec3_t vMax, bool bSingleBrush);
\r
155 typedef char* (WINAPI *PFN_QERPLUG_GETFUNCTABLE)();
\r
160 // returns a ptr to _QERTextureInfo
\r
161 typedef void* (WINAPI *PFN_QERPLUG_GETTEXTUREINFO)();
\r
163 // loads a texture by calling the texture load func in the editor (defined below)
\r
164 // transparency (for water, fog, lava, etc.. ) can be emulated in the editor
\r
165 // by passing in appropriate alpha data or by setting the appropriate surface flags
\r
166 // expected by q2 (which the editor will use.. )
\r
167 typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename);
\r
170 typedef void* (WINAPI *PFN_QERPLUG_GETSURFACEFLAGS)();
\r
173 // if exists in plugin, gets called between INIT and GETCOMMANDLIST
\r
174 // the plugin can register the EClasses he wants to handle
\r
175 //++timo TODO: this has got to move into the table, and be requested by QERPlug_RequestInterface
\r
176 //++timo FIXME: the LPVOID parameter must be casted to an IEpair interface
\r
177 #define QERPLUG_REGISTERPLUGINENTITIES "QERPlug_RegisterPluginEntities"
\r
178 typedef void (WINAPI * PFN_QERPLUG_REGISTERPLUGINENTITIES)( void* );
\r
180 // if exists in plugin, gets called between INIT and GETCOMMANDLIST
\r
181 // the plugin can Init all it needs for surface properties
\r
182 #define QERPLUG_INITSURFACEPROPERTIES "QERPlug_InitSurfaceProperties"
\r
183 typedef void (WINAPI * PFN_QERPLUG_INITSURFACEPROPERTIES)();
\r
185 // if Radiant needs to use a particular set of commands, it can request the plugin to fill a func table
\r
186 // this is similar to PFN_QERAPP_REQUESTINTERFACE
\r
187 #define QERPLUG_REQUESTINTERFACE "QERPlug_RequestInterface"
\r
188 typedef int (WINAPI * PFN_QERPLUG_REQUESTINTERFACE) (REFGUID refGUID, void* pInterface, const char *version_name);
\r
190 // Load an image file
\r
191 typedef void (* PFN_QERAPP_LOADIMAGE) (const char *name, unsigned char **pic, int *width, int *height);
\r
193 // TTimo FIXME: the logic for this is in synapse now
\r
195 // MODULES specific:
\r
196 // if it exports this entry point, will be considered as a module
\r
197 // a module is a plugin that provides some REQUIRED interfaces to Radiant, such as the shader module
\r
198 // Radiant will call QERPLUG_LISTINTERFACES to get a list of the interfaces a given plugin implements
\r
199 // then it will call PFN_QERPLUG_REQUESTINTERFACE to actually get them
\r
201 // following leo's code .. looks ok to use a string to identify the various versions of a same interface
\r
202 // obviously it would be handy to have the same string naming for the interfaces.
\r
203 // best way would be to have the names come in when you list the interfaces
\r
204 // NOTE: we might have a problem with the order in which the interfaces are filled in
\r
205 // there's some kind of dependency graph, the shader module expects to find the VFS ready etc.
\r
206 typedef struct moduleentry_s {
\r
207 const GUID *interface_GUID;
\r
208 const char* interface_name;
\r
209 const char* version_name;
\r
212 #define QERPLUG_LISTINTERFACES "QERPlug_ListInterfaces"
\r
213 #define MAX_QERPLUG_INTERFACES 10
\r
214 typedef int (WINAPI* PFN_QERPLUG_LISTINTERFACES) (moduleentry_t table[MAX_QERPLUG_INTERFACES]);
\r
216 // ========================================
\r
217 // GTK+ helper functions
\r
219 // NOTE: parent can be NULL in all functions but it's best to set them
\r
221 // simple Message Box, see above for the 'type' flags
\r
222 // toolkit-independent, cast parent ot a GtkWidget*
\r
223 typedef gint (WINAPI* PFN_QERAPP_MESSAGEBOX) (void *parent, const char* text,
\r
224 const char* caption, guint32 type, const char *URL);
\r
226 // file and directory selection functions return NULL if the user hits cancel
\r
227 // or a gchar* string that must be g_free'd by the user
\r
228 // - 'title' is the dialog title (can be NULL)
\r
229 // - 'path' is used to set the initial directory (can be NULL)
\r
230 // - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
\r
231 // TTimo 04/01/2001 toolkit-independant, cast parent to a GtkWidget*
\r
232 typedef const gchar* (* PFN_QERAPP_FILEDIALOG) (void *parent, gboolean open, const char* title,
\r
233 const char* path, const char* pattern);
\r
234 typedef gchar* (WINAPI* PFN_QERAPP_DIRDIALOG) (void *parent, const char* title,
\r
237 // return true if the user closed the dialog with 'Ok'
\r
238 // 'color' is used to set the initial value and store the selected value
\r
239 typedef bool (WINAPI* PFN_QERAPP_COLORDIALOG) (void *parent, float *color,
\r
240 const char* title);
\r
242 // load a .bmp file and store the results in 'gdkpixmap' and 'mask'
\r
243 // returns TRUE on success but even if it fails, it creates an empty pixmap
\r
244 // NOTE: 'filename' is relative to <radiant_path>/plugins/bitmaps/
\r
245 // TTimo 04/01/2001 toolkit-independant, cast gkpixmap to GdkPixmap and mask to GdkBitmap
\r
246 typedef bool (WINAPI* PFN_QERAPP_LOADBITMAP) (const char* filename, void **gdkpixmap, void **mask);
\r
248 // ========================================
\r
249 // read/write preferences file
\r
251 // use this function to get the directory where the preferences file are stored
\r
252 typedef const char* (WINAPI* PFN_QERAPP_PROFILE_GETDIR) ();
\r
254 // 'filename' is the absolute path
\r
255 typedef bool (WINAPI* PFN_QERAPP_PROFILE_SAVEINT) (const char *filename, const char *section,
\r
256 const char *key, int value);
\r
257 typedef bool (WINAPI* PFN_QERAPP_PROFILE_SAVESTR) (const char *filename, const char *section,
\r
258 const char *key, const char *value);
\r
259 typedef int (WINAPI* PFN_QERAPP_PROFILE_LOADINT) (const char *filename, const char *section,
\r
260 const char *key, int default_value);
\r
261 typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const char *section,
\r
262 const char *key, const char *default_value);
\r
264 //=========================================
\r
265 // editor functions
\r
267 // There are 3 potential brush handle lists
\r
268 // 1. the list that contains brushes a plugin creates using CreateBrushHandle
\r
269 // 2. the selected brush list (brushes the user has selected)
\r
270 // 3. the active brush list (brushes in the map that are not selected)
\r
272 // In general, the same things can be done to brush handles (face manip, delete brushhandle, etc.. ) in each
\r
273 // list. There are a few exceptions.
\r
274 // 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map.
\r
275 // 2. You cannot bind brush handles from the selected or active brush list to an entity. As of v1.0 of the plugins
\r
276 // the only way for a plugin to create entities is to create a brush handles (or a list of handles) and then bind
\r
277 // them to an entity. This will commit the brush(s) and/or the entities to the map as well.
\r
279 // To use the active or selected brush lists, you must first allocate them (which returns a count) and then
\r
280 // release them when you are finish manipulating brushes in one of those lists.
\r
282 //++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor
\r
284 // brush manipulation routines
\r
285 #define QERAPP_CREATEBRUSH "QERApp_CreateBrush"
\r
286 #define QERAPP_CREATEBRUSHHANDLE "QERApp_CreateBrushHandle"
\r
287 #define QERAPP_DELETEBRUSHHANDLE "QERApp_DeleteBrushHandle"
\r
288 #define QERAPP_COMMITBRUSHHANDLETOMAP "QERApp_CommitBrushHandleToMap"
\r
289 //++timo not implemented .. remove
\r
290 // #define QERAPP_BINDHANDLESTOENTITY "QERApp_BindHandlesToEntity"
\r
291 #define QERAPP_ADDFACE "QERApp_AddFace"
\r
292 #define QERAPP_ADDFACEDATA "QERApp_AddFaceData"
\r
293 #define QERAPP_GETFACECOUNT "QERApp_GetFaceCount"
\r
294 #define QERAPP_GETFACEDATA "QERApp_GetFaceData"
\r
295 #define QERAPP_SETFACEDATA "QERApp_SetFaceData"
\r
296 #define QERAPP_DELETEFACE "QERApp_DeleteFace"
\r
297 #define QERAPP_TEXTUREBRUSH "QERApp_TextureBrush"
\r
298 #define QERAPP_BUILDBRUSH "QERApp_BuildBrush" // PGM
\r
299 #define QERAPP_SELECTEDBRUSHCOUNT "QERApp_SelectedBrushCount"
\r
300 #define QERAPP_ALLOCATESELECTEDBRUSHHANDLES "QERApp_AllocateSelectedBrushHandles"
\r
301 #define QERAPP_RELEASESELECTEDBRUSHHANDLES "QERApp_ReleaseSelectedBrushHandles"
\r
302 #define QERAPP_GETSELECTEDBRUSHHANDLE "QERApp_GetSelectedBrushHandle"
\r
303 #define QERAPP_ACTIVEBRUSHCOUNT "QERApp_ActiveBrushCount"
\r
304 #define QERAPP_ALLOCATEACTIVEBRUSHHANDLES "QERApp_AllocateActiveBrushHandles"
\r
305 #define QERAPP_RELEASEACTIVEBRUSHHANDLES "QERApp_ReleaseActiveBrushHandles"
\r
306 #define QERAPP_GETACTIVEBRUSHHANDLE "QERApp_GetActiveBrushHandle"
\r
309 #define QERAPP_TEXTURECOUNT "QERApp_TextureCount"
\r
310 #define QERAPP_GETTEXTURE "QERApp_GetTexture"
\r
311 #define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture"
\r
312 #define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture"
\r
315 #define QERAPP_DELETESELECTION "QERApp_DeleteSelection"
\r
316 #define QERAPP_SELECTBRUSH "QERApp_SelectBrush" // PGM
\r
317 #define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush" // PGM
\r
318 #define QERAPP_DESELECTALLBRUSHES "QERApp_DeselectAllBrushes" // PGM
\r
321 #define QERAPP_GETPOINTS "QERApp_GetPoints"
\r
322 #define QERAPP_SELECTBRUSHES "QERApp_GetBrushes"
\r
324 // entity class stuff
\r
325 // the entity handling is very basic for 1.0
\r
326 #define QERAPP_GETECLASSCOUNT "QERApp_GetEClassCount"
\r
327 #define QERAPP_GETECLASS "QERApp_GetEClass"
\r
330 #define QERAPP_SYSMSG "QERApp_SysMsg"
\r
331 #define QERAPP_INFOMSG "QERApp_InfoMsg"
\r
332 #define QERAPP_HIDEINFOMSG "QERApp_HideInfoMsg"
\r
333 #define QERAPP_RESET_PLUGINS "QERApp_ResetPlugins"
\r
336 #define QERAPP_LOADTEXTURERGBA "QERApp_LoadTextureRGBA"
\r
338 // FIXME: the following are not implemented yet
\r
339 // hook registrations
\r
340 #define QERAPP_REGISTER_MAPLOADFUNC "QERApp_Register_MapLoadFunc"
\r
341 #define QERAPP_REGISTER_MAPSAVEFUNC "QERApp_Register_MapSaveFunc"
\r
343 // FIXME: the following are not implemented yet
\r
344 #define QERAPP_REGISTER_PROJECTLOADFUNC "QERApp_Register_ProjectLoadFunc"
\r
345 #define QERAPP_REGISTER_MOUSEHANDLER "QERApp_Register_MouseHandler"
\r
346 #define QERAPP_REGISTER_KEYHANDLER "QERApp_Register_KeyHandler"
\r
348 // FIXME: new primtives do not work in v1.00
\r
349 // primitives are new types of things in the map
\r
350 // for instance, the Q3 curves could have been done as
\r
351 // primitives instead of being built in
\r
352 // it will be a plugins responsibility to hook the map load and save funcs to load
\r
353 // and/or save any additional data (like new primitives of some type)
\r
354 // the editor will call each registered renderer during the rendering process to repaint
\r
355 // any primitives the plugin owns
\r
356 // each primitive object has a temporary sibling brush that lives in the map
\r
357 // FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner
\r
358 // basically a plugin will hook the map load and save and will add the primitives to the map.. this will
\r
359 // produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the
\r
360 // edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex
\r
361 // mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler
\r
362 // so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the
\r
363 // sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives
\r
364 // as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check
\r
365 // here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that
\r
366 // crap but it looks like a nice place for a mess)
\r
367 #define QERAPP_REGISTER_PRIMITIVE "QERApp_Register_Primitive"
\r
368 #define QERAPP_REGISTER_RENDERER "QERApp_Register_Renderer"
\r
369 #define QERAPP_REGISTER_EDITHANDLER "QERApp_Register_EditHandler"
\r
370 #define QERAPP_REGISTER_VERTEXMAKER "QERApp_Register_VertexMaker"
\r
371 #define QERAPP_ADDPRIMITIVE "QERApp_AddPrimitive"
\r
374 #define QERAPP_GETENTITYCOUNT "QERApp_GetEntityCount"
\r
375 #define QERAPP_GETENTITYHANDLE "QERApp_GetEntityHandle"
\r
376 //++timo not implemented for the moment
\r
377 // #define QERAPP_GETENTITYINFO "QERApp_GetEntityInfo"
\r
378 //++timo does the keyval need some more funcs to add/remove ?
\r
379 // get the pointer and do the changes yourself
\r
380 #define QERAPP_ALLOCATEEPAIR "QERApp_AllocateEpair"
\r
381 #define QERAPP_ALLOCATEENTITYBRUSHHANDLES "QERApp_AllocateEntityBrushHandles"
\r
382 #define QERAPP_RELEASEENTITYBRUSHHANDLES "QERApp_ReleaseEntityBrushHandles"
\r
383 #define QERAPP_GETENTITYBRUSHHANDLE "QERApp_GetEntityBrushHandle"
\r
384 #define QERAPP_CREATEENTITYHANDLE "QERApp_CreateEntityHandle"
\r
385 #define QERAPP_COMMITBRUSHHANDLETOENTITY "QERApp_CommitBrushHandleToEntity"
\r
386 #define QERAPP_COMMITENTITYHANDLETOMAP "QERApp_CommitEntityHandleToMap"
\r
387 #define QERAPP_SETSCREENUPDATE "QERApp_SetScreenUpdate"
\r
388 #define QERAPP_BUILDBRUSH2 "QERApp_BuildBrush2"
\r
392 #define QERAPP_GETDISPATCHPARAMS "QERApp_GetDispatchParams"
\r
394 struct _QERPointData
\r
397 vec3_t *m_pVectors;
\r
400 struct _QERFaceData
\r
402 char m_TextureName[QER_MAX_NAMELEN];
\r
409 vec3_t m_v1, m_v2, m_v3;
\r
410 // brush primitive additions
\r
411 qboolean m_bBPrimit;
\r
412 brushprimit_texdef_t brushprimit_texdef;
\r
415 typedef void (WINAPI * PFN_QERAPP_CREATEBRUSH)(vec3_t vMin, vec3_t vMax);
\r
417 typedef void* (WINAPI * PFN_QERAPP_CREATEBRUSHHANDLE)();
\r
418 typedef void (WINAPI * PFN_QERAPP_DELETEBRUSHHANDLE)(void* pv);
\r
419 typedef void (WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOMAP)(void* pv);
\r
420 typedef void (WINAPI * PFN_QERAPP_ADDFACE)(void* pv, vec3_t v1, vec3_t v2, vec3_t v3);
\r
422 typedef void (WINAPI * PFN_QERAPP_ADDFACEDATA)(void* pv, _QERFaceData *pData);
\r
423 typedef int (WINAPI * PFN_QERAPP_GETFACECOUNT)(void* pv);
\r
424 typedef _QERFaceData* (WINAPI * PFN_QERAPP_GETFACEDATA)(void* pv, int nFaceIndex);
\r
425 typedef void (WINAPI * PFN_QERAPP_SETFACEDATA)(void* pv, int nFaceIndex, _QERFaceData *pData);
\r
426 typedef void (WINAPI * PFN_QERAPP_DELETEFACE)(void* pv, int nFaceIndex);
\r
427 typedef void (WINAPI * PFN_QERAPP_TEXTUREBRUSH)(void* pv, char* pName);
\r
428 typedef void (WINAPI * PFN_QERAPP_BUILDBRUSH)(void* pv); // PGM
\r
429 typedef void (WINAPI * PFN_QERAPP_SELECTBRUSH)(void* pv); // PGM
\r
430 typedef void (WINAPI * PFN_QERAPP_DESELECTBRUSH)(void* pv); // PGM
\r
431 typedef void (WINAPI * PFN_QERAPP_DESELECTALLBRUSHES)(); // PGM
\r
433 typedef void (WINAPI * PFN_QERAPP_DELETESELECTION)();
\r
434 typedef void (WINAPI * PFN_QERAPP_GETPOINTS)(int nMax, _QERPointData *pData, char* pMsg);
\r
436 typedef int (WINAPI * PFN_QERAPP_SELECTEDBRUSHCOUNT)();
\r
437 typedef int (WINAPI * PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES)();
\r
438 typedef void (WINAPI * PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES)();
\r
439 typedef void* (WINAPI * PFN_QERAPP_GETSELECTEDBRUSHHANDLE)(int nIndex);
\r
441 typedef int (WINAPI * PFN_QERAPP_ACTIVEBRUSHCOUNT)();
\r
442 typedef int (WINAPI * PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES)();
\r
443 typedef void (WINAPI * PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES)();
\r
444 typedef void* (WINAPI * PFN_QERAPP_GETACTIVEBRUSHHANDLE)(int nIndex);
\r
446 typedef int (WINAPI * PFN_QERAPP_TEXTURECOUNT)();
\r
447 typedef char* (WINAPI * PFN_QERAPP_GETTEXTURE)(int nIndex);
\r
448 typedef char* (WINAPI * PFN_QERAPP_GETCURRENTTEXTURE)();
\r
449 typedef void (WINAPI * PFN_QERAPP_SETCURRENTTEXTURE)(char* pName);
\r
451 typedef void (WINAPI * PFN_QERAPP_REGISTERMAPLOAD)(void* vp);
\r
452 typedef void (WINAPI * PFN_QERAPP_REGISTERMAPSAVE)(void* vp);
\r
454 typedef int (WINAPI * PFN_QERAPP_GETECLASSCOUNT)();
\r
455 typedef char* (WINAPI * PFN_QERAPP_GETECLASS)(int nIndex);
\r
457 typedef void (WINAPI * PFN_QERAPP_RESETPLUGINS)();
\r
458 //--typedef int (WINAPI* PFN_QERAPP_GETENTITYCOUNT)();
\r
461 \fn LoadTextureRGBA
\r
462 \param pPixels is the raw RGBA pixel data (24bits, 8 bit depth)
\r
463 \param nWidth image width
\r
464 \param nHeight image height
\r
465 this will work from the RGBA data and create a GL texture (accessed through a GL bind number)
\r
466 it takes care of creating the mipmapping levels too
\r
467 see http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=575 for some related issues
\r
469 typedef qtexture_t* (* PFN_QERAPP_LOADTEXTURERGBA)(unsigned char* pPixels, int nWidth, int nHeight);
\r
471 //--typedef LPCSTR (WINAPI* PFN_QERAPP_GETENTITY)(int nIndex);
\r
474 typedef int (WINAPI * PFN_QERAPP_GETENTITYCOUNT)();
\r
475 typedef void* (WINAPI * PFN_QERAPP_GETENTITYHANDLE)(int nIndex);
\r
476 // FIXME: those two are fairly outdated, you get the epairs
\r
477 // but you don't have a clean epair read/write query
\r
478 // and you rely on the C structs directly, which might go away soon
\r
479 // ok now, stop using, it's bad for your karma (see iepairs.h instead)
\r
480 typedef epair_t* (WINAPI * PFN_QERAPP_ALLOCATEEPAIR)( char*, char* );
\r
481 typedef int (WINAPI * PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES)(void* vp);
\r
482 typedef void (WINAPI * PFN_QERAPP_RELEASEENTITYBRUSHHANDLES)();
\r
483 typedef void* (WINAPI * PFN_QERAPP_GETENTITYBRUSHHANDLE)(int nIndex);
\r
484 typedef void* (WINAPI * PFN_QERAPP_CREATEENTITYHANDLE)();
\r
485 typedef void (WINAPI * PFN_QERAPP_COMMITBRUSHHANDLETOENTITY)( void* vpBrush, void* vpEntity);
\r
486 typedef void (WINAPI * PFN_QERAPP_COMMITENTITYHANDLETOMAP)(void* vp);
\r
487 typedef void (WINAPI * PFN_QERAPP_SETSCREENUPDATE)(int bScreenUpdate);
\r
488 // this one uses window flags defined in qertypes.h
\r
489 typedef void (WINAPI * PFN_QERAPP_SYSUPDATEWINDOWS)(int bits);
\r
490 //++timo remove this one
\r
491 typedef void (WINAPI * PFN_QERAPP_BUILDBRUSH2)(void* vp, int bConvert);
\r
494 typedef void (WINAPI * PFN_QERAPP_GETDISPATCHPARAMS)(vec3_t vMin, vec3_t vMax, bool *bSingleBrush);
\r
496 typedef int (WINAPI * PFN_QERAPP_REQUESTINTERFACE)( REFGUID, void* );
\r
497 // use this one for errors, Radiant will stop after the "edit preferences" dialog
\r
498 typedef void (WINAPI * PFN_QERAPP_ERROR)(char* pMsg, ...);
\r
499 // use to gain read access to the project epairs
\r
500 // FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface
\r
501 // typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **);
\r
502 // used to allocate and read a buffer
\r
503 //++timo NOTE: perhaps this would need moving to some kind of dedicated interface
\r
504 typedef int (WINAPI * PFN_QERAPP_LOADFILE)(const char *pLocation, void ** buffer);
\r
505 typedef char* (WINAPI * PFN_QERAPP_EXPANDRELETIVEPATH)(char *);
\r
506 typedef void (WINAPI * PFN_QERAPP_QECONVERTDOSTOUNIXNAME)( char *dst, const char *src );
\r
507 typedef int (WINAPI * PFN_QERAPP_HASSHADER)(const char *);
\r
508 typedef int (WINAPI * PFN_QERAPP_TEXTURELOADSKIN)(char *pName, int *pnWidth, int *pnHeight);
\r
509 // retrieves the path to the engine from the preferences dialog box
\r
510 typedef const char* (WINAPI * PFN_QERAPP_GETGAMEPATH)();
\r
511 // retrieves full Radiant path
\r
512 typedef const char* (WINAPI * PFN_QERAPP_GETQERPATH)();
\r
513 // retieves .game name of current active game
\r
514 typedef const char* (WINAPI * PFN_QERAPP_GETGAMEFILE)();
\r
517 // NOTE: this is a bit different from the brushes in/out, no LPVOID handles this time
\r
518 // use int indexes instead
\r
519 // if you call AllocateActivePatchHandles, you'll be playing with active patches
\r
520 // AllocateSelectedPatcheHandles for selected stuff
\r
521 // a call to CreatePatchHandle will move you to a seperate index table
\r
522 typedef int (WINAPI * PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES) ();
\r
523 typedef int (WINAPI * PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES) ();
\r
524 typedef void (WINAPI * PFN_QERAPP_RELEASEPATCHHANDLES) ();
\r
525 typedef patchMesh_t* (WINAPI * PFN_QERAPP_GETPATCHDATA) (int);
\r
526 typedef patchMesh_t* (WINAPI * PFN_QERAPP_GETPATCHHANDLE) (int);
\r
527 typedef void (WINAPI * PFN_QERAPP_DELETEPATCH) (int);
\r
528 typedef int (WINAPI * PFN_QERAPP_CREATEPATCHHANDLE) ();
\r
529 // when commiting, only a few patchMesh_t members are relevant:
\r
530 // int width, height; // in control points, not patches
\r
531 // int contents, flags, value, type;
\r
532 // drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
\r
533 // once you have commited the index is still available, if the patch handle was allocated by you
\r
534 // then you can re-use the index to commit other patches .. otherwise you can change existing patches
\r
535 // NOTE: the handle thing for plugin-allocated patches is a bit silly (nobody's perfect)
\r
536 // TODO: change current behaviour to an index = 0 to tell Radiant to allocate, other indexes to existing patches
\r
537 // patch is selected after a commit
\r
538 // you can add an optional texture / shader name .. if NULL will use the current texture
\r
539 typedef void (WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOMAP) (int, patchMesh_t* pMesh, char *texName);
\r
540 typedef void (WINAPI * PFN_QERAPP_COMMITPATCHHANDLETOENTITY) (int, patchMesh_t* pMesh, char *texName, void* vpEntity);
\r
543 #define SYS_VRB 0 ///< verbose support (on/off)
\r
544 #define SYS_STD 1 ///< standard print level - this is the default
\r
545 #define SYS_WRN 2 ///< warnings
\r
546 #define SYS_ERR 3 ///< error
\r
547 #define SYS_NOCON 4 ///< no console, only print to the file (useful whenever Sys_Printf and output IS the problem)
\r
548 typedef void (WINAPI* PFN_QERAPP_SYSPRINTF) (const char *text, ...);
\r
549 typedef void (WINAPI* PFN_QERAPP_SYSFPRINTF) (int flag, const char *text, ...);
\r
551 typedef void (WINAPI* PFN_QERAPP_SYSBEGINWAIT) ();
\r
552 typedef void (WINAPI* PFN_QERAPP_SYSENDWAIT) ();
\r
554 typedef void (* PFN_QERAPP_SYSBEEP) ();
\r
556 typedef void (* PFN_QERAPP_SYSSTATUS) (const char *psz, int part );
\r
558 // core map functionality
\r
559 typedef void (* PFN_QERAPP_MAPNEW) ();
\r
560 typedef void (* PFN_QERAPP_MAPFREE) ();
\r
561 typedef void (* PFN_QERAPP_MAPBUILDBRUSHDATA) ();
\r
562 typedef qboolean (* PFN_QERAPP_MAPISBRUSHFILTERED) (brush_t *);
\r
563 typedef void (* PFN_QERAPP_MAPSTARTPOSITION) ();
\r
564 typedef void (* PFN_QERAPP_MAPREGIONOFF) ();
\r
565 //typedef void (* PFN_QERAPP_SAVEASDIALOG) (bool bRegion);
\r
566 typedef void (* PFN_QERAPP_SETBUILDWINDINGSNOTEXBUILD) (bool);
\r
567 typedef void (* PFN_QERAPP_POINTFILECLEAR) ();
\r
569 typedef void (* PFN_QERAPP_SYSSETTITLE) (const char *text);
\r
571 typedef void (* PFN_QERAPP_CSGMAKEHOLLOW) ();
\r
573 typedef void (* PFN_QERAPP_REGIONSPAWNPOINT) (FILE *f);
\r
576 access to a portable GetTickCount
\r
578 typedef unsigned long (* PFN_QERAPP_GETTICKCOUNT) ();
\r
583 virtual entity_interfaces_t *GetByID(const char *id, const char* version) = 0;
\r
584 virtual void DeleteByID(const char *id, const char* version) = 0;
\r
585 virtual void RefreshAll() = 0;
\r
588 typedef IModelCache* (* PFN_GETMODELCACHE)();
\r
590 class IFileTypeList
\r
593 virtual void addType(filetype_t type) = 0;
\r
596 class IFileTypeRegistry
\r
599 virtual void addType(const char* key, filetype_t type) = 0;
\r
600 virtual void getTypeList(const char* key, IFileTypeList* typelist) = 0;
\r
604 typedef IFileTypeRegistry* (* PFN_GETFILETYPEREGISTRY)();
\r
606 typedef const char* (* PFN_QERAPP_READPROJECTKEY)(const char* key);
\r
608 typedef char* (* PFN_GETMAPFILENAME)();
\r
611 // add map format extensions
\r
612 // add texture format handlers
\r
613 // add surface dialog handler
\r
614 // add model handler/displayer
\r
617 // Plugins need to declare one of these and implement the getfunctable as described above
\r
618 struct _QERFuncTable_1
\r
621 PFN_QERAPP_CREATEBRUSH m_pfnCreateBrush;
\r
622 PFN_QERAPP_CREATEBRUSHHANDLE m_pfnCreateBrushHandle;
\r
623 PFN_QERAPP_DELETEBRUSHHANDLE m_pfnDeleteBrushHandle;
\r
624 PFN_QERAPP_COMMITBRUSHHANDLETOMAP m_pfnCommitBrushHandle;
\r
625 PFN_QERAPP_ADDFACE m_pfnAddFace;
\r
626 PFN_QERAPP_ADDFACEDATA m_pfnAddFaceData;
\r
627 PFN_QERAPP_GETFACEDATA m_pfnGetFaceData;
\r
628 PFN_QERAPP_GETFACECOUNT m_pfnGetFaceCount;
\r
629 PFN_QERAPP_SETFACEDATA m_pfnSetFaceData;
\r
630 PFN_QERAPP_DELETEFACE m_pfnDeleteFace;
\r
631 PFN_QERAPP_TEXTUREBRUSH m_pfnTextureBrush;
\r
632 PFN_QERAPP_BUILDBRUSH m_pfnBuildBrush; // PGM
\r
633 PFN_QERAPP_SELECTBRUSH m_pfnSelectBrush; // PGM
\r
634 PFN_QERAPP_DESELECTBRUSH m_pfnDeselectBrush; // PGM
\r
635 PFN_QERAPP_DESELECTALLBRUSHES m_pfnDeselectAllBrushes; // PGM
\r
637 PFN_QERAPP_DELETESELECTION m_pfnDeleteSelection;
\r
638 PFN_QERAPP_GETPOINTS m_pfnGetPoints;
\r
640 PFN_QERAPP_SELECTEDBRUSHCOUNT m_pfnSelectedBrushCount;
\r
641 PFN_QERAPP_ALLOCATESELECTEDBRUSHHANDLES m_pfnAllocateSelectedBrushHandles;
\r
642 PFN_QERAPP_RELEASESELECTEDBRUSHHANDLES m_pfnReleaseSelectedBrushHandles;
\r
643 PFN_QERAPP_GETSELECTEDBRUSHHANDLE m_pfnGetSelectedBrushHandle;
\r
645 PFN_QERAPP_ACTIVEBRUSHCOUNT m_pfnActiveBrushCount;
\r
646 PFN_QERAPP_ALLOCATEACTIVEBRUSHHANDLES m_pfnAllocateActiveBrushHandles;
\r
647 PFN_QERAPP_RELEASEACTIVEBRUSHHANDLES m_pfnReleaseActiveBrushHandles;
\r
648 PFN_QERAPP_GETACTIVEBRUSHHANDLE m_pfnGetActiveBrushHandle;
\r
650 //++timo this would need to be removed and replaced by the IShaders interface
\r
651 PFN_QERAPP_TEXTURECOUNT m_pfnTextureCount;
\r
652 PFN_QERAPP_GETTEXTURE m_pfnGetTexture;
\r
653 PFN_QERAPP_GETCURRENTTEXTURE m_pfnGetCurrentTexture;
\r
654 PFN_QERAPP_SETCURRENTTEXTURE m_pfnSetCurrentTexture;
\r
656 PFN_QERAPP_GETECLASSCOUNT m_pfnGetEClassCount;
\r
657 PFN_QERAPP_GETECLASS m_pfnGetEClass;
\r
658 PFN_QERAPP_RESETPLUGINS m_pfnResetPlugins;
\r
660 // v1.50 starts here
\r
661 PFN_QERAPP_LOADTEXTURERGBA m_pfnLoadTextureRGBA;
\r
663 // v1.70 starts here
\r
664 PFN_QERAPP_GETENTITYCOUNT m_pfnGetEntityCount;
\r
665 PFN_QERAPP_GETENTITYHANDLE m_pfnGetEntityHandle;
\r
666 PFN_QERAPP_ALLOCATEENTITYBRUSHHANDLES m_pfnAllocateEntityBrushHandles;
\r
667 PFN_QERAPP_RELEASEENTITYBRUSHHANDLES m_pfnReleaseEntityBrushHandles;
\r
668 PFN_QERAPP_GETENTITYBRUSHHANDLE m_pfnGetEntityBrushHandle;
\r
669 PFN_QERAPP_CREATEENTITYHANDLE m_pfnCreateEntityHandle;
\r
670 PFN_QERAPP_COMMITBRUSHHANDLETOENTITY m_pfnCommitBrushHandleToEntity;
\r
671 PFN_QERAPP_COMMITENTITYHANDLETOMAP m_pfnCommitEntityHandleToMap;
\r
672 PFN_QERAPP_ALLOCATEEPAIR m_pfnAllocateEpair;
\r
673 PFN_QERAPP_SETSCREENUPDATE m_pfnSetScreenUpdate;
\r
674 PFN_QERAPP_BUILDBRUSH2 m_pfnBuildBrush2;
\r
676 // v1.80 starts here
\r
677 PFN_QERAPP_GETDISPATCHPARAMS m_pfnGetDispatchParams;
\r
679 // plugins can request additional interfaces
\r
680 PFN_QERAPP_REQUESTINTERFACE m_pfnRequestInterface;
\r
681 PFN_QERAPP_ERROR m_pfnError;
\r
682 // loading a file into a buffer
\r
683 PFN_QERAPP_LOADFILE m_pfnLoadFile;
\r
684 PFN_QERAPP_EXPANDRELETIVEPATH m_pfnExpandReletivePath;
\r
685 PFN_QERAPP_QECONVERTDOSTOUNIXNAME m_pfnQE_ConvertDOSToUnixName;
\r
686 PFN_QERAPP_HASSHADER m_pfnHasShader;
\r
687 PFN_QERAPP_TEXTURELOADSKIN m_pfnTexture_LoadSkin;
\r
688 PFN_QERAPP_GETGAMEPATH m_pfnGetGamePath;
\r
689 PFN_QERAPP_GETQERPATH m_pfnGetQERPath;
\r
690 PFN_QERAPP_GETGAMEFILE m_pfnGetGameFile;
\r
691 // patches in / out
\r
692 PFN_QERAPP_ALLOCATEACTIVEPATCHHANDLES m_pfnAllocateActivePatchHandles;
\r
693 PFN_QERAPP_ALLOCATESELECTEDPATCHHANDLES m_pfnAllocateSelectedPatchHandles;
\r
694 PFN_QERAPP_RELEASEPATCHHANDLES m_pfnReleasePatchHandles;
\r
695 PFN_QERAPP_GETPATCHDATA m_pfnGetPatchData;
\r
696 PFN_QERAPP_GETPATCHHANDLE m_pfnGetPatchHandle;
\r
697 PFN_QERAPP_DELETEPATCH m_pfnDeletePatch;
\r
698 PFN_QERAPP_CREATEPATCHHANDLE m_pfnCreatePatchHandle;
\r
699 PFN_QERAPP_COMMITPATCHHANDLETOMAP m_pfnCommitPatchHandleToMap;
\r
700 PFN_QERAPP_COMMITPATCHHANDLETOENTITY m_pfnCommitPatchHandleToEntity;
\r
702 PFN_QERAPP_LOADIMAGE m_pfnLoadImage;
\r
705 PFN_QERAPP_MESSAGEBOX m_pfnMessageBox;
\r
706 PFN_QERAPP_FILEDIALOG m_pfnFileDialog;
\r
707 PFN_QERAPP_DIRDIALOG m_pfnDirDialog;
\r
708 PFN_QERAPP_COLORDIALOG m_pfnColorDialog;
\r
709 PFN_QERAPP_LOADBITMAP m_pfnLoadBitmap;
\r
711 // Profile functions
\r
712 PFN_QERAPP_PROFILE_GETDIR m_pfnProfileGetDirectory;
\r
713 PFN_QERAPP_PROFILE_SAVEINT m_pfnProfileSaveInt;
\r
714 PFN_QERAPP_PROFILE_SAVESTR m_pfnProfileSaveString;
\r
715 PFN_QERAPP_PROFILE_LOADINT m_pfnProfileLoadInt;
\r
716 PFN_QERAPP_PROFILE_LOADSTR m_pfnProfileLoadString;
\r
719 PFN_QERAPP_SYSUPDATEWINDOWS m_pfnSysUpdateWindows;
\r
720 PFN_QERAPP_SYSBEEP m_pfnSysBeep;
\r
721 PFN_QERAPP_SYSPRINTF m_pfnSysPrintf;
\r
722 PFN_QERAPP_SYSFPRINTF m_pfnSysFPrintf;
\r
723 PFN_QERAPP_SYSBEGINWAIT m_pfnSysBeginWait;
\r
724 PFN_QERAPP_SYSENDWAIT m_pfnSysEndWait;
\r
725 PFN_QERAPP_SYSSETTITLE m_pfnSys_SetTitle;
\r
726 PFN_QERAPP_SYSSTATUS m_pfnSys_Status;
\r
728 // some core functionality on the map
\r
729 PFN_QERAPP_MAPNEW m_pfnMapNew;
\r
730 PFN_QERAPP_MAPFREE m_pfnMapFree;
\r
731 PFN_QERAPP_MAPBUILDBRUSHDATA m_pfnMapBuildBrushData;
\r
732 PFN_QERAPP_MAPISBRUSHFILTERED m_pfnMap_IsBrushFiltered;
\r
733 PFN_QERAPP_MAPSTARTPOSITION m_pfnMapStartPosition;
\r
734 PFN_QERAPP_MAPREGIONOFF m_pfnMapRegionOff;
\r
735 PFN_QERAPP_SETBUILDWINDINGSNOTEXBUILD m_pfnSetBuildWindingsNoTexBuild;
\r
736 // PFN_QERAPP_SAVEASDIALOG m_pfnSaveAsDialog;
\r
737 PFN_QERAPP_POINTFILECLEAR m_pfnPointFileClear;
\r
739 // FIXME TTimo prolly want to move that somewhere else
\r
740 PFN_QERAPP_CSGMAKEHOLLOW m_pfnCSG_MakeHollow;
\r
742 PFN_QERAPP_REGIONSPAWNPOINT m_pfnRegionSpawnPoint;
\r
743 PFN_QERAPP_GETTICKCOUNT m_pfnQGetTickCount;
\r
744 PFN_GETMODELCACHE m_pfnGetModelCache;
\r
745 PFN_GETFILETYPEREGISTRY m_pfnGetFileTypeRegistry;
\r
747 PFN_QERAPP_READPROJECTKEY m_pfnReadProjectKey;
\r
749 // digibob from the old _QERAppBSPFrontendTable table
\r
750 PFN_GETMAPFILENAME m_pfnGetMapName;
\r
753 // macros to access those faster in plugins
\r
754 #ifdef USE_QERTABLE_DEFINE
\r
755 #ifndef __QERTABLENAME
\r
756 #define __QERTABLENAME g_FuncTable
\r
758 #define CSG_MakeHollow __QERTABLENAME.m_pfnCSG_MakeHollow
\r
759 #define Sys_Beep __QERTABLENAME.m_pfnSysBeep
\r
760 #define Sys_Printf __QERTABLENAME.m_pfnSysPrintf
\r
761 #define Sys_FPrintf __QERTABLENAME.m_pfnSysFPrintf
\r
762 #define Sys_BeginWait __QERTABLENAME.m_pfnSysBeginWait
\r
763 #define Sys_EndWait __QERTABLENAME.m_pfnSysEndWait
\r
764 #define Sys_UpdateWindows __QERTABLENAME.m_pfnSysUpdateWindows
\r
765 #define Sys_SetTitle __QERTABLENAME.m_pfnSys_SetTitle
\r
766 #define Sys_Status __QERTABLENAME.m_pfnSys_Status
\r
767 #define Select_Deselect __QERTABLENAME.m_pfnDeselectAllBrushes
\r
768 #define Map_New __QERTABLENAME.m_pfnMapNew
\r
769 #define Map_Free __QERTABLENAME.m_pfnMapFree
\r
770 #define Map_IsBrushFiltered __QERTABLENAME.m_pfnMap_IsBrushFiltered
\r
771 #define Map_BuildBrushData __QERTABLENAME.m_pfnMapBuildBrushData
\r
772 #define Map_StartPosition __QERTABLENAME.m_pfnMapStartPosition
\r
773 #define Map_RegionOff __QERTABLENAME.m_pfnMapRegionOff
\r
774 #define QE_ConvertDOSToUnixName __QERTABLENAME.m_pfnQE_ConvertDOSToUnixName
\r
775 #define SetBuildWindingsNoTexBuild __QERTABLENAME.m_pfnSetBuildWindingsNoTexBuild
\r
776 //#define SaveAsDialog __QERTABLENAME.m_pfnSaveAsDialog
\r
777 #define Pointfile_Clear __QERTABLENAME.m_pfnPointFileClear
\r
778 #define SetScreenUpdate __QERTABLENAME.m_pfnSetScreenUpdate
\r
779 #define Region_SpawnPoint __QERTABLENAME.m_pfnRegionSpawnPoint
\r
780 #define QGetTickCount __QERTABLENAME.m_pfnGetTickCount
\r
781 #define GetModelCache __QERTABLENAME.m_pfnGetModelCache
\r
782 #define GetFileTypeRegistry __QERTABLENAME.m_pfnGetFileTypeRegistry
\r
784 IFileTypeRegistry* GetFileTypeRegistry();
\r