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