2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 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.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 // disable data conversion warnings for gl
28 #pragma warning(disable : 4244) // MIPS
29 #pragma warning(disable : 4136) // X86
30 #pragma warning(disable : 4051) // ALPHA
31 #pragma warning(disable : 4800)
34 // for interfaces, we require main plugin header included
36 #include "qerplugin.h"
39 #include "missing.h" // temporary stuff, needs to be removed
40 #include "idatastream.h"
51 // this is the version to expect from template projects
52 #define PROJECT_VERSION 2
57 #define malloc(a) debug_malloc(a, __FILE__, __LINE__)
58 #define free(a) debug_free(a, __FILE__, __LINE__)
60 void* debug_malloc (size_t size, const char* file, int line);
61 void debug_free (void *buf, const char* file, int line);
66 //#define DBG_WINDOWPOS
70 void CheckWatchit(char *msg);
73 // those two files are generated
74 // if they are missing, you NEED to run makeversion.sh
75 // NOTE: for win32 users, cygwin installation is REQUIRED to run makeversion.sh
76 // NOTE TTimo if any of those changes (they might change a lot), then the whole app is rebuilt.
77 // very often it's not necessary
81 // synapse is our utility lib for dynamic shared objects management
94 #define USE_ENTITYTABLE_DEFINE
96 extern _QEREntityTable __ENTITYTABLENAME;
97 // wrappers for brush access
99 // wrappers for patch access
108 extern _QERPlugMapTable g_MapTable;
110 //++timo for BP conversion escaping FIXME: remove when mixing two formats!
111 extern bool g_bCancel_Map_LoadFile;
112 // used to be #defines, multiple engine support suggests we should go towards dynamic
113 extern int g_MaxWorldCoord;
114 extern int g_MinWorldCoord;
115 extern int g_MaxBrushSize;
117 // set to true when we are parsing a terrain entity
118 extern bool g_bParseTerrain;
119 extern IShader *g_pTerrainShader, *g_pCaulk;
129 #include "glwidget.h"
131 // the dec offsetof macro doesn't work very well...
132 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
134 // set these before calling CheckParm
136 extern char **myargv;
138 // our own implementation of Q_int, clamping can be disabled on prefs
139 vec_t Rad_rint (vec_t in);
141 double I_FloatTime (void);
143 void Error (const char *error, ...);
144 int CheckParm (const char *check);
145 void ParseCommandLine (char *lpCmdLine);
147 int ParseNum (const char *str);
149 char* COM_Parse (char *data);
150 char* Get_COM_Token();
152 extern char com_token[1024];
153 extern qboolean com_eof;
155 #define MAX_NUM_ARGVS 32
157 extern char *argv[MAX_NUM_ARGVS];
162 // TTimo NOTE: WINAPI funcs can be accessed by plugins
163 void Sys_UpdateStatusBar( void );
164 void WINAPI Sys_UpdateWindows (int bits);
165 void Sys_Beep (void);
166 void Sys_ClearPrintf (void);
167 double Sys_DoubleTime (void);
168 void Sys_GetCursorPos (int *x, int *y);
169 void Sys_SetCursorPos (int x, int y);
170 void Sys_SetTitle (const char *text);
171 void WINAPI Sys_BeginWait (void);
172 void WINAPI Sys_EndWait (void);
173 void Sys_Status(const char *psz, int part);
175 bool Sys_ShiftDown ();
176 // will open/close/check the log file based on the following globals:
177 // g_PrefsDlg.m_bLogConsole g_qeglobals.hLogFile
178 void Sys_LogFile (void);
180 extern qboolean verbose;
181 #include "qsysprintf.h"
183 // NOTE TTimo I split out the GUI-depependant stuff from QEGlobals_t into a seperate struct
186 // GL widget of the camera view
187 // all textures are binded in this context and shared with the others
190 GtkWidget *d_main_window; // d_hwndMain
191 GtkWidget *d_edit; // d_hwndEdit
192 GtkWidget *d_entity; // d_hwndEntity
193 GtkWidget *d_camera; // d_hwndCamera;
194 GtkWidget *d_texture; // d_hwndTexture;
195 GtkWidget *d_texture_scroll;
196 GtkWidget *d_z; // d_hwndZ;
200 // usefull portability stuff
201 //++timo move them somewhere
202 bool DoesFileExist(const char* pBuff, long& lSize);
204 char *copystring (char *s);
205 char *ExpandReletivePath (char *p);
207 #include "xmlstuff.h"
213 void Drag_Begin (int x, int y, int buttons, vec3_t xaxis, vec3_t yaxis, vec3_t origin, vec3_t dir, bool sf_camera = false);
214 void Drag_MouseMoved (int x, int y, int buttons);
215 void Drag_MouseUp (int nButtons = 0);
220 void CSG_MakeHollow (void);
221 void CSG_Subtract (void);
222 void CSG_Merge (void);
228 void SetupVertexSelection (void);
229 void SelectEdgeByRay (vec3_t org, vec3_t dir);
230 void SelectVertexByRay (vec3_t org, vec3_t dir);
232 void ConnectEntities (void);
234 extern int update_bits;
236 extern int screen_width;
237 extern int screen_height;
239 char *TranslateString (char *buf);
244 //void OpenDialog ();
245 //void SaveAsDialog (bool bRegion);
246 void ProjectDialog (void);
249 void MRU_AddWidget (GtkWidget *widget, int pos);
250 void MRU_AddFile (const char *str);
251 void MRU_Activate (int index);
254 void FillTextureMenu (GSList** pArray = NULL);
255 void FillBSPMenu (void);
257 // profile functions - kind of utility lib
258 // they are kind of dumb, they expect to get the path to the .ini file or to the prefs directory when called
259 // load_buffer and save_buffer expect the path only, theyll build a $(pszName).bin file
260 bool WINAPI profile_save_int (const char *filename, const char *section, const char *key, int value);
261 bool WINAPI profile_save_float (const char *filename, const char *section, const char *key, float value);
262 bool WINAPI profile_save_string (const char *filename, const char *section, const char *key, const char *value);
263 bool profile_save_buffer (const char *rc_path, const char *pszName, void *pvBuf, guint32 lSize);
264 bool profile_load_buffer (const char *rc_path, const char *pszName, void *pvBuf, guint32 *plSize);
265 int WINAPI profile_load_int (const char *filename, const char *section, const char *key, int default_value);
266 float WINAPI profile_load_float (const char *filename, const char *section, const char *key, float default_value);
267 char* WINAPI profile_load_string (const char *filename, const char *section, const char *key, const char *default_value);
268 // used in the command map code
269 bool read_var (const char *filename, const char *section, const char *key, char *value);
274 void FillClassList (void);
275 bool UpdateEntitySel(eclass_t *pec);
276 void SetInspectorMode(int iType);
277 void SetSpawnFlags(void);
278 void GetSpawnFlags(void);
279 void SetKeyValuePairs(bool bClearMD3 = false);
280 extern void BuildGammaTable(float g);
281 bool GetSelectAllCriteria(CString &strKey, CString &strVal);
292 int DoCapDlg (int *type, bool *b_GroupResul);
293 int DoBSInputDlg (const char *fields[5], float values[5]);
294 int DoTextureLayout (float *fx, float *fy);
295 char* DoNameDlg (const char* title);
296 char* DoNewProjectDlg ();
298 text editor, open filename at given line
299 opening at line works only for win32 / editpad and builtin Gtk editor
301 we only allow one instance of the Gtk editor widget opened at a given time
302 if we get called with an existing instance, switch to new file ..
304 void DoTextEditor (const char* filename, int cursorpos);
305 int DoLightIntensityDlg (int *intensity);
308 void DoEntityList ();
312 void DoSides(bool bCone = false, bool bSphere = false, bool bTorus = false);
314 void DoSnapTToGrid(float hscale = 0.0f, float vscale = 0.0f);
316 void ToggleSurface(); // will show/hide depending on the current state
317 void DoNewPatchDlg ();
318 void DoThickenDlg ();
319 void DoCommandListDlg ();
321 void DoTextureListDlg ();
322 void DoScriptsDlg ();
324 // QE function declarations
325 void QE_CheckAutoSave( void );
326 void WINAPI QE_ConvertDOSToUnixName( char *dst, const char *src );
327 void QE_CountBrushesAndUpdateStatusBar( void );
328 void WINAPI QE_CheckOpenGLForErrors(void);
329 void QE_ExpandBspString (char *bspaction, GPtrArray & out, char *mapname);
330 // initialise the VFS from current project settings
332 // do all initialisations that should happen after a project is load (during startup or project change)
334 qboolean QE_KeyDown (int key, int nFlags = 0);
335 // does some sanity checks on the project entity, such as removing ending filename seperators from paths
336 // (this usually gets propagated to the actual project file since most of the time we save right after calling the check)
337 void QE_CheckProjectEntity();
338 // this will load a new project entity in memory, and potentially process it from a template
339 // NOTE TTimo calling QE_LoadProject won't take care of the various initialisation that are performed depending on the project settings
340 // you should then call QE_Init for that
341 #define PROJECT_TEMPLATE_NAME "default_project.proj"
342 #define PROJECT_USER_NAME "user_project.proj"
343 #define PROJECT_FILETYPE "proj"
344 qboolean QE_LoadProject (const char *projectfile);
345 qboolean QE_SingleBrush (bool bQuiet = false);
349 void Sys_MarkMapModified (void);
351 #if 0 // no longer used
353 // QE Win32 function declarations
355 int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer );
356 void QEW_StopGL( HWND hWnd, HGLRC hGLRC, HDC hDC );
361 // extern declarations
362 extern QEGlobals_t g_qeglobals;
363 extern QEGlobals_GUI_t g_qeglobals_gui;
365 qboolean IsBrushSelected(brush_t* bSel);
369 void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom,
370 qboolean s1, qboolean s2, qboolean s3, qboolean s4);
372 void Curve_Invert (void);
374 void Curve_AddFakePlanes( brush_t *B );
375 void Curve_StripFakePlanes( brush_t *B );
376 void Curve_BuildPoints (brush_t *b);
377 void Curve_XYDraw (brush_t *b);
378 void Curve_CameraDraw (brush_t *b);
380 void Curve_WriteFile (char *name);
384 patchMesh_t *Patch_Alloc();
385 patchMesh_t* MakeNewPatch();
386 brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true);
387 brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false);
388 //void Patch_ReadFile (char *name);
389 //void Patch_WriteFile (char *name);
390 void Patch_BuildPoints (brush_t *b);
391 void Patch_Move(patchMesh_t *p, const vec3_t vMove, bool bRebuild = false);
392 //++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp)
393 void Patch_ApplyMatrix(patchMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[3], bool bSnap = false);
394 void Patch_EditPatch();
395 void Patch_Deselect();
396 void Patch_Deselect(patchMesh_t *p);
397 void Patch_Delete(patchMesh_t *p);
398 int Patch_MemorySize(patchMesh_t *p);
399 void Patch_Select(patchMesh_t *p);
400 void Patch_Scale(patchMesh_t *p, const vec3_t vOrigin, const vec3_t vAmt, bool bRebuilt = true);
401 void Patch_Cleanup();
402 void Patch_SetView(int n);
403 void Patch_SetTexture(patchMesh_t *p, texdef_t *tex_def, IPluginTexdef* pPlugTexdef = NULL);
404 void Patch_BrushToMesh(bool bCone = false, bool bBevel = false, bool bEndcap = false, bool bSquare = false, int nHeight = 3);
405 bool Patch_DragScale(patchMesh_t *p, vec3_t vAmt, vec3_t vMove);
406 //void Patch_ReadBuffer(char* pBuff, bool bSelect = false);
407 //void Patch_WriteFile (MemStream* pMemFile);
408 void Patch_UpdateSelected(vec3_t vMove);
409 //brush_t* Patch_Parse(bool bOld);
410 //void Patch_Write (patchMesh_t *p, FILE *f);
411 //void Patch_Write (patchMesh_t *p, MemStream *file);
412 //void Patch_AdjustColumns(patchMesh_t *p, int nCols);
413 //void Patch_AdjustRows(patchMesh_t *p, int nRows);
414 void Patch_AdjustSelected(bool bInsert, bool bColumn, bool bFlag);
415 patchMesh_t* Patch_Duplicate(patchMesh_t *pFrom);
416 void Patch_RotateTexture(patchMesh_t *p, float fAngle);
417 void Patch_ScaleTexture(patchMesh_t *p, float fx, float fy, bool bFixup = true);
418 // shift of some pixel amount
419 void Patch_ShiftTexture(patchMesh_t *p, float fx, float fy);
420 // shift of ST increments
421 void Patch_ShiftTextureST(patchMesh_t *p, float fx, float fy);
422 void Patch_DrawCam(patchMesh_t *p);
423 void Patch_DrawXY(patchMesh_t *p);
424 void Patch_InsertColumn(patchMesh_t *p, bool bAdd);
425 void Patch_InsertRow(patchMesh_t *p, bool bAdd);
426 void Patch_RemoveRow(patchMesh_t *p, bool bFirst);
427 void Patch_RemoveColumn(patchMesh_t *p, bool bFirst);
428 void Patch_ToggleInverted();
429 void Patch_Restore(patchMesh_t *p);
430 void Patch_Save(patchMesh_t *p);
431 void Patch_SetTextureInfo(texdef_t* pt);
432 void Patch_NaturalTexturing();
433 void Patch_ResetTexturing(float fx, float fy);
434 void Patch_FitTexturing();
435 void Patch_BendToggle();
436 //void Patch_StartInsDel();
437 void Patch_BendHandleTAB();
438 void Patch_BendHandleENTER();
439 void Patch_SelectBendNormal();
440 void Patch_SelectBendAxis();
441 bool OnlyPatchesSelected();
442 bool AnyPatchesSelected();
443 patchMesh_t* SinglePatchSelected();
444 void Patch_CapCurrent();
445 void Patch_DisperseRows();
446 void Patch_DisperseIntermediateRows();
447 void Patch_DisperseIntermediateColumns();
448 void Patch_CycleCapSelected();
449 void Patch_NaturalizeSelected(bool bCap = false);//, bool bCycleCap = false);
450 void Patch_SelectAreaPoints(bool bMulti);
451 void Patch_InvertTexture(bool bY);
452 void patchInvert(patchMesh_t *p);
453 //void Patch_InsDelToggle();
454 //void Patch_InsDelHandleTAB();
455 //void Patch_InsDelHandleENTER();
456 void Patch_SetOverlays();
457 void Patch_ClearOverlays();
458 void Patch_Thicken(int nAmount, bool bSeam, qboolean bGroupResult);
459 void Patch_Transpose();
461 void Patch_UnFreeze(bool bAll);
462 const char* Patch_GetTextureName();
463 void Patch_FindReplaceTexture(brush_t *pb, const char *pFind, const char *pReplace, bool bForce);
464 void Patch_SnapToGrid(patchMesh_t *p);
465 extern bool g_bPatchShowBounds;
466 extern bool g_bPatchWireFrame;
467 extern bool g_bPatchWeld;
468 extern bool g_bPatchDrillDown;
469 //extern bool g_bPatchInsertMode;
470 extern bool g_bPatchBendMode;
471 extern vec3_t g_vBendOrigin;
472 //void Patch_FromTriangle(vec5_t vx, vec5_t vy, vec5_t vz);
473 const char* Patch_GetKeyValue(patchMesh_t *p, const char *pKey);
474 void Patch_SetEpair(patchMesh_t *p, const char *pKey, const char *pValue);
475 void Patch_LODMatchAll();
476 void Patch_CalcBounds(patchMesh_t *p, vec3_t& vMin, vec3_t& vMax);
482 // group_t are loaded / saved through "group_info" entities
483 // they hold epairs for group settings and additionnal access info (tree nodes)
484 typedef struct group_s
486 struct group_s *next;
488 #if 0 //! Deprecated in gtk 2.x.
489 GtkCTreeNode *itemOwner;
493 // NOTES: grouping only enabled in brush primitives mode
494 // grouping works by naming brushes and setting display properties
495 // the group hierarchy is not related with the map hierarchy (entity list, brushes etc.)
496 // brushes with no group are under the "world" node (default for all brushes)
497 // void Group_GetListFromWorld(CStringArray *pArray);
498 void Group_RemoveListFromWorld();
499 // void Group_SetListToWorld(CStringArray *pArray);
500 // void Group_BuildTree(CTreeCtrl *pTree);
501 // void Group_DecomposeTree(CTreeCtrl *pTree);
502 // save group_t as "classname" "group_info" things
503 void Group_Save(FILE *f);
504 // clean the brushes ownerItem, clean the treeview and rebuild everything
505 // is usually called when loading a new map, but may be called anytime
507 void Group_Add(entity_t *e);
509 // remove a brush from it's current group, will erase the "group" epair if any, and delete the tree control node
510 void Group_RemoveBrush(brush_t *b);
511 void Group_AddToWorld(brush_t *b);
512 // will remove brush of it's current group if any, and will add it wherever needed according to it's "group" key
513 void Group_AddToProperGroup(brush_t *b);
514 void Group_AddToSelected(brush_t *b);
515 // allocate a new group, set name
516 group_t* Group_Alloc(const char *name);
517 // we use entities to store information about the groups
518 // these entities are not linked into the world, and they have no brushes
519 // only loaded / saved in map file
520 group_t* Group_ForName(const char *name);
523 // new brush primitive stuff
529 // get the relative axes of the current texturing
530 void BrushPrimit_GetRelativeAxes(face_t *f, vec3_t vecS, vec3_t vecT);
531 // brush primitive stuff
532 void ComputeAxisBase(vec3_t normal, vec3_t texS, vec3_t texT );
533 void FaceToBrushPrimitFace(face_t *f);
534 void BrushPrimitFaceToFace(face_t *f);
535 void EmitBrushPrimitTextureCoordinates(face_t *, winding_t *);
536 // EmitTextureCoordinates, is old code used for brush to brush primitive conversion
537 void EmitTextureCoordinates ( float *xyzst, qtexture_t *q, face_t *f);
538 //void BrushPrimit_Parse(brush_t *);
539 // compute a fake shift scale rot representation from the texture matrix
540 void TexMatToFakeTexCoords( vec_t texMat[2][3], float shift[2], float *rot, float scale[2] );
541 void FakeTexCoordsToTexMat( float shift[2], float rot, float scale[2], vec_t texMat[2][3] );
542 void ConvertTexMatWithQTexture( vec_t texMat1[2][3], qtexture_t *qtex1, vec_t texMat2[2][3], qtexture_t *qtex2 );
543 // NOTE: this is a wrapper over the vec_t mat[2][3] version
544 void ConvertTexMatWithQTexture( brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2 );
546 void ShiftTextureGeometric_BrushPrimit(face_t *f, vec3_t delta);
547 void ShiftTextureRelative_BrushPrimit( face_t *f, float x, float y );
548 void RotateFaceTexture_BrushPrimit(face_t *f, int nAxis, float fDeg, vec3_t vOrigin );
549 // used in CCamWnd::ShiftTexture_BrushPrimit
550 void ComputeBest2DVector( vec3_t v, vec3_t X, vec3_t Y, int &x, int &y );
551 void Face_FitTexture_BrushPrimit( face_t *face, vec3_t minx, vec3_t maxs, int nHeight, int nWidth );
552 // lock textures on a random transformation
553 void ApplyMatrix_BrushPrimit(face_t *f, vec3_t matrix[3], vec3_t origin);
554 // low level functions .. put in mathlib?
555 #define BPMatCopy(a,b) {b[0][0] = a[0][0]; b[0][1] = a[0][1]; b[0][2] = a[0][2]; b[1][0] = a[1][0]; b[1][1] = a[1][1]; b[1][2] = a[1][2];}
556 // apply a scale transformation to the BP matrix
557 #define BPMatScale(m,sS,sT) {m[0][0]*=sS; m[1][0]*=sS; m[0][1]*=sT; m[1][1]*=sT;}
558 // apply a translation transformation to a BP matrix
559 #define BPMatTranslate(m,s,t) {m[0][2] += m[0][0]*s + m[0][1]*t; m[1][2] += m[1][0]*s+m[1][1]*t;}
560 // 2D homogeneous matrix product C = A*B
561 void BPMatMul(vec_t A[2][3], vec_t B[2][3], vec_t C[2][3]);
562 // apply a rotation (degrees)
563 void BPMatRotate(vec_t A[2][3], float theta);
565 void BPMatDump(vec_t A[2][3]);
568 void GLMatMul(vec_t M[4][4], vec_t A[4], vec_t B[4]);
569 qboolean IsBrushPrimitMode();
576 \todo those are at the eclass manager level, but some documentation about what they do will be helpful
578 extern qboolean parsing_single;
579 extern qboolean eclass_found;
580 extern eclass_t *eclass_e;
581 extern eclass_t *g_md3Cache;
586 void Eclass_InsertAlphabetized(eclass_t *e);
587 eclass_t** Get_EClass_E();
588 void Set_Eclass_Found(qboolean);
589 qboolean Get_Parsing_Single();
591 // .def loading, builtin module
592 #include "eclass_def.h"
593 extern CSynapseBuiltinClientDef eclass_def;
596 global table to .def entity class description
597 this is a builtin module, even if we rely on fgd, we still use this one in cases such as entities not found etc.
599 extern _EClassTable g_EClassDefTable;
602 support for one additional/optional entity format
604 extern bool g_bHaveEClassExt;
605 extern _EClassTable g_EClassExtTable;
609 // for interfaces, we require main plugin header included
610 #include "qerplugin.h"
613 // SurfaceDlg.cpp and surface properties plugin
615 //++timo some patch in/out stuff is in there, needs to be moved out in a dedicated interface
616 #include "isurfaceplugin.h"
617 #include "surfaceplugin.h"
618 void WINAPI Patch_Rebuild(patchMesh_t *p);
619 #include "isurfaceplugin.h"
620 extern _QERPlugSurfaceTable g_SurfaceTable;
621 void SurfaceDlgFitAll();
628 GtkWidget* WINAPI QERApp_GetQeglobalsGLWidget();
629 void WINAPI QERApp_HookGL2DWindow(IGL2DWindow* pGLW);
630 void WINAPI QERApp_UnHookGL2DWindow(IGL2DWindow* pGLW);
631 void WINAPI QERApp_HookGL3DWindow(IGL3DWindow* pGLW);
632 void WINAPI QERApp_UnHookGL3DWindow(IGL3DWindow* pGLW);
633 void Draw2DPluginEntities( VIEWTYPE vt );
634 void Draw3DPluginEntities();
637 // IShaders interface
639 #define USE_SHADERSTABLE_DEFINE
640 #include "ishaders.h"
641 extern _QERShadersTable g_ShadersTable;
644 // ISelectedFace interface
646 #include "iselectedface.h"
647 int WINAPI QERApp_GetSelectedFaceCount();
648 // NOTE: it's the brush corresponding to the selected face below!
649 brush_t* WINAPI QERApp_GetSelectedFaceBrush(int iface);
650 face_t* WINAPI QERApp_GetSelectedFace(int iface);
651 int WINAPI QERApp_GetFaceInfo(int iface, _QERFaceData *pFaceData, winding_t *pWinding);
652 int WINAPI QERApp_SetFaceInfo(int iface, _QERFaceData *pFaceData);
653 int WINAPI QERApp_ISelectedFace_GetTextureNumber(int iface);
654 void WINAPI QERApp_GetTextureSize(int iface, int Size[2]);
659 //#include "iepairs.h"
660 //#include "epairswrapper.h"
668 // IFileSystem interface
670 #define USE_VFSTABLE_DEFINE
671 #include "ifilesystem.h"
673 extern _QERFileSystemTable g_FileSystemTable;
678 extern qboolean g_bShowAllShaders;
683 //++timo TODO: we can probably raise the MAX_TEXTUREDIRS limit?
684 #define MAX_TEXTUREDIRS 256
686 extern CPtrArray g_lstSkinCache;
687 qtexture_t *QERApp_LoadTextureRGBA(unsigned char* pPixels, int nWidth, int nHeight);
690 // IScripLib interface
691 // GetToken, UnGetToken, etc.
692 #include "iscriplib.h"
694 void WINAPI QERApp_MapPrintf_FILE( char *text, ... );
697 // ISurfacePlugin interface
699 void QERApp_GetTwoSelectedPatch( patchMesh_t **p1, patchMesh_t **p2 );
702 // IBSPFrontend interface
704 #include "ibspfrontend.h"
705 extern _QERPlugBSPFrontendTable g_BSPFrontendTable;
706 extern GSList *g_BSPFrontendCommands;
711 #include "itoolbar.h"
714 // IMessaging interface
718 IWindow* WINAPI QERApp_CreateGLWindow();
719 void WINAPI QERApp_HookWindow(IWindowListener* pListen);
720 void WINAPI QERApp_UnHookWindow(IWindowListener* pListen);
721 IXYWndWrapper* WINAPI QERApp_GetXYWndWrapper();
722 void WINAPI QERApp_HookListener(IListener* pListen, int Msg);
723 int WINAPI QERApp_UnHookListener(IListener* pListen);
724 void DispatchRadiantMsg( int Msg );
725 // dispatch for IWindowListener entities
726 void DispatchOnMouseMove(guint32 nFlags, int x, int y);
727 bool DispatchOnLButtonDown(guint32 nFlags, int x, int y);
728 bool DispatchOnLButtonUp(guint32 nFlags, int x, int y);
740 // Some declarations that were in stdafx.h
743 extern gint try_destroy_splash(gpointer);
745 #include "mainframe.h"
746 #include "preferences.h"
747 #include "findtexturedialog.h"
748 #include "surfacedialog.h"
749 #include "patchdialog.h"
754 extern MainFrame* g_pParentWnd;
755 extern CString g_strAppPath;
756 extern CString g_strDTDPath;
757 extern CString g_pidFile;
758 extern CString g_pidGameFile;
759 extern CString g_strBitmapsPath;
760 extern CString g_strPluginsDir;
761 extern CString g_strModulesDir;
763 extern CGameDescription *g_pGameDescription;
764 extern CString g_strGameToolsPath;
766 extern CString g_strTempPath;
767 extern PrefsDlg& g_PrefsDlg;
768 extern FindTextureDialog& g_dlgFind;
769 extern SurfaceDlg g_dlgSurface;
770 extern PatchDialog g_PatchDialog;
772 extern int g_bIgnoreCommands;
774 void HideInfoDialog();
775 void ShowInfoDialog(const char* pText);
778 //extern void HandleCommand (GtkWidget *widget, gpointer data, bool keydown);
779 extern gint HandleCommand (GtkWidget *widget, gpointer data);
780 extern void AddSlash(CString&);
781 extern void DLLBuildDone();
782 extern void CleanUpEntities();
783 extern void FindReplace(CString& strContents, const char* pTag, const char* pValue);
784 extern void CheckBspProcess();
785 extern void QE_CountBrushesAndUpdateStatusBar();
786 extern void QE_CheckAutoSave();
787 extern qtexture_t *current_texture;
788 extern void SaveWithRegion(char *name); // save the current map, sets the map name in the name buffer (deals with regioning)
789 extern void RunBsp (char *command);
790 extern void Map_Snapshot();
791 extern void WXY_Print();
792 extern void AddProp( void );
793 extern qboolean DoColor(int iIndex);
794 extern entity_t *edit_entity;
795 extern int inspector_mode;
796 extern bool g_bRotateMode;
797 extern bool g_bClipMode;
798 extern bool g_bScaleMode;
799 extern int g_nScaleHow;
800 extern bool g_bPathMode;
801 extern void RunScript(char* pBuffer);
802 extern bool ExtractPath_and_Filename(const char* pPath, CString& strPath, CString& strFilename);
803 extern void Select_Scale(float x, float y, float z);
804 extern void Select_RotateTexture(int amt);
805 extern void Select_ScaleTexture(float x, float y);
806 extern void Select_ShiftTexture(int x, int y);
807 extern void FindReplaceTextures(const char* pFind, const char* pReplace, bool bSelected, bool bForce, bool bSelectMatchingFaces);
809 \fn DoProjectSettings shows the dialog for per-game configurable settings by the user
810 typically this sets up things like mod editing configuration
811 those a per-project, not the same thing as preferences which are global to the game conf
812 this is still being worked on, as we have several issues with how things are configured
813 we also have a number of behaviours defined in the .game, which can't be edited graphically
814 we dump those properties to the console when the project settings dialog shows up
816 extern void DoProjectSettings();
817 extern qboolean region_active;
818 extern void Brush_Print(brush_t* b);
819 extern void Texture_ShowStartupShaders();
820 extern void Map_ImportFile (char *filename);
821 extern void Map_SaveSelected(char* pFilename);
822 extern void UpdateSurfaceDialog();
823 extern void Select_GetTrueMid (vec3_t mid);
824 extern bool g_bSwitch;
825 extern brush_t g_brFrontSplits;
826 extern brush_t g_brBackSplits;
827 extern ClipPoint g_Clip1;
828 extern ClipPoint g_Clip2;
829 extern brush_t* g_pSplitList;
830 extern ClipPoint g_PathPoints[256];
831 extern void AcquirePath(int nCount, PFNPathCallback* pFunc);
832 extern bool g_bScreenUpdates;
833 extern SCommandInfo g_Commands[];
834 extern int g_nCommandCount;
835 extern SKeyInfo g_Keys[];
836 extern int g_nKeyCount;
837 extern int inspector_mode;
838 extern char *bsp_commands[256];
839 extern void RunScriptByName(char*, bool);
840 extern void DoNewColor(int* i1, int* i2, int* i3);
841 extern void UpdateSurfaceDialog();
842 extern void CSG_SplitBrushByFace (brush_t *in, face_t *f, brush_t **front, brush_t **back);
843 //extern void HandlePopup(CWnd* pWindow, unsigned int uId);
845 extern void Select_Scale(float x, float y, float z);
846 extern void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv);
847 //extern void VectorRotate (vec3_t va, vec3_t vb, vec3_t out);
848 //extern void VectorRotate (vec3_t vIn, vec3_t vRotation, vec3_t vOrigin, vec3_t out);
849 extern qboolean QE_SaveProject (const char* pProjectFile);
850 //extern void NewBSP(char* pCommandLine, HWND);
851 //extern void NewVIS(char* pCommandLine, HWND);
852 //extern void NewRAD(char* pCommandLine, HWND);
853 extern void RunTools(char* pCommandLine, GtkWidget* hwnd, const char* pPAKFile);
854 extern void Clamp(float& f, int nClamp);
855 extern void MemFile_fprintf(MemStream* pMemFile, const char* pText, ...);
856 //extern void SaveWindowPlacement(HWND hwnd, const char* pName);
857 //extern bool LoadWindowPlacement(HWND hwnd, const char* pName);
858 extern qboolean ConfirmModified (void);
859 extern void DoPatchInspector();
860 extern void TogglePatchInspector();
861 void UpdatePatchInspector();
862 extern int BuildShortPathName(const char* pPath, char* pBuffer, int nBufferLen);
863 extern int g_nBrushId;
865 // defined in gtkdlgs.cpp, we might want to move declaration and implementatin with other Select_ stuff..
866 // NOTE: there's also a Select_Brush(brush_t *b) function.. unrelated
867 extern void SelectBrush (int entitynum, int brushnum);
870 // ret: 0 = abort, 1 = load and convert, 2 = changed project settings, load and don't convert
871 // the user might decide to switch the BP mode in project settings
872 // status: 0 = loading regular, got conflict 1 = loading BP, got conflict
873 extern int BP_MessageBox (int status);
876 extern gint try_destroy_splash(gpointer);
880 void Entity_Connect(entity_t *e1, entity_t *e2);
881 int GetUniqueTargetId(int iHint);
884 void CreateEntityFromName(const char* name, const vec3_t origin);
888 \brief initialization of the eclass manager
889 general guidelines about eclass.cpp implementation:
890 - we don't support unlimited number of eclass file formats together
891 currently limited to two
892 support for .def is builtin to the core, but you may choose not to activate it
893 - search and load of the files:
894 the manager is in charge of scanning for eclass definition files to load
895 there is a general configuration setting for games which use a different set of
896 entities between single player mode and multiplayer mode (TODO: the code doing
897 this needs to be abstracted some more)
898 - duplicate files / multiple files:
899 if two files with the same name exist (for instance in the basegame, and in fs_game)
900 then only the first one found in the scan order is loaded
901 if several files are found, they are all loaded
902 this allows mods to either replace or extend the list of eclass
903 - if eclass_singleload prop is used in the .game, then there is no multiple files check
904 the first file found is loaded, and there is no further search for the given extension
905 (this was an addition for HL support)
908 eclass_t *Eclass_ForName (const char *name, qboolean has_brushes);
909 eclass_t * EClass_Create( const char *name, float col1, float col2, float col3, const vec3_t *mins, const vec3_t *maxs, const char *comments );