From e4b1c1a55c5db801601ce3459bc061dd3f3a4ebd Mon Sep 17 00:00:00 2001 From: mattn Date: Thu, 26 Jun 2008 07:52:02 +0000 Subject: [PATCH] * fixed a lot of compiler warnings (mostly const char * stuff and use of uninitialized data) * add support for translating radiant (just marked three strings, more to come) git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@264 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- contrib/bkgrnd2d/dialog.cpp | 17 +- contrib/bobtoolz/StdAfx.h | 13 +- contrib/camera/camera.h | 1 + contrib/gtkgensurf/gendlgs.cpp | 11 +- contrib/gtkgensurf/gensurf.cpp | 5 +- contrib/gtkgensurf/gensurf.h | 1 + contrib/prtview/prtview.cpp | 42 +- contrib/prtview/stdafx.h | 5 +- contrib/ufoai/plugin.cpp | 22 +- include/ifilters.h | 2 +- include/iundo.h | 2 +- include/qerplugin.h | 42 +- include/qertypes.h | 40 +- plugins/surface/surfacedialog.cpp | 127 ++-- plugins/surface_heretic2/surfacedialog.cpp | 127 ++-- .../surfaceflagsdialog_heretic2.cpp | 3 +- plugins/surface_quake2/surfacedialog.cpp | 125 ++-- .../surfaceflagsdialog_quake2.cpp | 1 + plugins/surface_ufoai/surfacedialog.cpp | 1 + .../surfaceflagsdialog_ufoai.cpp | 1 + plugins/textool/StdAfx.h | 13 +- radiant/brush.cpp | 154 ++--- radiant/camwindow.cpp | 92 +-- radiant/dialog.cpp | 21 +- radiant/dialog.h | 3 +- radiant/dialoginfo.cpp | 1 + radiant/error.cpp | 14 +- radiant/filters.cpp | 58 +- radiant/filters.h | 4 +- radiant/glwidget.cpp | 37 +- radiant/groupdialog.cpp | 58 +- radiant/gtkdlgs.cpp | 179 ++--- radiant/gtkmisc.cpp | 144 ++-- radiant/gtkmisc.h | 42 +- radiant/main.cpp | 35 +- radiant/mainframe.cpp | 630 +++++++++--------- radiant/mainframe.h | 16 +- radiant/map.cpp | 62 +- radiant/pmesh.cpp | 570 ++++++++-------- radiant/preferences.cpp | 270 ++++---- radiant/preferences.h | 54 +- radiant/qe3.cpp | 87 +-- radiant/qe3.h | 19 +- radiant/texwindow.cpp | 26 +- radiant/undo.cpp | 26 +- radiant/undo.h | 4 +- radiant/xywindow.cpp | 199 +++--- 47 files changed, 1717 insertions(+), 1689 deletions(-) diff --git a/contrib/bkgrnd2d/dialog.cpp b/contrib/bkgrnd2d/dialog.cpp index 9f4ec49c..204ae5e1 100644 --- a/contrib/bkgrnd2d/dialog.cpp +++ b/contrib/bkgrnd2d/dialog.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #include +#include #include "bkgrnd2d.h" #include "dialog.h" @@ -104,12 +105,12 @@ void CBackgroundDialogPage::Browse() const char *ct; const char *newfile; char *t; - + //TODO GetMapName saves the map. eeep! //also with no map, returns unnamed.map, otherwise returns full path // Syn_Printf(MSG_PREFIX "GetMapName() %s\n", // g_FuncTable.m_pfnGetMapName()); - + ct = g_FuncTable.m_pfnReadProjectKey("basepath"); // TODO shouldn't need this stuff if(!ct || !strlen(ct)) { @@ -123,7 +124,7 @@ void CBackgroundDialogPage::Browse() } strcpy(browsedir,ct); - // make sure we have a trailing / + // make sure we have a trailing / if(browsedir[strlen(browsedir) - 1] != '/') strcat(browsedir,"/"); @@ -136,12 +137,12 @@ void CBackgroundDialogPage::Browse() // lop off the file part t = browsedir + strlen(browsedir) - 1; - while (t != browsedir && *t != '/') + while (t != browsedir && *t != '/') t--; *t = 0; } Syn_Printf(MSG_PREFIX "browse directory %s\n",browsedir); - + //does NOT need freeing contrary to include/qerplugin.h comments //TODO bug/patch for comments //TODO patern gets fucked up sometimes if empty @@ -202,7 +203,7 @@ CBackgroundDialogPage::CBackgroundDialogPage(VIEWTYPE vt ) break; } // A vbox to hold everything - m_pWidget = gtk_vbox_new(FALSE,0); + m_pWidget = gtk_vbox_new(FALSE,0); // Frame for file row frame = gtk_frame_new("File"); gtk_box_pack_start (GTK_BOX (m_pWidget),frame, FALSE, FALSE, 2); @@ -226,7 +227,7 @@ CBackgroundDialogPage::CBackgroundDialogPage(VIEWTYPE vt ) gtk_box_pack_start (GTK_BOX (hbox),w, FALSE, FALSE, 5); gtk_tooltips_set_tip (pTooltips, w, "Select a file", NULL); gtk_widget_show (w); - + w = gtk_button_new_with_label ("Reload"); g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (reload_callback), (gpointer)this); @@ -348,7 +349,7 @@ void InitBackgroundDialog() gtk_box_pack_start (GTK_BOX (GTK_DIALOG(pDialogWnd)->vbox), pNotebook, TRUE, TRUE, 0); gtk_widget_show ( pNotebook ); - + gtk_widget_realize( pDialogWnd ); } diff --git a/contrib/bobtoolz/StdAfx.h b/contrib/bobtoolz/StdAfx.h index 92ffa595..d49d54d5 100644 --- a/contrib/bobtoolz/StdAfx.h +++ b/contrib/bobtoolz/StdAfx.h @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include +#include #include #include @@ -53,25 +54,25 @@ typedef char* LPCSTR; #define MB_YESNOCANCEL 0x00000003L #define MB_YESNO 0x00000004L #define MB_RETRYCANCEL 0x00000005L - - + + #define MB_ICONHAND 0x00000010L #define MB_ICONQUESTION 0x00000020L #define MB_ICONEXCLAMATION 0x00000030L #define MB_ICONASTERISK 0x00000040L - + #define MB_USERICON 0x00000080L #define MB_ICONWARNING MB_ICONEXCLAMATION #define MB_ICONERROR MB_ICONHAND #define MB_ICONINFORMATION MB_ICONASTERISK #define MB_ICONSTOP MB_ICONHAND - + #define MB_TYPEMASK 0x0000000FL #define MB_ICONMASK 0x000000F0L #define MB_DEFMASK 0x00000F00L #define MB_MODEMASK 0x00003000L #define MB_MISCMASK 0x0000C000L - + #define IDOK 1 #define IDCANCEL 2 #define IDABORT 3 @@ -98,7 +99,7 @@ typedef struct _GUID #define stricmp strcasecmp #endif - + #if defined(__cplusplus) #ifndef _REFGUID_DEFINED #define _REFGUID_DEFINED diff --git a/contrib/camera/camera.h b/contrib/camera/camera.h index cf1387c2..05a2aeaf 100644 --- a/contrib/camera/camera.h +++ b/contrib/camera/camera.h @@ -36,6 +36,7 @@ Copyright (C) 2002 Splash Damage Ltd. class CCamera; #include +#include #include "str.h" diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index 6476b5dc..80149dbb 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include #include #include @@ -1169,7 +1170,7 @@ void create_tooltips () gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), GTK_WIDGET (g_object_get_data (G_OBJECT (g_pWnd), "main_antialiasing")), "The lines in the preview window are antialiased for better quality", - ""); + ""); // General tab gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), @@ -1191,7 +1192,7 @@ void create_tooltips () "tab to select the image. GenSurf only supports 256-color (8 bit) " "bitmaps. GenSurf will work with any 256-color bitmap, but gray scale bitmaps are a bit " "more intuitive.", - "" ); + "" ); gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips), GTK_WIDGET (wave_radios[4]), "Builds a random surface using the Plasma Cloud technique. Variance is controlled " @@ -1396,7 +1397,7 @@ GtkWidget* create_main_dialog () char *waveforms[] = { "Alternating hill/valley", "Cylindrical left-to-right", "Cylindrical top-to-bottom", "From bitmap", "Fractal" }; char *orientations[] = { "Ground surface", "Ceiling", "Wall facing 0", "Wall facing 90", - "Wall facing 180","Wall facing 270" }; + "Wall facing 180","Wall facing 270" }; g_pWnd = dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (dlg), gszCaption); @@ -2351,7 +2352,7 @@ qboolean CALLBACK AboutDlgProc( HWND hwnd, unsigned msg, UINT wparam, LONG lpara return FALSE; } return FALSE; - + } /* AboutDlgProc */ void About() @@ -2364,4 +2365,4 @@ void About() } } -#endif +#endif diff --git a/contrib/gtkgensurf/gensurf.cpp b/contrib/gtkgensurf/gensurf.cpp index dd1ceec0..f7ff99d2 100644 --- a/contrib/gtkgensurf/gensurf.cpp +++ b/contrib/gtkgensurf/gensurf.cpp @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include #include /* @@ -330,7 +331,7 @@ char *va (char *format, ...) vsprintf (string, format,argptr); va_end (argptr); - return string; + return string; } @@ -401,7 +402,7 @@ void SaveSetup (GtkWidget *parent) if (name != NULL) { - char key[32], text[32]; + char key[32], text[32]; int i, j; WriteIniFile (name); diff --git a/contrib/gtkgensurf/gensurf.h b/contrib/gtkgensurf/gensurf.h index 8e42ac0d..b137c025 100644 --- a/contrib/gtkgensurf/gensurf.h +++ b/contrib/gtkgensurf/gensurf.h @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define _GENSURF_H_ #include +#include #include "qerplugin.h" //#include "qertypes.h" diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index 43960970..42aa0463 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -55,7 +55,7 @@ static char INIfn[NAME_MAX]; #define CLIP_RANGE "ClipRange" #define CLIP "Clip" -void InitInstance () +void InitInstance () { #ifdef _WIN32 char fn[_MAX_PATH]; @@ -128,7 +128,7 @@ void InitInstance () portals.FixColors(); } -void SaveConfig () +void SaveConfig () { INISetInt(RENDER_2D, portals.show_2d, "Draw in 2D windows"); INISetInt(WIDTH_2D, (int)portals.width_2d, "Width of lines in 2D windows (in units of 1/2)"); @@ -162,27 +162,27 @@ static bool read_var (const char *filename, const char *section, const char *key { char line[1024], *ptr; FILE *rc; - + rc = fopen (filename, "rt"); - + if (rc == NULL) return false; - + while (fgets (line, 1024, rc) != 0) { // First we find the section if (line[0] != '[') continue; - + ptr = strchr (line, ']'); *ptr = '\0'; - + if (strcmp (&line[1], section) == 0) { while (fgets (line, 1024, rc) != 0) { ptr = strchr (line, '='); - + if (ptr == NULL) { // reached the end of the section @@ -190,16 +190,16 @@ static bool read_var (const char *filename, const char *section, const char *key return false; } *ptr = '\0'; - + if (strcmp (line, key) == 0) { strcpy (value, ptr+1); fclose (rc); - - while (value[strlen (value)-1] == 10 || + + while (value[strlen (value)-1] == 10 || value[strlen (value)-1] == 13 || value[strlen (value)-1] == 32) - value[strlen (value)-1] = 0; + value[strlen (value)-1] = 0; return true; } } @@ -261,7 +261,7 @@ static bool save_var (const char *filename, const char *section, const char *key break; } } - } + } if (!found) { @@ -283,7 +283,7 @@ static bool save_var (const char *filename, const char *section, const char *key if (strcmp (line, key) == 0) break; - + *ptr = '='; fputs (line, rc); } @@ -296,7 +296,7 @@ static bool save_var (const char *filename, const char *section, const char *key while (fgets (line, 1024, old_rc) != NULL) fputs (line, rc); - + fclose (old_rc); char *tmpname = g_strdup_printf ("%s.tmp", filename); @@ -311,7 +311,7 @@ static bool save_var (const char *filename, const char *section, const char *key #endif -int INIGetInt(char *key, int def) +int INIGetInt(const char *key, int def) { #if defined(__linux__) || defined(__APPLE__) char value[1024]; @@ -325,7 +325,7 @@ int INIGetInt(char *key, int def) #endif } -void INISetInt(char *key, int val, char *comment /* = NULL */) +void INISetInt(const char *key, int val, const char *comment /* = NULL */) { char s[1000]; @@ -363,10 +363,10 @@ extern "C" LPVOID WINAPI QERPlug_GetFuncTable() //extern "C" LPCSTR WINAPI QERPlug_Init (HMODULE hApp, GtkWidget* hwndMain) extern "C" const char* QERPlug_Init (void *hApp, void* pMainWidget) -{ +{ // Setup defaults & load config InitInstance(); - + return "Portal Viewer for Q3Radiant"; } @@ -487,7 +487,7 @@ public: // CSynapseClient API bool RequestAPI(APIDescriptor_t *pAPI); const char* GetInfo(); - + CSynapseClientPrtView() { } virtual ~CSynapseClientPrtView() { } }; @@ -511,7 +511,7 @@ extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const g_pSynapseServer = pServer; g_pSynapseServer->IncRef(); Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf()); - + g_SynapseClient.AddAPI(PLUGIN_MAJOR, PRTVIEW_MINOR, sizeof(_QERPluginTable)); g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable); diff --git a/contrib/prtview/stdafx.h b/contrib/prtview/stdafx.h index ff28a474..d988f205 100644 --- a/contrib/prtview/stdafx.h +++ b/contrib/prtview/stdafx.h @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define __PRTVIEW_AFX_H__ #include +#include #if defined(__linux__) || defined(__APPLE__) #include @@ -69,8 +70,8 @@ typedef int BOOL; #define UPDATE_3D (W_CAMERA) #define UPDATE_ALL (UPDATE_2D | UPDATE_3D) -int INIGetInt(char *key, int def); -void INISetInt(char *key, int val, char *comment = NULL); +int INIGetInt(const char *key, int def); +void INISetInt(const char *key, int val, const char *comment = NULL); extern bool interfaces_started; diff --git a/contrib/ufoai/plugin.cpp b/contrib/ufoai/plugin.cpp index b2b9409e..594916f5 100644 --- a/contrib/ufoai/plugin.cpp +++ b/contrib/ufoai/plugin.cpp @@ -50,9 +50,9 @@ static const char *PLUGIN_ABOUT = "UFO: Alien Invasion plugin " PLUGIN_VERSION " #define NUM_TOOLBAR_BUTTONS FILTER_MAX typedef struct toolbar_button_info_s { - char *image; - char *text; - char *tip; + const char *image; + const char *text; + const char *tip; void (*func)(); IToolbarButton::EType type; } toolbar_button_info_t; @@ -61,29 +61,29 @@ static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] = { { "ufoai_actorclip.bmp", - "Filter actorclip", - "Actorclip", + _("Filter actorclip"), + _("Actorclip"), DoActorClipFiltering, IToolbarButton::eToggleButton }, { "ufoai_weaponclip.bmp", - "Filter weaponclip", - "Weaponclip", + _("Filter weaponclip"), + _("Weaponclip"), DoWeaponClipFiltering, IToolbarButton::eToggleButton }, { "ufoai_nodraw.bmp", - "Filter nodraw", - "NoDraw", + _("Filter nodraw"), + _("NoDraw"), DoNoDrawFiltering, IToolbarButton::eToggleButton }, { "ufoai_stepon.bmp", - "Filter stepon", - "Stepon", + _("Filter stepon"), + _("Stepon"), DoSteponFiltering, IToolbarButton::eToggleButton }, diff --git a/include/ifilters.h b/include/ifilters.h index 7b4d90f9..587dc9ed 100644 --- a/include/ifilters.h +++ b/include/ifilters.h @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define FILTER_MAJOR "filter" // adds a new filter -typedef bfilter_t* (* PFN_QERPLUG_FILTERADD) (int type, int bmask, char *str, int exclude); +typedef bfilter_t* (* PFN_QERPLUG_FILTERADD) (int type, int bmask, const char *str, int exclude); // performs the filtering typedef void (* PFN_QERPLUG_FILTERACTIVATE) (void); diff --git a/include/iundo.h b/include/iundo.h index b4fffeec..8772d2c8 100644 --- a/include/iundo.h +++ b/include/iundo.h @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define UNDO_MAJOR "undo" //start operation -typedef void (*PFN_UNDOSTART) (char *operation); +typedef void (*PFN_UNDOSTART) (const char *operation); //end operation typedef void (*PFN_UNDOEND) (void); //add brush to the undo diff --git a/include/qerplugin.h b/include/qerplugin.h index e7a9cd65..4da3e2b6 100644 --- a/include/qerplugin.h +++ b/include/qerplugin.h @@ -50,19 +50,19 @@ some portability related code should be moved to synapse (such as the GUID stuff #include "misc_def.h" #endif -// the editor will look for plugins in two places, the plugins path +// the editor will look for plugins in two places, the plugins path // under the application path, and the path under the basepath as defined // in the project (.qe4) file. // // you can drop any number of new texture, model format DLL's in the standard plugin path -// but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc.. -// should be used at one time.. if multiples are loaded then the last one loaded will be the +// but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc.. +// should be used at one time.. if multiples are loaded then the last one loaded will be the // active one // // type of services the plugin supplies, pass any combo of these flags // it is assumed the plugin will have a matching function as defined below // to correlate to the implied functionality -// +// #define RADIANT_MAJOR "radiant" @@ -82,9 +82,9 @@ some portability related code should be moved to synapse (such as the GUID stuff struct _QERTextureInfo { char m_TextureExtension[QER_MAX_NAMELEN]; // the extension these textures have - qboolean m_bHiColor; // if textures are NOT high color, the default + qboolean m_bHiColor; // if textures are NOT high color, the default // palette (as described inthe qe4 file will be used for gamma correction) - // if they are high color, gamma and shading are computed on the fly + // if they are high color, gamma and shading are computed on the fly // based on the rgba data //--bool m_bIsShader; // will probably do q3 shaders this way when i merge qboolean m_bWadStyle; // if this is true, the plugin will be presented with the texture path @@ -95,7 +95,7 @@ struct _QERTextureInfo struct _QERTextureLoad // returned by a plugin { _QERTextureLoad() - { + { memset(reinterpret_cast(this), 0, sizeof(_QERTextureLoad)); }; @@ -164,7 +164,7 @@ typedef void* (WINAPI *PFN_QERPLUG_GETTEXTUREINFO)(); // transparency (for water, fog, lava, etc.. ) can be emulated in the editor // by passing in appropriate alpha data or by setting the appropriate surface flags // expected by q2 (which the editor will use.. ) -typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename); +typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename); // v1.6 typedef void* (WINAPI *PFN_QERPLUG_GETSURFACEFLAGS)(); @@ -206,7 +206,7 @@ typedef void (* PFN_QERAPP_LOADIMAGE) (const char *name, unsigned char **pic, in typedef struct moduleentry_s { const GUID *interface_GUID; const char* interface_name; - const char* version_name; + const char* version_name; } moduleentry_t; #define QERPLUG_LISTINTERFACES "QERPlug_ListInterfaces" @@ -268,16 +268,16 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const // 1. the list that contains brushes a plugin creates using CreateBrushHandle // 2. the selected brush list (brushes the user has selected) // 3. the active brush list (brushes in the map that are not selected) -// +// // In general, the same things can be done to brush handles (face manip, delete brushhandle, etc.. ) in each -// list. There are a few exceptions. -// 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map. +// list. There are a few exceptions. +// 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map. // 2. You cannot bind brush handles from the selected or active brush list to an entity. As of v1.0 of the plugins // the only way for a plugin to create entities is to create a brush handles (or a list of handles) and then bind // them to an entity. This will commit the brush(s) and/or the entities to the map as well. -// +// // To use the active or selected brush lists, you must first allocate them (which returns a count) and then -// release them when you are finish manipulating brushes in one of those lists. +// release them when you are finish manipulating brushes in one of those lists. //++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor #if 0 @@ -311,7 +311,7 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const #define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture" #define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture" -// selection +// selection #define QERAPP_DELETESELECTION "QERApp_DeleteSelection" #define QERAPP_SELECTBRUSH "QERApp_SelectBrush" // PGM #define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush" // PGM @@ -347,8 +347,8 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const // FIXME: new primtives do not work in v1.00 // primitives are new types of things in the map -// for instance, the Q3 curves could have been done as -// primitives instead of being built in +// for instance, the Q3 curves could have been done as +// primitives instead of being built in // it will be a plugins responsibility to hook the map load and save funcs to load // and/or save any additional data (like new primitives of some type) // the editor will call each registered renderer during the rendering process to repaint @@ -356,10 +356,10 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const // each primitive object has a temporary sibling brush that lives in the map // FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner // basically a plugin will hook the map load and save and will add the primitives to the map.. this will -// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the +// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the // edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex // mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler -// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the +// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the // sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives // as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check // here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that @@ -495,7 +495,7 @@ typedef void (WINAPI * PFN_QERAPP_GETDISPATCHPARAMS)(vec3_t vMin, vec3_t vMax, b typedef int (WINAPI * PFN_QERAPP_REQUESTINTERFACE)( REFGUID, void* ); // use this one for errors, Radiant will stop after the "edit preferences" dialog -typedef void (WINAPI * PFN_QERAPP_ERROR)(char* pMsg, ...); +typedef void (WINAPI * PFN_QERAPP_ERROR)(const char* pMsg, ...); // use to gain read access to the project epairs // FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface // typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **); @@ -610,7 +610,7 @@ typedef const char* (* PFN_QERAPP_READPROJECTKEY)(const char* key); typedef char* (* PFN_GETMAPFILENAME)(); -typedef bfilter_t* (* PFN_QERPLUG_FILTERADD)(int type, int bmask, char *str, int exclude); +typedef bfilter_t* (* PFN_QERPLUG_FILTERADD)(int type, int bmask, const char *str, int exclude); typedef void (* PFN_QERPLUG_FILTERACTIVATE) (void); diff --git a/include/qertypes.h b/include/qertypes.h index a3b8caac..28c9409c 100644 --- a/include/qertypes.h +++ b/include/qertypes.h @@ -322,7 +322,7 @@ typedef struct face_s vec3_t planepts[3]; texdef_t texdef; plane_t plane; - + // Nurail: Face Undo int undoId; int redoId; @@ -385,9 +385,9 @@ typedef struct { #define PATCH_BEZIER 0x00000000 // default bezier #define PATCH_BSPLINE 0x10000000 // bspline -#define PATCH_TYPEMASK 0x00000fff // -#define PATCH_BTYPEMASK 0x0000f000 // -#define PATCH_STYLEMASK 0xffff0000 // +#define PATCH_TYPEMASK 0x00000fff // +#define PATCH_BTYPEMASK 0x0000f000 // +#define PATCH_STYLEMASK 0xffff0000 // typedef struct { vec3_t xyz; @@ -468,7 +468,7 @@ typedef struct brush_s // all are derived from brush_faces qboolean patchBrush; qboolean hiddenBrush; - + //int nPatchID; patchMesh_t *pPatch; @@ -575,8 +575,8 @@ extern eclass_t *eclass; #define W_CAMERA_IFON 0x0100 #define W_XZ 0x0200 //--| only used for patch vertex manip stuff #define W_YZ 0x0400 //--| -#define W_GROUP 0x0800 -#define W_MEDIA 0x1000 +#define W_GROUP 0x0800 +#define W_MEDIA 0x1000 #define W_ALL 0xFFFFFFFF // used in some Drawing routines @@ -693,7 +693,7 @@ struct entity_interfaces_t IEdit *pEdit; }; // MODEL END - + typedef struct entity_s { struct entity_s *prev, *next; @@ -756,7 +756,7 @@ struct bfilter_t //c++ style // 5=brush->face->texdef.flags (q2) // 6=brush->face->texdef.contents (q2) int mask; - char *string; + const char *string; bool active; }; @@ -807,9 +807,9 @@ typedef struct qboolean d_showgrid; float d_gridsize; qboolean d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids - + int d_num_entities; - + entity_t *d_project_entity; // defines the boundaries of the current work area @@ -839,24 +839,24 @@ typedef struct xy_t d_xyOld; SavedInfo_t d_savedinfo; - + int d_workcount; - + // connect entities uses the last two brushes selected int d_select_count; brush_t *d_select_order[2]; vec3_t d_select_translate; // for dragging w/o making new display lists select_t d_select_mode; - + int d_parsed_brushes; - + qboolean show_blocks; int blockSize; // NOTE TTimo // a lot of this data should be in a property bag and available to the other modules through an API // this is generated from game configuration and the project settings, and should be still be part of it - + // tells if we are internally using brush primitive (texture coordinates and map format) // this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" ) // NOTE: must keep the two ones in sync @@ -877,17 +877,17 @@ typedef struct qboolean bNeedConvert; qboolean bOldBrushes; qboolean bPrimitBrushes; - + vec3_t d_vAreaTL; vec3_t d_vAreaBR; - + // tells if we are using .INI files for prefs instead of registry qboolean use_ini; // even in .INI mode we use the registry for all void* prefs char use_ini_registry[64]; // disabled all INI / registry read write .. used when shutting down after registry cleanup qboolean disable_ini; - + // tells we are using a BSP frontend plugin qboolean bBSPFrontendPlugin; @@ -904,7 +904,7 @@ typedef struct // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=623 bool m_bOpenGLCompressionSupported; bool m_bS3CompressionSupported; - + // set to true after OpenGL has been initialized and extensions have been tested bool m_bOpenGLReady; diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index 16d721e5..8c2fd90e 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include +#include #include #include "surfdlg_plugin.h" @@ -318,7 +319,7 @@ static void PopulateTextureComboList() int num_of_list_items = 0; blank[0] = 0; - + if (texdef_face_list_empty()) { items = g_list_append (items, (gpointer) blank); @@ -327,7 +328,7 @@ static void PopulateTextureComboList() } else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); + temp_texdef_face_list = get_texdef_face_list(); tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); // For Texture Entry, activate only on entry change @@ -353,7 +354,7 @@ static void PopulateTextureComboList() // For Texture Entry, activate only on entry change strcpy (old_texture_entry, blank); } - + gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items); g_list_free(items); @@ -375,7 +376,7 @@ static void GetTexdefInfo_from_Radiant() unsigned int count = GetSelectedFaceCountfromBrushes(); if(count == 0) count = GetSelectedFaceCount(); - + g_texdef_face_vector.resize(count); if (!texdef_face_list_empty()) @@ -383,9 +384,9 @@ static void GetTexdefInfo_from_Radiant() texdef_to_face_t* p = get_texdef_face_list(); GetSelFacesTexdef( get_texdef_face_list() ); } - + IsFaceConflicting(); - PopulateTextureComboList(); + PopulateTextureComboList(); ZeroOffsetValues(); } @@ -431,14 +432,14 @@ void UpdateSurfaceDialog() { if (!g_bListenUpdate) return; - + if (!SurfaceInspector) return; // avoid long delays on slow computers while (gtk_events_pending ()) gtk_main_iteration (); - + if (g_surfwin) { #ifdef DBG_SI @@ -459,7 +460,7 @@ void DoSurface (void) #endif if (!SurfaceInspector) create_SurfaceInspector (); - + ShowDlg(); SetTexMods (); } @@ -546,7 +547,7 @@ void SetTexMods() if (!g_surfwin) return; - + pt = &texturewin->texdef; g_bListenChanged = false; @@ -554,24 +555,24 @@ void SetTexMods() if(strncmp(pt->GetName(), "textures/", 9) != 0) texdef_offset.SetName(SHADER_NOT_FOUND); - + spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[0]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]); - + spin = GTK_SPIN_BUTTON (hshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; - + spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]); - + spin = GTK_SPIN_BUTTON (vshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; @@ -587,29 +588,29 @@ void SetTexMods() adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[0]; - + spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.scale[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]); - + spin = GTK_SPIN_BUTTON (vscale_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; - + spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.rotate); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate); - + spin = GTK_SPIN_BUTTON (rotate_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; - + g_bListenChanged = true; // store the current texdef as our escape route if user hits OnCancel @@ -655,7 +656,7 @@ void FitAll() GtkWidget* create_SurfaceInspector (void) { - + GtkWidget *label; GtkWidget *hseparator; GtkWidget *eventbox; @@ -693,7 +694,7 @@ GtkWidget* create_SurfaceInspector (void) SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4); gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector"); - + SetWinPos_from_Prefs(SurfaceInspector); viewport8 = gtk_viewport_new (NULL, NULL); @@ -724,7 +725,7 @@ GtkWidget* create_SurfaceInspector (void) texture_combo = gtk_combo_new (); g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin), "KeepMeAround", texture_combo); - gtk_combo_disable_activate ( (GtkCombo*) texture_combo); + gtk_combo_disable_activate ( (GtkCombo*) texture_combo); gtk_widget_show (texture_combo); gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0); @@ -1025,7 +1026,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - + rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0); gtk_widget_show (rotate_value_spinbutton); @@ -1036,7 +1037,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - // Offset Spins + // Offset Spins hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0); hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2); gtk_widget_show (hshift_offset_spinbutton); @@ -1323,22 +1324,22 @@ GtkWidget* create_SurfaceInspector (void) gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - g_signal_connect ( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK (delete_event_callback), + g_signal_connect ( (gpointer) SurfaceInspector, + "delete_event", + G_CALLBACK (delete_event_callback), NULL ); g_signal_connect ((gpointer) SurfaceInspector, "destroy", G_CALLBACK (gtk_widget_destroy), NULL); - + g_signal_connect ((gpointer) texture_combo_entry, "key_press_event", G_CALLBACK (on_texture_combo_entry_key_press_event), NULL); g_signal_connect ((gpointer) texture_combo_entry, "activate", G_CALLBACK (on_texture_combo_entry_activate), NULL); - - + + g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed", G_CALLBACK (on_hshift_offset_spinbutton_value_changed), NULL); @@ -1354,7 +1355,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed", G_CALLBACK (on_rotate_offset_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed", G_CALLBACK (on_hshift_value_spinbutton_value_changed), NULL); @@ -1370,7 +1371,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed", G_CALLBACK (on_rotate_value_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed", G_CALLBACK (on_hshift_step_spinbutton_value_changed), NULL); @@ -1386,14 +1387,14 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed", G_CALLBACK (on_rotate_step_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) match_grid_button, "clicked", G_CALLBACK (on_match_grid_button_clicked), NULL); g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled", G_CALLBACK (on_lock_valuechange_togglebutton_toggled), NULL); - + g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed", G_CALLBACK (on_fit_width_spinbutton_value_changed), NULL); @@ -1403,11 +1404,11 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) fit_button, "clicked", G_CALLBACK (on_fit_button_clicked), NULL); - + g_signal_connect ((gpointer) axial_button, "clicked", G_CALLBACK (on_axial_button_clicked), NULL); - + g_signal_connect ((gpointer) done_button, "clicked", G_CALLBACK (on_done_button_clicked), NULL); @@ -1417,8 +1418,8 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) cancel_button, "clicked", G_CALLBACK (on_cancel_button_clicked), NULL); - - + + return SurfaceInspector; } @@ -1440,7 +1441,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; char text[128] = { 0 }; - + if (!texdef_face_list_empty() && g_bListenChanged) { // activate only on entry change @@ -1451,7 +1452,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) if (text[0] <= ' ' || strchr(text, ' ')) Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text); else - { + { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) { tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; @@ -1471,9 +1472,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1494,9 +1495,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1510,7 +1511,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1518,9 +1519,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1534,8 +1535,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - - + + } static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1543,9 +1544,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1559,7 +1560,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1567,9 +1568,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1583,7 +1584,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } @@ -1647,9 +1648,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1668,9 +1669,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1689,9 +1690,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1710,9 +1711,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) diff --git a/plugins/surface_heretic2/surfacedialog.cpp b/plugins/surface_heretic2/surfacedialog.cpp index 7ee893aa..c67fa7c0 100644 --- a/plugins/surface_heretic2/surfacedialog.cpp +++ b/plugins/surface_heretic2/surfacedialog.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include +#include #include #include "surfdlg_plugin.h" @@ -323,7 +324,7 @@ static void PopulateTextureComboList() int num_of_list_items = 0; blank[0] = 0; - + if (texdef_face_list_empty()) { items = g_list_append (items, (gpointer) blank); @@ -332,7 +333,7 @@ static void PopulateTextureComboList() } else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); + temp_texdef_face_list = get_texdef_face_list(); tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); // For Texture Entry, activate only on entry change @@ -358,7 +359,7 @@ static void PopulateTextureComboList() // For Texture Entry, activate only on entry change strcpy (old_texture_entry, blank); } - + gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items); g_list_free(items); @@ -380,7 +381,7 @@ static void GetTexdefInfo_from_Radiant() unsigned int count = GetSelectedFaceCountfromBrushes(); if(count == 0) count = GetSelectedFaceCount(); - + g_texdef_face_vector.resize(count); if (!texdef_face_list_empty()) @@ -388,9 +389,9 @@ static void GetTexdefInfo_from_Radiant() texdef_to_face_t* p = get_texdef_face_list(); GetSelFacesTexdef( get_texdef_face_list() ); } - + IsFaceConflicting(); - PopulateTextureComboList(); + PopulateTextureComboList(); ZeroOffsetValues(); if ( texdef_face_list_empty() ) SetFlagButtons_Heretic2( get_texdef_face_list() , TRUE); @@ -441,14 +442,14 @@ void UpdateSurfaceDialog() { if (!g_bListenUpdate) return; - + if (!SurfaceInspector) return; // avoid long delays on slow computers while (gtk_events_pending ()) gtk_main_iteration (); - + if (g_surfwin) { #ifdef DBG_SI @@ -469,7 +470,7 @@ void DoSurface (void) #endif if (!SurfaceInspector) create_SurfaceInspector (); - + ShowDlg(); SetTexMods (); } @@ -556,7 +557,7 @@ void SetTexMods() if (!g_surfwin) return; - + pt = &texturewin->texdef; g_bListenChanged = false; @@ -564,24 +565,24 @@ void SetTexMods() if(strncmp(pt->GetName(), "textures/", 9) != 0) texdef_offset.SetName(SHADER_NOT_FOUND); - + spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[0]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]); - + spin = GTK_SPIN_BUTTON (hshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; - + spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]); - + spin = GTK_SPIN_BUTTON (vshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; @@ -597,29 +598,29 @@ void SetTexMods() adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[0]; - + spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.scale[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]); - + spin = GTK_SPIN_BUTTON (vscale_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; - + spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.rotate); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate); - + spin = GTK_SPIN_BUTTON (rotate_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; - + g_bListenChanged = true; // store the current texdef as our escape route if user hits OnCancel @@ -666,7 +667,7 @@ void FitAll() GtkWidget* create_SurfaceInspector (void) { - + GtkWidget *label; GtkWidget *hseparator; GtkWidget *eventbox; @@ -704,7 +705,7 @@ GtkWidget* create_SurfaceInspector (void) SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4); gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector"); - + SetWinPos_from_Prefs(SurfaceInspector); viewport8 = gtk_viewport_new (NULL, NULL); @@ -735,7 +736,7 @@ GtkWidget* create_SurfaceInspector (void) texture_combo = gtk_combo_new (); g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin), "KeepMeAround", texture_combo); - gtk_combo_disable_activate ( (GtkCombo*) texture_combo); + gtk_combo_disable_activate ( (GtkCombo*) texture_combo); gtk_widget_show (texture_combo); gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0); @@ -1036,7 +1037,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - + rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0); gtk_widget_show (rotate_value_spinbutton); @@ -1047,7 +1048,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - // Offset Spins + // Offset Spins hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0); hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2); gtk_widget_show (hshift_offset_spinbutton); @@ -1337,22 +1338,22 @@ GtkWidget* create_SurfaceInspector (void) gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - g_signal_connect ( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK (delete_event_callback), + g_signal_connect ( (gpointer) SurfaceInspector, + "delete_event", + G_CALLBACK (delete_event_callback), NULL ); g_signal_connect ((gpointer) SurfaceInspector, "destroy", G_CALLBACK (gtk_widget_destroy), NULL); - + g_signal_connect ((gpointer) texture_combo_entry, "key_press_event", G_CALLBACK (on_texture_combo_entry_key_press_event), NULL); g_signal_connect ((gpointer) texture_combo_entry, "activate", G_CALLBACK (on_texture_combo_entry_activate), NULL); - - + + g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed", G_CALLBACK (on_hshift_offset_spinbutton_value_changed), NULL); @@ -1368,7 +1369,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed", G_CALLBACK (on_rotate_offset_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed", G_CALLBACK (on_hshift_value_spinbutton_value_changed), NULL); @@ -1384,7 +1385,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed", G_CALLBACK (on_rotate_value_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed", G_CALLBACK (on_hshift_step_spinbutton_value_changed), NULL); @@ -1400,14 +1401,14 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed", G_CALLBACK (on_rotate_step_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) match_grid_button, "clicked", G_CALLBACK (on_match_grid_button_clicked), NULL); g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled", G_CALLBACK (on_lock_valuechange_togglebutton_toggled), NULL); - + g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed", G_CALLBACK (on_fit_width_spinbutton_value_changed), NULL); @@ -1417,11 +1418,11 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) fit_button, "clicked", G_CALLBACK (on_fit_button_clicked), NULL); - + g_signal_connect ((gpointer) axial_button, "clicked", G_CALLBACK (on_axial_button_clicked), NULL); - + g_signal_connect ((gpointer) done_button, "clicked", G_CALLBACK (on_done_button_clicked), NULL); @@ -1431,8 +1432,8 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) cancel_button, "clicked", G_CALLBACK (on_cancel_button_clicked), NULL); - - + + return SurfaceInspector; } @@ -1454,7 +1455,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; char text[128] = { 0 }; - + if (!texdef_face_list_empty() && g_bListenChanged) { // activate only on entry change @@ -1465,7 +1466,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) if (text[0] <= ' ' || strchr(text, ' ')) Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text); else - { + { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) { tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; @@ -1485,9 +1486,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1508,9 +1509,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1524,7 +1525,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1532,9 +1533,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1548,8 +1549,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - - + + } static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1557,9 +1558,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1573,7 +1574,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1581,9 +1582,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1597,7 +1598,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } @@ -1661,9 +1662,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1682,9 +1683,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1703,9 +1704,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1724,9 +1725,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) diff --git a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp b/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp index 13e1cb4a..63c8378e 100644 --- a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp +++ b/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include #include #include "surfdlg_plugin.h" @@ -983,7 +984,7 @@ on_surf_value_entry_insert_text (GtkEditable *editable, user_data); } gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text"); - + g_free (result); } diff --git a/plugins/surface_quake2/surfacedialog.cpp b/plugins/surface_quake2/surfacedialog.cpp index a9461323..7f92210a 100644 --- a/plugins/surface_quake2/surfacedialog.cpp +++ b/plugins/surface_quake2/surfacedialog.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include +#include #include #include "surfdlg_plugin.h" @@ -323,7 +324,7 @@ static void PopulateTextureComboList() int num_of_list_items = 0; blank[0] = 0; - + if (texdef_face_list_empty()) { items = g_list_append (items, (gpointer) blank); @@ -332,7 +333,7 @@ static void PopulateTextureComboList() } else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); + temp_texdef_face_list = get_texdef_face_list(); tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); // For Texture Entry, activate only on entry change @@ -358,7 +359,7 @@ static void PopulateTextureComboList() // For Texture Entry, activate only on entry change strcpy (old_texture_entry, blank); } - + gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items); g_list_free(items); @@ -380,7 +381,7 @@ static void GetTexdefInfo_from_Radiant() unsigned int count = GetSelectedFaceCountfromBrushes(); if(count == 0) count = GetSelectedFaceCount(); - + g_texdef_face_vector.resize(count); if (!texdef_face_list_empty()) @@ -388,9 +389,9 @@ static void GetTexdefInfo_from_Radiant() texdef_to_face_t* p = get_texdef_face_list(); GetSelFacesTexdef( get_texdef_face_list() ); } - + IsFaceConflicting(); - PopulateTextureComboList(); + PopulateTextureComboList(); ZeroOffsetValues(); if ( texdef_face_list_empty() ) SetFlagButtons_Quake2( get_texdef_face_list() , TRUE); @@ -440,14 +441,14 @@ void UpdateSurfaceDialog() { if (!g_bListenUpdate) return; - + if (!SurfaceInspector) return; // avoid long delays on slow computers while (gtk_events_pending ()) gtk_main_iteration (); - + if (g_surfwin) { #ifdef DBG_SI @@ -468,7 +469,7 @@ void DoSurface (void) #endif if (!SurfaceInspector) create_SurfaceInspector (); - + ShowDlg(); SetTexMods (); } @@ -555,7 +556,7 @@ void SetTexMods() if (!g_surfwin) return; - + pt = &texturewin->texdef; g_bListenChanged = false; @@ -563,24 +564,24 @@ void SetTexMods() if(strncmp(pt->GetName(), "textures/", 9) != 0) texdef_offset.SetName(SHADER_NOT_FOUND); - + spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[0]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]); - + spin = GTK_SPIN_BUTTON (hshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[0]; - + spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.shift[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]); - + spin = GTK_SPIN_BUTTON (vshift_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->shift[1]; @@ -596,24 +597,24 @@ void SetTexMods() adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[0]; - + spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.scale[1]); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]); - + spin = GTK_SPIN_BUTTON (vscale_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->scale[1]; - + spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton); gtk_spin_button_set_value (spin, texdef_offset.rotate); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate); - + spin = GTK_SPIN_BUTTON (rotate_value_spinbutton); adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin)); adjust->step_increment = l_pIncrement->rotate; @@ -665,7 +666,7 @@ void FitAll() GtkWidget* create_SurfaceInspector (void) { - + GtkWidget *label; GtkWidget *hseparator; GtkWidget *eventbox; @@ -703,7 +704,7 @@ GtkWidget* create_SurfaceInspector (void) SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4); gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector"); - + SetWinPos_from_Prefs(SurfaceInspector); viewport8 = gtk_viewport_new (NULL, NULL); @@ -734,7 +735,7 @@ GtkWidget* create_SurfaceInspector (void) texture_combo = gtk_combo_new (); g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin), "KeepMeAround", texture_combo); - gtk_combo_disable_activate ( (GtkCombo*) texture_combo); + gtk_combo_disable_activate ( (GtkCombo*) texture_combo); gtk_widget_show (texture_combo); gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0); @@ -1035,7 +1036,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - + rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0); rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0); gtk_widget_show (rotate_value_spinbutton); @@ -1046,7 +1047,7 @@ GtkWidget* create_SurfaceInspector (void) gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - // Offset Spins + // Offset Spins hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0); hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2); gtk_widget_show (hshift_offset_spinbutton); @@ -1336,22 +1337,22 @@ GtkWidget* create_SurfaceInspector (void) gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - g_signal_connect ( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK (delete_event_callback), + g_signal_connect ( (gpointer) SurfaceInspector, + "delete_event", + G_CALLBACK (delete_event_callback), NULL ); g_signal_connect ((gpointer) SurfaceInspector, "destroy", G_CALLBACK (gtk_widget_destroy), NULL); - + g_signal_connect ((gpointer) texture_combo_entry, "key_press_event", G_CALLBACK (on_texture_combo_entry_key_press_event), NULL); g_signal_connect ((gpointer) texture_combo_entry, "activate", G_CALLBACK (on_texture_combo_entry_activate), NULL); - - + + g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed", G_CALLBACK (on_hshift_offset_spinbutton_value_changed), NULL); @@ -1367,7 +1368,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed", G_CALLBACK (on_rotate_offset_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed", G_CALLBACK (on_hshift_value_spinbutton_value_changed), NULL); @@ -1383,7 +1384,7 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed", G_CALLBACK (on_rotate_value_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed", G_CALLBACK (on_hshift_step_spinbutton_value_changed), NULL); @@ -1399,14 +1400,14 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed", G_CALLBACK (on_rotate_step_spinbutton_value_changed), NULL); - + g_signal_connect ((gpointer) match_grid_button, "clicked", G_CALLBACK (on_match_grid_button_clicked), NULL); g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled", G_CALLBACK (on_lock_valuechange_togglebutton_toggled), NULL); - + g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed", G_CALLBACK (on_fit_width_spinbutton_value_changed), NULL); @@ -1416,11 +1417,11 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) fit_button, "clicked", G_CALLBACK (on_fit_button_clicked), NULL); - + g_signal_connect ((gpointer) axial_button, "clicked", G_CALLBACK (on_axial_button_clicked), NULL); - + g_signal_connect ((gpointer) done_button, "clicked", G_CALLBACK (on_done_button_clicked), NULL); @@ -1430,8 +1431,8 @@ GtkWidget* create_SurfaceInspector (void) g_signal_connect ((gpointer) cancel_button, "clicked", G_CALLBACK (on_cancel_button_clicked), NULL); - - + + return SurfaceInspector; } @@ -1453,7 +1454,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; char text[128] = { 0 }; - + if (!texdef_face_list_empty() && g_bListenChanged) { // activate only on entry change @@ -1464,7 +1465,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data) if (text[0] <= ' ' || strchr(text, ' ')) Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text); else - { + { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) { tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; @@ -1484,9 +1485,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1507,9 +1508,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1523,7 +1524,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1531,9 +1532,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1547,8 +1548,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - - + + } static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1556,9 +1557,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1572,7 +1573,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data) @@ -1580,9 +1581,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1596,7 +1597,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton } GetTexMods(); } - + } @@ -1660,9 +1661,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1681,9 +1682,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1702,9 +1703,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) @@ -1723,9 +1724,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton, texdef_t* tmp_texdef; texdef_t* tmp_orig_texdef; texdef_to_face_t* temp_texdef_face_list; - + texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) ); - + if (!texdef_face_list_empty() && g_bListenChanged) { for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next) diff --git a/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp b/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp index 5978b4d5..7619ab1b 100644 --- a/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp +++ b/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include #include #include "surfdlg_plugin.h" diff --git a/plugins/surface_ufoai/surfacedialog.cpp b/plugins/surface_ufoai/surfacedialog.cpp index f5e3d0ec..7ff1357a 100644 --- a/plugins/surface_ufoai/surfacedialog.cpp +++ b/plugins/surface_ufoai/surfacedialog.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include +#include #include #include "surfdlg_plugin.h" diff --git a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp b/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp index ab7ebc25..e950ca3a 100644 --- a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp +++ b/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include #include #include "surfdlg_plugin.h" diff --git a/plugins/textool/StdAfx.h b/plugins/textool/StdAfx.h index f54bb591..c87a8b57 100644 --- a/plugins/textool/StdAfx.h +++ b/plugins/textool/StdAfx.h @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // standard headers #include #include +#include #include #include @@ -43,25 +44,25 @@ typedef char* LPCSTR; #define MB_YESNOCANCEL 0x00000003L #define MB_YESNO 0x00000004L #define MB_RETRYCANCEL 0x00000005L - - + + #define MB_ICONHAND 0x00000010L #define MB_ICONQUESTION 0x00000020L #define MB_ICONEXCLAMATION 0x00000030L #define MB_ICONASTERISK 0x00000040L - + #define MB_USERICON 0x00000080L #define MB_ICONWARNING MB_ICONEXCLAMATION #define MB_ICONERROR MB_ICONHAND #define MB_ICONINFORMATION MB_ICONASTERISK #define MB_ICONSTOP MB_ICONHAND - + #define MB_TYPEMASK 0x0000000FL #define MB_ICONMASK 0x000000F0L #define MB_DEFMASK 0x00000F00L #define MB_MODEMASK 0x00003000L #define MB_MISCMASK 0x0000C000L - + #define IDOK 1 #define IDCANCEL 2 #define IDABORT 3 @@ -146,7 +147,7 @@ public: // CSynapseClient API bool RequestAPI(APIDescriptor_t *pAPI); const char* GetInfo(); - + CSynapseClientTexTool() { } virtual ~CSynapseClientTexTool() { } }; diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 2e578035..b2dcf24d 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -69,7 +69,7 @@ void PrintWinding (winding_t *w) void PrintPlane (plane_t *p) { - Sys_Printf ("(%5.2f, %5.2f, %5.2f) : %5.2f\n", p->normal[0], p->normal[1], + Sys_Printf ("(%5.2f, %5.2f, %5.2f) : %5.2f\n", p->normal[0], p->normal[1], p->normal[2], p->dist); } @@ -108,10 +108,10 @@ void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv) int bestaxis; float dot,best; int i; - + best = 0; bestaxis = 0; - + for (i=0 ; i<6 ; i++) { dot = DotProduct (pln->normal, baseaxis[i*3]); @@ -121,7 +121,7 @@ void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv) bestaxis = i; } } - + VectorCopy (baseaxis[bestaxis*3+1], xv); VectorCopy (baseaxis[bestaxis*3+2], yv); } @@ -143,7 +143,7 @@ float SetShadeForPlane (plane_t *p) { //return ShadeForNormal(p->normal); - + int i; float f; @@ -166,7 +166,7 @@ float SetShadeForPlane (plane_t *p) // other f= (lightaxis[0] + lightaxis[1] + lightaxis[2]) / 3; return f; - + } vec3_t vecs[2]; @@ -315,7 +315,7 @@ void Face_MoveTexture(face_t *f, vec3_t delta) f->texdef.shift[0] -= vShift[0] / f->texdef.scale[0]; f->texdef.shift[1] -= vShift[1] / f->texdef.scale[1]; - + // clamp the shifts Clamp(f->texdef.shift[0], f->d_texture->width); Clamp(f->texdef.shift[1], f->d_texture->height); @@ -328,7 +328,7 @@ Face_SetColor ================ */ /*!\todo Replace all face_t::d_texture access with face_t::pShader::GetTexture.*/ -void Face_SetColor (brush_t *b, face_t *f, float fCurveColor) +void Face_SetColor (brush_t *b, face_t *f, float fCurveColor) { // set shading for face f->d_shade = SetShadeForPlane (&f->plane); @@ -381,7 +381,7 @@ void Face_TextureVectors (face_t *f, float STfromXYZ[2][4]) else if (td->rotate == 270) { sinv = -1 ; cosv = 0; } else - { + { ang = td->rotate / 180 * Q_PI; sinv = sin(ang); cosv = cos(ang); @@ -393,14 +393,14 @@ void Face_TextureVectors (face_t *f, float STfromXYZ[2][4]) sv = 1; else sv = 2; - + if (pvecs[1][0]) tv = 0; else if (pvecs[1][1]) tv = 1; else tv = 2; - + for (i=0 ; i<2 ; i++) { ns = cosv * pvecs[i][sv] - sinv * pvecs[i][tv]; nt = sinv * pvecs[i][sv] + cosv * pvecs[i][tv]; @@ -440,7 +440,7 @@ void Face_MakePlane (face_t *f) t2[j] = f->planepts[2][j] - f->planepts[1][j]; t3[j] = f->planepts[1][j]; } - + CrossProduct(t1,t2, f->plane.normal); if (VectorCompare (f->plane.normal, vec3_origin)) Sys_FPrintf (SYS_WRN, "WARNING: brush plane with no normal\n"); @@ -510,7 +510,7 @@ void DrawBrushEntityName (brush_t *b) s = sin (a/180*Q_PI); c = cos (a/180*Q_PI); for (i=0 ; i<3 ; i++) - mid[i] = (b->mins[i] + b->maxs[i])*0.5; + mid[i] = (b->mins[i] + b->maxs[i])*0.5; qglBegin (GL_LINE_STRIP); qglVertex3fv (mid); @@ -590,12 +590,12 @@ winding_t *Brush_MakeFaceWinding (brush_t *b, face_t *face) // flip the plane, because we want to keep the back side VectorSubtract (vec3_origin,clip->plane.normal, plane.normal); plane.dist = -clip->plane.dist; - + w = Winding_Clip (w, &plane, false); if (!w) return w; } - + if (w->numpoints < 3) { free(w); @@ -636,7 +636,7 @@ void Brush_SnapPlanepts (brush_t *b) f->planepts[i][j] = floor (f->planepts[i][j] + 0.5); } } - + /* ** Brush_Build ** @@ -650,7 +650,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi { bool bLocalConvert; - + #ifdef _DEBUG if (!g_qeglobals.m_bBrushPrimitMode && bConvert) Sys_Printf("Warning : conversion from brush primitive to old brush format not implemented\n"); @@ -679,7 +679,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi const aabb_t *aabb = b->owner->model.pRender->GetAABB(); VectorAdd(aabb->origin, aabb->extents, b->maxs); VectorSubtract(aabb->origin, aabb->extents, b->mins); - } + } //Patch_BuildPoints (b); // does nothing but set b->patchBrush true if the texdef contains SURF_PATCH ! @@ -1277,7 +1277,7 @@ void Brush_SetEpair(brush_t *b, const char *pKey, const char *pValue) } } -/* +/* ================= Brush_GetKeyValue ================= @@ -1324,9 +1324,9 @@ void CheckName( face_t *fa, char *pname ) if (strchr( fa->texdef.GetName(), ' ' )) { char Msg1[1024]; - + sprintf( Msg1, "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", fa->texdef.GetName() ); - + Sys_Printf("%s\n", Msg1 ); gtk_MessageBox(g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK ); strcpy( pname, SHADER_NOT_FOUND ); @@ -1337,7 +1337,7 @@ void CheckName( face_t *fa, char *pname ) // TODO: clean this detection part when bug will have disappeared if (fa->texdef.GetName()[0] == '(') { - char *text = "Bug #103494 detected, dropping texture. Please report to timo@qeradiant.com if you have a way to reproduce!\nNOTE: this message may popup several times .. once for each buggy face detected."; + const char *text = "Bug #103494 detected, dropping texture. Please report to timo@qeradiant.com if you have a way to reproduce!\nNOTE: this message may popup several times .. once for each buggy face detected."; Sys_Printf("%s\n", text); gtk_MessageBox(g_pParentWnd->m_pWidget, text, "Error saving map", MB_OK ); // need to cleanup this dead face name or we may loop endlessly @@ -1381,19 +1381,19 @@ brush_t *Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef) } b = Brush_Alloc(); - + pts[0][0][0] = mins[0]; pts[0][0][1] = mins[1]; - + pts[1][0][0] = mins[0]; pts[1][0][1] = maxs[1]; - + pts[2][0][0] = maxs[0]; pts[2][0][1] = maxs[1]; - + pts[3][0][0] = maxs[0]; pts[3][0][1] = mins[1]; - + for (i=0 ; i<4 ; i++) { pts[i][0][2] = mins[2]; @@ -1416,7 +1416,7 @@ brush_t *Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef) VectorCopy (pts[i][1], f->planepts[1]); VectorCopy (pts[i][0], f->planepts[2]); } - + f = Face_Alloc(); f->texdef = *texdef; f->texdef.flags &= ~SURF_KEEP; @@ -1593,7 +1593,7 @@ void Brush_MakeSided (int sides) } b = Brush_Alloc(); - + // create top face f = Face_Alloc(); f->texdef = *texdef; @@ -1872,7 +1872,7 @@ bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); - + // test ray against triangle // get triangle plane normal //VectorSubtract(p1, p2, v1); @@ -1906,7 +1906,7 @@ bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) // VectorSubtract(origin, p1, v2); // CrossProduct(v1, v2, normal[2]); //} - + for (i=0; i<3; i++) { VectorNormalize(normal[i]); @@ -1935,7 +1935,7 @@ bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, doub vec3_t vRay[2]; float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set - + VectorSubtract (origin, b->owner->origin, vRay[0]); VectorCopy (dir, vRay[1]); @@ -1965,7 +1965,7 @@ bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, doub { for (j = 0; j < 3; j++) VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); - + if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) { bIntersect = true; @@ -2062,7 +2062,7 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag d1 = DotProduct (p1, dir); *dist = d1; - + // new test stuff for patches if (!g_PrefsDlg.m_bPatchBBoxSelect && b->patchBrush) { @@ -2081,8 +2081,8 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag // IMPORTANT NOTE: // modifications to the discarding code here should be matched in the selection code - // see Brush_Draw - + // see Brush_Draw + // do some last minute filtering if (firstface && nFlags & SF_CAMERA) { @@ -2101,7 +2101,7 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag *dist = 0; return NULL; } - } + } if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP) { if (strstr(firstface->texdef.GetName(), "clip")) @@ -2139,7 +2139,7 @@ void Brush_AddToList (brush_t *b, brush_t *blist) { if (b->next || b->prev) Error ("Brush_AddToList: already linked"); - + if (blist == &selected_brushes || blist == &active_brushes) { if (b->patchBrush && blist == &selected_brushes) @@ -2151,16 +2151,16 @@ void Brush_AddToList (brush_t *b, brush_t *blist) blist->next->prev = b; blist->next = b; b->prev = blist; - + // TTimo messaging - DispatchRadiantMsg( RADIANT_SELECTION ); + DispatchRadiantMsg( RADIANT_SELECTION ); } void Brush_RemoveFromList (brush_t *b) { if (!b->next || !b->prev) Error ("Brush_RemoveFromList: not linked"); - + if (b->patchBrush) { Patch_Deselect(b->pPatch); @@ -2244,12 +2244,12 @@ void SetFaceTexdef2 (brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, SetFaceTexdef Doesn't set the curve flags - + NOTE : ( TTimo ) never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture use Texture_ForName() to find the right shader FIXME : send the right shader ( qtexture_t * ) in the parameters ? - + TTimo: surface plugin, added an IPluginTexdef* parameter if not NULL, get ->Copy() of it into the face ( and remember to hook ) if NULL, ask for a default @@ -2258,7 +2258,7 @@ NOTE : ( TTimo ) void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef) { int oldFlags; int oldContents; - + oldFlags = f->texdef.flags; oldContents = f->texdef.contents; @@ -2271,7 +2271,7 @@ void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprim ConvertTexMatWithQTexture( brushprimit_texdef, NULL, &f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture() ); } else - { + { if (bFitScale) { f->texdef = *texdef; @@ -2301,11 +2301,11 @@ void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprim f->texdef.flags = (f->texdef.flags & ~SURF_KEEP) | (oldFlags & SURF_KEEP); f->texdef.contents = (f->texdef.contents & ~CONTENTS_KEEP) | (oldContents & CONTENTS_KEEP); } - + #ifdef _DEBUG void Brush_SetTexture2 (brush_t *b, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef) { - for (face_t* f = b->brush_faces ; f ; f = f->next) + for (face_t* f = b->brush_faces ; f ; f = f->next) SetFaceTexdef2 (b, f, pShader, texdef, brushprimit_texdef, bFitScale, pTexdef); Brush_Build( b ); if (b->patchBrush) @@ -2318,7 +2318,7 @@ void Brush_SetTexture2 (brush_t *b, IShader *pShader, texdef_t *texdef, brushpri void Brush_SetTexture (brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef) { - for (face_t* f = b->brush_faces ; f ; f = f->next) + for (face_t* f = b->brush_faces ; f ; f = f->next) SetFaceTexdef (f, texdef, brushprimit_texdef, bFitScale, pTexdef); Brush_Build( b ); if (b->patchBrush) @@ -2414,7 +2414,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear) } - // if shearing, take all the planes adjacent to + // if shearing, take all the planes adjacent to // selected faces and rotate their points so the // edge clipped by a selcted face has two of the points if (!shear) @@ -2431,7 +2431,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear) // any points on f will become new control points for (i=0 ; inumpoints ; i++) { - d = DotProduct (w->points[i], f->plane.normal) + d = DotProduct (w->points[i], f->plane.normal) - f->plane.dist; if (d > -ON_EPSILON && d < ON_EPSILON) break; @@ -2457,7 +2457,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear) VectorCopy (w->points[i], f2->planepts[0]); if (++i == w->numpoints) i = 0; - + // see if the next point is also on the plane d = DotProduct (w->points[i] , f->plane.normal) - f->plane.dist; @@ -2512,7 +2512,7 @@ void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir continue; Brush_SelectFaceForDragging (b, f, shear); - } + } } bool g_bBuildWindingsNoTexBuild = false; @@ -2577,7 +2577,7 @@ void Brush_BuildWindings( brush_t *b, bool bSnap ) if (!w) continue; - + for (i=0 ; inumpoints ; i++) { // add to bounding box @@ -2706,7 +2706,7 @@ void Brush_SnapToGrid(brush_t *pb) else // multiplier = gridsize / component difference, rounded up mult[i] = (int)ceil(fabs(g_qeglobals.d_gridsize / diff[j][i])); } - + if (mult[0] > 1 && mult[1] > 1 && mult[2] > 1) // if all multipliers are greater than 1 { n = (mult[0] >= mult[1] && mult[0] >= mult[2]) ? 0 : (mult[1] >= mult[0] && mult[1] >= mult[2]) ? 1 : 2; @@ -2879,7 +2879,7 @@ void Brush_FaceDraw(face_t *face, int nGLState) qglBegin(GL_TRIANGLE_FAN); else qglBegin(GL_POLYGON); - + for (int i=0 ; inumpoints ; i++) { if (nGLState & DRAW_GL_TEXTURE_2D) @@ -2937,7 +2937,7 @@ void Brush_Draw(brush_t *b) continue; if (!bTrans && nGLState & DRAW_GL_BLEND) continue; - + // IMPORTANT NOTE: // modifications to the discarding code here should be matched in the selection code // see Brush_Ray @@ -2971,7 +2971,7 @@ void Brush_Draw(brush_t *b) prev = face->d_texture; qglBindTexture( GL_TEXTURE_2D, face->d_texture->texture_number ); } - + if (nGLState & DRAW_GL_LIGHTING && !g_PrefsDlg.m_bGLLighting) { if (!b->owner->eclass->fixedsize) @@ -2996,7 +2996,7 @@ void Brush_Draw(brush_t *b) else qglColor4fv(material); } - + // draw the polygon Brush_FaceDraw(face, nGLState); @@ -3019,9 +3019,9 @@ void Face_Draw( face_t *f ) entity_t *FindEntity(const char *pszKey, const char *pszValue) { entity_t *pe; - + pe = entities.next; - + for (; pe != NULL && pe != &entities ; pe = pe->next) { if (!strcmp(ValueForKey(pe, pszKey), pszValue)) @@ -3043,7 +3043,7 @@ void Brush_DrawXY(brush_t *b, int nViewType) Patch_DrawXY(b->pPatch); if (!g_bPatchShowBounds) return; - } + } if (b->owner->eclass->fixedsize) { @@ -3144,7 +3144,7 @@ void Brush_DrawXY(brush_t *b, int nViewType) if (face->plane.normal[1] >= 0) // stop axes being mirrored continue; } - else + else { if (face->plane.normal[0] <= 0) continue; @@ -3430,14 +3430,14 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth ) vec3_t vecs[2]; vec3_t coords[4]; texdef_t *td; - + if (nHeight < 1) nHeight = 1; if (nWidth < 1) nWidth = 1; - + ClearBounds (mins, maxs); - + w = face->face_winding; if (!w) { @@ -3447,12 +3447,12 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth ) { AddPointToBounds( w->points[i], mins, maxs ); } - + if (g_qeglobals.m_bBrushPrimitMode) Face_FitTexture_BrushPrimit( face, mins, maxs, nHeight, nWidth ); else { - + td = &face->texdef; // // get the current angle @@ -3460,10 +3460,10 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth ) ang = td->rotate / 180 * Q_PI; sinv = sin(ang); cosv = cos(ang); - + // get natural texture axis TextureAxisFromPlane(&face->plane, vecs[0], vecs[1]); - + min_s = DotProduct( mins, vecs[0] ); min_t = DotProduct( mins, vecs[1] ); max_s = DotProduct( maxs, vecs[0] ); @@ -3517,22 +3517,22 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth ) rot_height = (max_t - min_t); td->scale[0] = -(rot_width/((float)(face->d_texture->width*nWidth))); td->scale[1] = -(rot_height/((float)(face->d_texture->height*nHeight))); - + td->shift[0] = min_s/td->scale[0]; temp = (int)(td->shift[0] / (face->d_texture->width*nWidth)); temp = (temp+1)*face->d_texture->width*nWidth; td->shift[0] = (int)(temp - td->shift[0])%(face->d_texture->width*nWidth); - + td->shift[1] = min_t/td->scale[1]; temp = (int)(td->shift[1] / (face->d_texture->height*nHeight)); temp = (temp+1)*(face->d_texture->height*nHeight); td->shift[1] = (int)(temp - td->shift[1])%(face->d_texture->height*nHeight); - + td->shift[1] = min_t/td->scale[1]; temp = (int)(td->shift[1] / (face->d_texture->height*nHeight)); temp = (temp+1)*(face->d_texture->height*nHeight); td->shift[1] = (int)(temp - td->shift[1])%(face->d_texture->height*nHeight); - + } } @@ -3627,7 +3627,7 @@ void aabb_draw(const aabb_t *aabb, int mode) { 0, 1, 0 }, { 1, 0, 0 }, { 0,-1, 0 } }; - + unsigned short Indices[24] = { 2, 1, 5, 6, 1, 0, 4, 5, 0, 1, 2, 3, @@ -3637,11 +3637,11 @@ void aabb_draw(const aabb_t *aabb, int mode) qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays qglNormalPointer(GL_FLOAT, 0, Normals); - + //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array - + qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); - + //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array */ } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 85cdccc6..68b959d5 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include +#include #include extern void DrawPathLines(); @@ -81,11 +82,11 @@ void CamWnd::OnCreate () // I Split this up so as to add support for extension and user-friendly // compression format selection. // ADD new globals for your new format so as to minimise - // calls to Sys_QGL_ExtensionSupported + // calls to Sys_QGL_ExtensionSupported // NOTE TTimo: I don't really like this approach with globals. Frequent calls to Sys_QGL_ExtensionSupported don't sound like // a problem to me. If there is some caching to be done, then I think it should be inside Sys_QGL_ExtensionSupported /////////////////////////////////////////// - // Check for default OpenGL + // Check for default OpenGL if (Sys_QGL_ExtensionSupported ("GL_ARB_texture_compression")) { g_qeglobals.bTextureCompressionSupported = 1; @@ -100,9 +101,9 @@ void CamWnd::OnCreate () g_qeglobals.bTextureCompressionSupported = 1; g_qeglobals.m_bS3CompressionSupported = 1; } - + g_qeglobals.m_bOpenGLReady = true; - + g_PrefsDlg.UpdateTextureCompression(); #ifdef ATIHACK_812 @@ -124,7 +125,7 @@ void CamWnd::Cam_Init () m_nCambuttonstate = 0; } -void CamWnd::OnSize(int cx, int cy) +void CamWnd::OnSize(int cx, int cy) { m_Camera.width = cx; m_Camera.height = cy; @@ -148,7 +149,7 @@ void update_xor_rectangle(XORRectangle& xor_rectangle) xor_rectangle.set(rectangle); } -void CamWnd::OnMouseMove(guint32 flags, int pointx, int pointy) +void CamWnd::OnMouseMove(guint32 flags, int pointx, int pointy) { int height = m_pWidget->allocation.height; // NOTE RR2DO2 this hasn't got any use anymore really. It is an old qeradiant feature @@ -188,34 +189,34 @@ void CamWnd::OnMouseWheel(bool bUp) g_pParentWnd->OnTimer (); } -void CamWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy) { m_ptLastCursorX = pointx; m_ptLastCursorY = pointy; OriginalMouseDown(nFlags, pointx, pointy); } -void CamWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy) { OriginalMouseUp(nFlags, pointx, pointy); } -void CamWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy) { OriginalMouseDown(nFlags, pointx, pointy); } -void CamWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy) { OriginalMouseUp(nFlags, pointx, pointy); } -void CamWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy) { OriginalMouseDown(nFlags, pointx, pointy); } -void CamWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy) +void CamWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy) { OriginalMouseUp(nFlags, pointx, pointy); } @@ -362,7 +363,7 @@ void CamWnd::Cam_MouseControl (float dtime) Sys_SetCursorPos(m_ptLastCamCursorX, m_ptLastCamCursorY); - // Don't use pitch + // Don't use pitch if(!g_PrefsDlg.m_bCamFreeLookStrafe) { if (g_PrefsDlg.m_bCamInverseMouse) m_Camera.angles[PITCH] -= dy * dtime * g_PrefsDlg.m_nAngleSpeed; @@ -415,7 +416,7 @@ void CamWnd::Cam_MouseControl (float dtime) xh = xl*2; yl = m_Camera.height/3; yh = yl*2; - + xf *= 1.0 - fabs(yf); if (xf < 0) { @@ -429,10 +430,10 @@ void CamWnd::Cam_MouseControl (float dtime) if (xf < 0) xf = 0; } - + VectorMA (m_Camera.origin, yf*dtime*g_PrefsDlg.m_nMoveSpeed, m_Camera.forward, m_Camera.origin); m_Camera.angles[YAW] += xf*-dtime*g_PrefsDlg.m_nAngleSpeed; - + int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA); Sys_UpdateWindows (nUpdate); g_pParentWnd->OnTimer (); @@ -494,7 +495,7 @@ void CamWnd::ToggleFreeMove() widget = g_pParentWnd->m_pWidget; window = widget->window; } - + if (m_bFreeMove) { @@ -511,7 +512,7 @@ void CamWnd::ToggleFreeMove() pixmap = gdk_bitmap_create_from_data (NULL, buffer, 32, 32); mask = gdk_bitmap_create_from_data (NULL, buffer, 32, 32); GdkCursor *cursor = gdk_cursor_new_from_pixmap (pixmap, mask, &white, &black, 1, 1); - + gdk_window_set_cursor (window, cursor); gdk_cursor_unref (cursor); gdk_drawable_unref (pixmap); @@ -523,7 +524,7 @@ void CamWnd::ToggleFreeMove() // mode seems to work fine though...) m_FocusOutHandler_id = gtk_signal_connect (GTK_OBJECT (widget), "focus_out_event", GTK_SIGNAL_FUNC (camwindow_focusout), g_pParentWnd); - + { GdkEventMask mask = (GdkEventMask)(GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK @@ -533,7 +534,7 @@ void CamWnd::ToggleFreeMove() | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - + gdk_pointer_grab(widget->window, TRUE, mask, widget->window, NULL, GDK_CURRENT_TIME); } } @@ -665,7 +666,7 @@ void CamWnd::Cam_MouseMoved (int x, int y, int buttons) case sel_brush_on: Select_Ray( m_Camera.origin, dir, (SF_DRAG_ON|SF_CAMERA) ); break; - + case sel_brush_off: Select_Ray( m_Camera.origin, dir, (SF_DRAG_OFF|SF_CAMERA) ); break; @@ -818,7 +819,7 @@ void CamWnd::ProjectCamera(const vec3_t A, vec_t B[2]) // vec defines a direction in geometric space and P an origin point // the user is interacting from the camera view // (for example with texture adjustment shortcuts) -// and intuitively if he hits left / right / up / down +// and intuitively if he hits left / right / up / down // what happens in geometric space should match the left/right/up/down move in camera space // axis = 0: vec is along left/right // axis = 1: vec is along up/down @@ -891,7 +892,6 @@ extern void DrawModelBBox(brush_t *b); void CamWnd::Cam_DrawBrush(brush_t *b, int mode) { int nGLState = m_Camera.draw_glstate; - int nDrawMode = m_Camera.draw_mode; int nModelMode = g_PrefsDlg.m_nEntityShowState; GLfloat material[4], identity[4]; @@ -909,7 +909,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode) material[3] = 1.0f; qglColor4fv(material); - + if (g_PrefsDlg.m_bNewLightDraw) DrawLight(b->owner, nGLState, (IsBrushSelected(b)) ? g_PrefsDlg.m_nLightRadiuses : 0, 0); @@ -934,7 +934,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode) if(!(nGLState & DRAW_GL_TEXTURE_2D)) qglColor4fv(material); else qglColor4fv(identity); if(nGLState & DRAW_GL_LIGHTING) qglShadeModel(GL_SMOOTH); - + b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM); } break; @@ -1025,7 +1025,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode) && (b->owner->eclass->nShowFlags & ECLASS_ANGLE)) Brush_DrawFacingAngle(b, b->owner); } - } + } // brushes else @@ -1037,14 +1037,14 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode) qglShadeModel(GL_FLAT); Brush_Draw(b); } - } + } } void CamWnd::Cam_DrawBrushes(int mode) { brush_t *b; brush_t *pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes; - + for(b = active_brushes.next; b != &active_brushes; b=b->next) if (!b->bFiltered && !b->bCamCulled) Cam_DrawBrush(b, mode); for(b = pList->next; b != pList; b=b->next) @@ -1179,7 +1179,7 @@ void CamWnd::Cam_DrawStuff() break; default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n"); } - + qglDisable(GL_CULL_FACE); Cam_DrawBrushes(DRAW_WIRE); @@ -1213,7 +1213,7 @@ void CamWnd::Cam_DrawStuff() m_Camera.draw_glstate = DRAW_GL_WIRE; break; default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n"); - } + } qglEnable(GL_BLEND); @@ -1294,7 +1294,7 @@ void CamWnd::Cam_Draw() // // set up viewpoint // - + qglMatrixMode(GL_PROJECTION); qglLoadIdentity (); @@ -1326,7 +1326,7 @@ void CamWnd::Cam_Draw() qglLoadIdentity(); qglMultMatrixf(&m_Camera.modelview[0][0]); - + // grab the GL_PROJECTION and GL_MODELVIEW matrixes // used in GetRelativeAxes //qglGetFloatv (GL_PROJECTION_MATRIX, &m_Camera.projection[0][0]); @@ -1348,14 +1348,14 @@ void CamWnd::Cam_Draw() diffuse[3] = 1.0f; //material[0] = material[1] = material[2] = 0.8f; //material[3] = 1.0f; - + vec3_t vCam, vRotate; VectorSet(vCam, -1, 0, 0); //default cam pos VectorSet(vRotate, 0, -m_Camera.angles[0], 0); VectorRotate(vCam, vRotate, vCam); VectorSet(vRotate, 0, 0, m_Camera.angles[1]); VectorRotate(vCam, vRotate, vCam); - + inverse_cam_dir[0] = vCam[0]; inverse_cam_dir[1] = vCam[1]; inverse_cam_dir[2] = vCam[2]; @@ -1378,7 +1378,7 @@ void CamWnd::Cam_Draw() // Cam_DrawStuff(); - + qglEnableClientState(GL_VERTEX_ARRAY); qglDisableClientState(GL_NORMAL_ARRAY); qglDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -1418,7 +1418,7 @@ void CamWnd::Cam_Draw() Brush_FaceDraw(face, DRAW_GL_FLAT); } } - + int nCount = g_ptrSelectedFaces.GetSize(); if (nCount > 0) @@ -1433,7 +1433,7 @@ void CamWnd::Cam_Draw() qglDisableClientState(GL_NORMAL_ARRAY); qglDepthFunc (GL_LESS); } - + if (g_qeglobals.d_savedinfo.iSelectedOutlinesStyle & OUTLINE_ZBUF) { // non-zbuffered outline @@ -1469,7 +1469,7 @@ void CamWnd::Cam_Draw() if (g_qeglobals.d_select_mode == sel_vertex) { // GL_POINTS on Kyro Workaround - if(!g_PrefsDlg.m_bGlPtWorkaround) + if(!g_PrefsDlg.m_bGlPtWorkaround) { // brush verts qglPointSize (4); @@ -1478,7 +1478,7 @@ void CamWnd::Cam_Draw() for (i=0 ; ibCamCulled = false; } -void CamWnd::OnExpose () +void CamWnd::OnExpose () { if (!MakeCurrent ()) { @@ -1666,12 +1666,12 @@ void CamWnd::OnExpose () { if (g_Clip1.Set() && g_Clip2.Set()) { - g_pSplitList = (g_bSwitch) ? + g_pSplitList = (g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits; } } - Patch_LODMatchAll(); // spog + Patch_LODMatchAll(); // spog Cam_Draw (); QE_CheckOpenGLForErrors (); @@ -1685,7 +1685,7 @@ void CamWnd::BenchMark() { if (!MakeCurrent ()) Error ("glXMakeCurrent failed in Benchmark"); - + qglDrawBuffer (GL_FRONT); double dStart = Sys_DoubleTime (); for (int i=0 ; i < 100 ; i++) diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index fb1263e4..9c6c2f8f 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include +#include #include #include @@ -130,13 +131,13 @@ void Dialog::UpdateData (bool retrieve) DLG_DATA *data; GSList *lst; char buf[32]; - + if (retrieve) { for (lst = m_pDataList; lst != NULL; lst = g_slist_next (lst)) { data = (DLG_DATA*)lst->data; - + switch (data->type) { case DLG_CHECK_BOOL: @@ -181,14 +182,14 @@ void Dialog::UpdateData (bool retrieve) char *label; const char *entry; int i; - + *(int*)data->buffer = -1; entry = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (data->object)->entry)); - + for (i = 0; lst != NULL; lst = g_list_next (lst)) { gtk_label_get (GTK_LABEL (GTK_BIN (lst->data)->child), &label); - + if (strcmp (label, entry) == 0) { *(int*)data->buffer = i; @@ -249,16 +250,18 @@ void Dialog::UpdateData (bool retrieve) break; case DLG_COMBO_INT: { GList *lst = GTK_LIST (GTK_COMBO (data->object)->list)->children; - char *entry = ""; - + char *entry = NULL; + if (*(int*)data->buffer != -1) { lst = g_list_nth (lst, *(int*)data->buffer); if (lst != NULL) gtk_label_get (GTK_LABEL (GTK_BIN (lst->data)->child), &entry); } - - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), entry); + if (entry) + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), entry); + else + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), ""); } break; case DLG_COMBO_BOX_INT: { diff --git a/radiant/dialog.h b/radiant/dialog.h index cd00eff1..009ed185 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define _DIALOG_H_ #include +#include #include "str.h" #include "gtkmisc.h" @@ -46,7 +47,7 @@ class Dialog Dialog (); virtual ~Dialog (); - /*! + /*! start modal dialog box you need to use AddModalButton to select IDOK IDCANCEL buttons */ diff --git a/radiant/dialoginfo.cpp b/radiant/dialoginfo.cpp index 54a7472c..f7101e21 100644 --- a/radiant/dialoginfo.cpp +++ b/radiant/dialoginfo.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include +#include //#include "qe3.h" GtkWidget *g_dlgInfo; diff --git a/radiant/error.cpp b/radiant/error.cpp index 3d2a97c2..06d01f50 100644 --- a/radiant/error.cpp +++ b/radiant/error.cpp @@ -35,8 +35,8 @@ For abnormal program terminations */ /*! -\todo -FIXME the prompt wether to do prefs dialog, may not even be possible +\todo +FIXME the prompt wether to do prefs dialog, may not even be possible if the crash happens before the game is loaded */ @@ -64,16 +64,16 @@ void Error (const char *error, ...) if (GetLastError() != 0) { LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); strcat( text, "GetLastError: " ); /* @@ -146,6 +146,6 @@ void WINAPI Error (char *error, ...) va_start (argptr,error); vsprintf (text, error,argptr); va_end (argptr); - + Error((const char *)text); } diff --git a/radiant/filters.cpp b/radiant/filters.cpp index 5e0b069e..17a91195 100644 --- a/radiant/filters.cpp +++ b/radiant/filters.cpp @@ -2,30 +2,30 @@ Copyright (c) 2001, Loki software, inc. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Loki software nor the names of its contributors may be used -to endorse or promote products derived from this software without specific prior -written permission. +Neither the name of Loki software nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" @@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // type 5 = surface flags (q2) // type 6 = content flags (q2) // type 7 = content flags - no match (q2) -bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude) +bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, const char *str, int exclude) { bfilter_t *pNew = new bfilter_t; pNew->next = pFilter; @@ -51,7 +51,7 @@ bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exc return pNew; } -bfilter_t *FilterCreate (int type, int bmask, char *str, int exclude) +bfilter_t *FilterCreate (int type, int bmask, const char *str, int exclude) { g_qeglobals.d_savedinfo.filters = FilterAdd(g_qeglobals.d_savedinfo.filters, type, bmask, str, exclude); Syn_Printf("Added filter %s (type: %i, bmask: %i, exclude: %i)\n", str, type, bmask, exclude); @@ -107,13 +107,13 @@ FilterBrush bool FilterBrush(brush_t *pb) { - + if (!pb->owner) return FALSE; // during construction - + if (pb->hiddenBrush) return TRUE; - + if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD) { if (strcmp(pb->owner->eclass->name, "worldspawn") == 0 || !strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world @@ -121,7 +121,7 @@ bool FilterBrush(brush_t *pb) return TRUE; } } - + if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT) { if (strcmp(pb->owner->eclass->name, "worldspawn") != 0 && strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world @@ -129,7 +129,7 @@ bool FilterBrush(brush_t *pb) return TRUE; } } - + if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES ) { if (pb->patchBrush) @@ -137,8 +137,8 @@ bool FilterBrush(brush_t *pb) return TRUE; } } - - + + if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAILS ) { if (!pb->patchBrush && pb->brush_faces->texdef.contents & CONTENTS_DETAIL ) @@ -153,7 +153,7 @@ bool FilterBrush(brush_t *pb) return TRUE; } } - + // if brush belongs to world entity or a brushmodel entity and is not a patch if ( ( strcmp(pb->owner->eclass->name, "worldspawn") == 0 || !strncmp( pb->owner->eclass->name, "func", 4) @@ -186,7 +186,7 @@ bool FilterBrush(brush_t *pb) filterbrush=true; break; } - // quake2 - 5 == surface flags, 6 == content flags + // quake2 - 5 == surface flags, 6 == content flags } else if (filters->attribute == 5) { @@ -238,7 +238,7 @@ bool FilterBrush(brush_t *pb) break; } } - + // exclude by attribute 2 (for patch) brush->pPatch->pShader->getFlags() if (filters->active && filters->attribute == 2) @@ -253,7 +253,7 @@ bool FilterBrush(brush_t *pb) if (!drawpatch) // if a shader is found that should be excluded return TRUE; // exclude this patch } - + if (strcmp(pb->owner->eclass->name, "worldspawn") != 0) // if brush does not belong to world entity { bool drawentity=true; @@ -271,7 +271,7 @@ bool FilterBrush(brush_t *pb) break; } } - + // exclude by attribute 4 brush->owner->eclass->nShowFlags else if (filters->active && filters->attribute == 4) diff --git a/radiant/filters.h b/radiant/filters.h index 05776f55..b6e8ebcf 100644 --- a/radiant/filters.h +++ b/radiant/filters.h @@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define _FILTERS_H_ void FiltersActivate(void); -bfilter_t *FilterCreate(int type, int bmask, char *str, int exclude); -bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude); +bfilter_t *FilterCreate(int type, int bmask, const char *str, int exclude); +bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, const char *str, int exclude); bfilter_t *FilterListDelete(bfilter_t *pFilter); bfilter_t *FilterUpdate(bfilter_t *pFilter); bool FilterBrush(brush_t *pb); diff --git a/radiant/glwidget.cpp b/radiant/glwidget.cpp index 4498107f..ab9f0b9d 100644 --- a/radiant/glwidget.cpp +++ b/radiant/glwidget.cpp @@ -2,30 +2,30 @@ Copyright (c) 2001, Loki software, inc. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Loki software nor the names of its contributors may be used -to endorse or promote products derived from this software without specific prior -written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Neither the name of Loki software nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // OpenGL widget based on GtkGLExt @@ -147,7 +147,7 @@ int config_rgba_depth[] = { GDK_GL_ATTRIB_LIST_NONE, }; -const attribs_t configs_with_depth[] = +const attribs_t configs_with_depth[] = { config_rgba32_depth32, config_rgba32_depth24, @@ -212,9 +212,6 @@ static gint font_height; void gtk_glwidget_create_font (GtkWidget *widget) { - GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); - GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); - PangoFontDescription *font_desc; PangoFont *font; PangoFontMetrics *font_metrics; diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index d4570ff0..4fa84144 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -100,12 +100,12 @@ void FillClassList () GtkTreeIter iter; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, e->name, 1, e, -1); - } + } } // SetKeyValuePairs // -// Reset the key/value (aka property) listbox and fill it with the +// Reset the key/value (aka property) listbox and fill it with the // k/v pairs from the entity being edited. // @@ -142,7 +142,7 @@ void SetKeyValuePairs (bool bClearMD3) } // SetSpawnFlags -// +// // Update the checkboxes to reflect the flag state of the entity // void SetSpawnFlags(void) @@ -167,7 +167,7 @@ void SetSpawnFlags(void) } // GetSpawnFlags -// +// // Update the entity flags to reflect the state of the checkboxes // // NOTE: this function had a tendency to add "spawnflags" "0" on most entities @@ -191,7 +191,7 @@ void GetSpawnFlags(void) if (multiple_entities) { brush_t *b; - + for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) DeleteKey (b->owner, "spawnflags"); } @@ -199,12 +199,12 @@ void GetSpawnFlags(void) DeleteKey (edit_entity, "spawnflags"); } else - { - sprintf (sz, "%i", f); + { + sprintf (sz, "%i", f); if (multiple_entities) { brush_t *b; - + for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) SetKeyValue(b->owner, "spawnflags", sz); } @@ -225,7 +225,7 @@ bool UpdateSel(int iIndex, eclass_t *pec) int i, next_state; brush_t *b; - // syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk + // syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk // if we play with the list of entity classes // using a static flag to prevent recursion static bool bBlockUpdate = false; @@ -453,7 +453,7 @@ void AddProp() SetKeyValue(edit_entity, key, value); // refresh the prop listbox - SetKeyValuePairs(); + SetKeyValuePairs(); #ifdef USEPLUGINENTITIES @@ -599,7 +599,7 @@ void AssignSound() str = filename; } - gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer()); + gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer()); AddProp(); } } @@ -633,7 +633,7 @@ void AssignModel() str = filename; } - gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer()); + gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer()); AddProp(); edit_entity->brushes.onext->bModelFailed = false; } @@ -664,7 +664,7 @@ void SetInspectorMode(int iType) iType = W_GROUP; else iType = W_ENTITY; - } + } switch(iType) { @@ -745,28 +745,28 @@ void Group_AddToItem(brush_t *b, GtkCTreeNode* item) } const char *pName = NULL; // const char *pNamed = Brush_GetKeyValue(b, "name"); - + if (!b->owner || (b->owner == world_entity)) { - if (b->patchBrush) + if (b->patchBrush) { pName = "Generic Patch"; nImage = IMG_PATCH; - } - else + } + else { pName = "Generic Brush"; nImage = IMG_BRUSH; } - } - else + } + else { pName = b->owner->eclass->name; - if (b->owner->eclass->fixedsize) + if (b->owner->eclass->fixedsize) { nImage = IMG_ENTITY; - } - else + } + else { nImage = IMG_ENTITYGROUP; } @@ -989,7 +989,7 @@ static void eclasslist_selection_changed(GtkTreeSelection* selection, gpointer d // no world entity, we are not ready yet // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=917 if( !world_entity ) { - return; + return; } if(gtk_tree_selection_get_selected(selection, &model, &selected)) { @@ -1133,7 +1133,7 @@ static void groupdlg_add (GtkWidget *widget, gpointer data) if (name != NULL) { - // create a new group node + // create a new group node GtkCTreeNode *item; item = gtk_ctree_insert_node (GTK_CTREE (g_wndGroup.m_pTree), g_pGroupDlg->m_hWorld, NULL, &name, 0, tree_pixmaps[IMG_GROUP], tree_masks[IMG_GROUP], @@ -1178,7 +1178,7 @@ static void switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint pag else inspector_mode = W_GROUP; } - + if (inspector_mode == W_ENTITY) gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); else @@ -1259,7 +1259,7 @@ void GroupDlg::Create () GtkWidget* split1 = gtk_vpaned_new (); gtk_box_pack_start (GTK_BOX (vbox), split1, TRUE, TRUE, 0); gtk_widget_show (split1); - + { GtkWidget* split2 = gtk_vpaned_new (); gtk_paned_add1 (GTK_PANED (split1), split2); @@ -1302,7 +1302,7 @@ void GroupDlg::Create () gtk_widget_show(view); gtk_container_add(GTK_CONTAINER (scr), view); - + g_object_unref(G_OBJECT(store)); EntWidgets[EntList] = view; g_entlist_store = store; @@ -1329,7 +1329,7 @@ void GroupDlg::Create () { // Spawnflags (4 colums wide max, or window gets too wide.) - GtkWidget* table = LayoutTable = gtk_table_new (4, 4, FALSE); + GtkWidget* LayoutTable = gtk_table_new (4, 4, FALSE); gtk_box_pack_start (GTK_BOX (vbox2), LayoutTable, FALSE, TRUE, 0); gtk_widget_show(LayoutTable); @@ -1410,7 +1410,7 @@ void GroupDlg::Create () gtk_widget_show(view); gtk_container_add(GTK_CONTAINER (scr), view); - + g_object_unref(G_OBJECT(store)); EntWidgets[EntProps] = view; diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 58006414..f2a7bce0 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -2,30 +2,30 @@ Copyright (c) 2001, Loki software, inc. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Loki software nor the names of its contributors may be used -to endorse or promote products derived from this software without specific prior -written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Neither the name of Loki software nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // @@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "stdafx.h" #include #include +#include #ifdef _WIN32 #include @@ -52,19 +53,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. qboolean DoColor (int iIndex) { static bool bColorOpen = false; - + if(bColorOpen) { Sys_FPrintf(SYS_WRN, "DoColor dialog is already open\n"); return false; } - bColorOpen = true; - + bColorOpen = true; + if (color_dialog (g_pParentWnd->m_pWidget, g_qeglobals.d_savedinfo.colors[iIndex])) { - /* - ** scale colors so that at least one component is at 1.0F + /* + ** scale colors so that at least one component is at 1.0F ** if this is meant to select an entity color */ if (iIndex == COLOR_ENTITY) @@ -604,7 +605,7 @@ void DoProjectSettings () g_object_set_data(G_OBJECT (project), "view", view); g_object_set_data(G_OBJECT (project), "bsp_commands", store); gtk_container_add(GTK_CONTAINER (scr), view); - + g_object_unref(G_OBJECT(store)); } @@ -617,7 +618,7 @@ void DoProjectSettings () // HACK: hardcoded game stuff if (g_pGameDescription->mGameFile == "wolf.game" || g_pGameDescription->mGameFile == "et.game" || - g_pGameDescription->mGameFile == "jk2.game" || + g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "stvef.game" || g_pGameDescription->mGameFile == "sof2.game" || g_pGameDescription->mGameFile == "ja.game" ) @@ -709,7 +710,7 @@ void DoProjectSettings () gtk_table_attach(GTK_TABLE(table2), game, 1, 2, 7, 8, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - + /* wolf specific: select MP or SP mode */ @@ -718,7 +719,7 @@ void DoProjectSettings () combo_list = NULL; combo_list = g_list_append (combo_list, (void *)sWolfSPCombo); combo_list = g_list_append (combo_list, (void *)sWolfMPCombo); - + gamemode_combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list); gtk_widget_show(gamemode_combo); @@ -744,7 +745,7 @@ void DoProjectSettings () combo_list = NULL; combo_list = g_list_append (combo_list, (void *)sJK2SPCombo); combo_list = g_list_append (combo_list, (void *)sJK2MPCombo); - + gamemode_combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list); gtk_widget_show(gamemode_combo); @@ -769,7 +770,7 @@ void DoProjectSettings () combo_list = NULL; combo_list = g_list_append (combo_list, (void *)sJASPCombo); combo_list = g_list_append (combo_list, (void *)sJAMPCombo); - + gamemode_combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list); gtk_widget_show(gamemode_combo); @@ -794,7 +795,7 @@ void DoProjectSettings () combo_list = NULL; combo_list = g_list_append (combo_list, (void *)sSTVEFSPCombo); combo_list = g_list_append (combo_list, (void *)sSTVEFMPCombo); - + gamemode_combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list); gtk_widget_show(gamemode_combo); @@ -819,7 +820,7 @@ void DoProjectSettings () combo_list = NULL; combo_list = g_list_append (combo_list, (void *)sSOF2SPCombo); combo_list = g_list_append (combo_list, (void *)sSOF2MPCombo); - + gamemode_combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list); gtk_widget_show(gamemode_combo); @@ -1117,7 +1118,7 @@ void DoProjectSettings () char buf[1024]; const char *r; char *w; - + // convert path to unix format for(r = gtk_entry_get_text (GTK_ENTRY (base)), w=buf; *r != '\0'; r++, w++) *w = (*r == '\\') ? '/' : *r; @@ -1199,7 +1200,7 @@ void DoProjectSettings () SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir); } } - + // HACK: hardcoded wolf stuff if (g_pGameDescription->mGameFile == "wolf.game") { @@ -1245,7 +1246,7 @@ void DoProjectSettings () SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp"); } } - + // RIANT // STVEF HACK if (g_pGameDescription->mGameFile == "stvef.game") @@ -1682,7 +1683,7 @@ void DoEntityList () entitymap = g_slist_remove (entitymap, entitymap->data); } } - + g_object_unref(G_OBJECT(store)); } @@ -1717,14 +1718,14 @@ void DoEntityList () g_object_set_data(G_OBJECT(dlg), "keyvalues", store); gtk_container_add(GTK_CONTAINER (scr), view); - + g_object_unref(G_OBJECT(store)); } hbox2 = gtk_hbox_new (FALSE, 5); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 0); - + button = gtk_button_new_with_label ("Select"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); @@ -1766,13 +1767,13 @@ static void rotatedlg_apply (GtkWidget *widget, gpointer data) if (f != 0.0) Select_RotateAxis(0,f); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f); // reset to 0 on Apply - + spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "y")); f = gtk_spin_button_get_value_as_float (spin); if (f != 0.0) Select_RotateAxis(1,f); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f); - + spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "z")); f = gtk_spin_button_get_value_as_float (spin); if (f != 0.0) @@ -1800,13 +1801,13 @@ void DoRotateDlg () gtk_widget_show (hbox); gtk_container_add (GTK_CONTAINER (dlg), hbox); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - + table = gtk_table_new (3, 2, FALSE); gtk_widget_show (table); gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + label = gtk_label_new (" X "); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -1818,14 +1819,14 @@ void DoRotateDlg () gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + label = gtk_label_new (" Z "); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10); x = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0); g_object_set_data (G_OBJECT (dlg), "x", x); @@ -1835,7 +1836,7 @@ void DoRotateDlg () (GtkAttachOptions) (0), 0, 0); gtk_widget_set_usize (x, 60, -2); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (x), TRUE); - + adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10); y = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0); g_object_set_data (G_OBJECT (dlg), "y", y); @@ -1844,7 +1845,7 @@ void DoRotateDlg () (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (y), TRUE); - + adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10); z = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0); g_object_set_data (G_OBJECT (dlg), "z", z); @@ -1853,24 +1854,24 @@ void DoRotateDlg () (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (z), TRUE); - + vbox = gtk_vbox_new (FALSE, 5); gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - + button = gtk_button_new_with_label ("OK"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDCANCEL)); - + button = gtk_button_new_with_label ("Apply"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -1938,7 +1939,7 @@ void DoGamma () gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -2027,7 +2028,7 @@ void SelectBrush (int entitynum, int brushnum) if (b==&active_brushes) { // this is a regioned out entity - e = e->next; + e = e->next; // don't walk past the end either if (e == &entities) { @@ -2078,7 +2079,7 @@ void SelectBrush (int entitynum, int brushnum) if (g_pParentWnd->GetXZWnd()) g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; - + if (g_pParentWnd->GetYZWnd()) g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; } @@ -2134,7 +2135,7 @@ void DoFind () gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + label = gtk_label_new ("Entity number"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -2169,7 +2170,7 @@ void DoFind () gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); @@ -2243,7 +2244,7 @@ void DoSides (bool bCone, bool bSphere, bool bTorus) gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -2301,7 +2302,7 @@ void DoNewPatchDlg () gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + label = gtk_label_new ("Width:"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -2350,7 +2351,7 @@ void DoNewPatchDlg () gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -2411,7 +2412,7 @@ void DoScaleDlg () gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + label = gtk_label_new ("X:"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -2461,7 +2462,7 @@ void DoScaleDlg () gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -2543,7 +2544,7 @@ void DoThickenDlg () gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK)); gtk_widget_set_usize (button, 60, -2); - + button = gtk_button_new_with_label ("Cancel"); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); @@ -2565,13 +2566,13 @@ void DoThickenDlg () seams = gtk_check_button_new_with_label ("Seams"); gtk_widget_show (seams); gtk_box_pack_start (GTK_BOX (hbox), seams, FALSE, FALSE, 0); - + // bGroupResult group = gtk_check_button_new_with_label("Result to func_group"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(group), bGroupResult); gtk_box_pack_start(GTK_BOX(vbox), group, FALSE, FALSE, 0); gtk_widget_show(group); - + // Initialize dialog gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (seams), TRUE); @@ -2664,7 +2665,7 @@ void DoAbout () "you may report your problems at\n" "http://zerowing.idsoftware.com/bugzilla" ); - + gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); @@ -2702,7 +2703,7 @@ void DoAbout () gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); gtk_container_set_border_width (GTK_CONTAINER (table), 5); - + label = gtk_label_new ("Vendor:"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -2759,15 +2760,15 @@ void DoAbout () gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_extensions), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_extensions), GTK_SHADOW_IN); gtk_widget_show(sc_extensions); - + text_extensions = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(text_extensions), FALSE); gtk_container_add (GTK_CONTAINER (sc_extensions), text_extensions); GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_extensions)); gtk_text_buffer_set_text(buffer, (char *)qglGetString(GL_EXTENSIONS), -1); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_extensions), GTK_WRAP_WORD);; - gtk_widget_show(text_extensions); - + gtk_widget_show(text_extensions); + gtk_grab_add (dlg); gtk_widget_show (dlg); @@ -2779,7 +2780,7 @@ void DoAbout () } // ============================================================================= -// Command List dialog +// Command List dialog void DoCommandListDlg () { @@ -2876,7 +2877,7 @@ void DoCommandListDlg () gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, g_Commands[n].m_strCommand, 1, strMod.GetBuffer (), -1); } - + if (fileout != NULL) { strLine.Format("%-25s %s\r\n", g_Commands[n].m_strCommand, strMod.GetBuffer ()); @@ -2889,7 +2890,7 @@ void DoCommandListDlg () if (fileout != NULL) fclose (fileout); } - + g_object_unref(G_OBJECT(store)); } @@ -2915,7 +2916,7 @@ void DoCommandListDlg () } // ============================================================================= -// Texture List dialog +// Texture List dialog void DoTextureListDlg () { @@ -2949,7 +2950,7 @@ void DoTextureListDlg () GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING); GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); { GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); @@ -2975,7 +2976,7 @@ void DoTextureListDlg () textures = g_slist_remove (textures, textures->data); } } - + g_object_unref(G_OBJECT(store)); texture_list = view; @@ -3025,7 +3026,7 @@ void DoTextureListDlg () } // ============================================================================= -// Cap dialog +// Cap dialog int DoCapDlg (int *type, bool *b_GroupResult) { @@ -3033,7 +3034,7 @@ int DoCapDlg (int *type, bool *b_GroupResult) GtkWidget *bevel, *endcap, *ibevel, *iendcap; GSList *group = (GSList*)NULL; int loop = 1, ret = IDCANCEL; - + dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (dlg), "Cap"); gtk_signal_connect (GTK_OBJECT (dlg), "delete_event", @@ -3052,13 +3053,13 @@ int DoCapDlg (int *type, bool *b_GroupResult) radio_vbox = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(hbox), radio_vbox); gtk_widget_show(radio_vbox); - + table = gtk_table_new (4, 2, FALSE); gtk_widget_show (table); gtk_box_pack_start (GTK_BOX (radio_vbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + pixmap = new_pixmap (g_pParentWnd->m_pWidget, "cap_bevel.bmp"); gtk_widget_show (pixmap); gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1, @@ -3115,7 +3116,7 @@ int DoCapDlg (int *type, bool *b_GroupResult) group_toggle = gtk_check_button_new_with_label("Result to func_group"); gtk_container_add(GTK_CONTAINER(radio_vbox), group_toggle); gtk_widget_show(group_toggle); - + vbox = gtk_vbox_new (FALSE, 5); gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); @@ -3136,7 +3137,7 @@ int DoCapDlg (int *type, bool *b_GroupResult) // Gef: Set the state of the func_group toggle gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group_toggle), *b_GroupResult); - + // Initialize dialog gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bevel), TRUE); @@ -3168,7 +3169,7 @@ int DoCapDlg (int *type, bool *b_GroupResult) } // ============================================================================= -// Scripts dialog +// Scripts dialog void DoScriptsDlg () { @@ -3214,7 +3215,7 @@ void DoScriptsDlg () GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING); GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); { GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); @@ -3255,7 +3256,7 @@ void DoScriptsDlg () fclose (f); } } - + g_object_unref(G_OBJECT(store)); scripts_list = view; @@ -3317,7 +3318,7 @@ void DoScriptsDlg () } // ============================================================================= -// dialog +// dialog int DoBSInputDlg (const char *fields[5], float values[5]) { @@ -3403,7 +3404,7 @@ int DoBSInputDlg (const char *fields[5], float values[5]) } // ============================================================================= -// TextureLayout dialog +// TextureLayout dialog int DoTextureLayout (float *fx, float *fy) { @@ -3442,7 +3443,7 @@ int DoTextureLayout (float *fx, float *fy) gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + label = gtk_label_new ("Texture x:"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, @@ -3510,7 +3511,7 @@ int DoTextureLayout (float *fx, float *fy) } // ============================================================================= -// Name dialog +// Name dialog char* DoNameDlg (const char* title) { @@ -3576,7 +3577,7 @@ char* DoNameDlg (const char* title) } // ============================================================================= -// NewProject dialog +// NewProject dialog char* DoNewProjectDlg () { @@ -3670,7 +3671,7 @@ char* DoNewProjectDlg () } // ============================================================================= -// Text Editor dialog +// Text Editor dialog // master window widget static GtkWidget *text_editor = NULL; @@ -3916,7 +3917,7 @@ void DoTextEditor (const char* filename, int cursorpos) strEditCommand += " \""; strEditCommand += filename; strEditCommand += "\""; - + Sys_Printf("Launching: %s\n", strEditCommand.GetBuffer()); // note: linux does not return false if the command failed so it will assume success if (Q_Exec(NULL, (char *)strEditCommand.GetBuffer(), NULL, true) == false) @@ -3930,7 +3931,7 @@ void DoTextEditor (const char* filename, int cursorpos) } } #endif - + DoGtkTextEditor (filename, cursorpos); // old win32 code with EditPad bindings, broken @@ -3965,7 +3966,7 @@ void DoTextEditor (const char* filename, int cursorpos) } // ============================================================================= -// Light Intensity dialog +// Light Intensity dialog int DoLightIntensityDlg (int *intensity) { diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index bf173199..6e496669 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -2,30 +2,30 @@ Copyright (c) 2001, Loki software, inc. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Loki software nor the names of its contributors may be used -to endorse or promote products derived from this software without specific prior -written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Neither the name of Loki software nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // @@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include - +#include #ifdef _WIN32 #include @@ -106,7 +106,7 @@ void win32_get_window_pos(GtkWidget *widget, gint *x, gint *y) } #ifdef DBG_WINDOWPOS Sys_Printf("win32_get_window_pos %p %d,%d\n",widget,*x,*y); -#endif +#endif } #endif @@ -318,7 +318,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * return NULL; } - rc = fread(&g, 1, 1, fp); + rc = fread(&g, 1, 1, fp); m_bytesRead++; if (rc!=1) { @@ -327,7 +327,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * return NULL; } - rc = fread(&r, 1, 1, fp); + rc = fread(&r, 1, 1, fp); m_bytesRead++; if (rc != 1) { @@ -336,7 +336,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * return NULL; } - rc = fread(&dummy, 1, 1, fp); + rc = fread(&dummy, 1, 1, fp); m_bytesRead++; if (rc != 1) { @@ -372,7 +372,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * imagebits = (unsigned char *)malloc(w * h * 3); long row_size = w * 3; - if (imagebits != NULL) + if (imagebits != NULL) { *width = w; *height = h; @@ -386,7 +386,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * for (row = bmHeight - 1; row >= 0; row--) { // which row are we working on? - rowOffset = (long unsigned)row * row_size; + rowOffset = (long unsigned)row * row_size; if (bmBitsPixel == 24) { @@ -477,13 +477,13 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * unsigned char c, c1 = 0, *pp; row = 0; pp = outbuf + (bmHeight - 1) * bmWidth * 3; - + if (bmBitsPixel == 8) { while (row < bmHeight) { c = getc(fp); - + if (c) { // encoded mode @@ -524,7 +524,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * *pp = colormap[c1].rgbGreen; pp++; *pp = colormap[c1].rgbBlue; pp++; } - + if (c & 1) getc(fp); // odd length run: read an extra pad byte } @@ -536,7 +536,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * while (row < bmHeight) { c = getc(fp); - + if (c) { // encoded mode @@ -552,7 +552,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * { // c==0x00, escape codes c = getc(fp); - + if (c == 0x00) // end of line { row++; @@ -579,7 +579,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * *pp = colormap[(i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f)].rgbGreen; pp++; *pp = colormap[(i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f)].rgbBlue; pp++; } - + if (((c & 3) == 1) || ((c & 3) == 2)) getc(fp); // odd length run: read an extra pad byte } @@ -589,7 +589,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 * } if (colormap) delete [] colormap; - + fclose(fp); } return imagebits; @@ -686,7 +686,7 @@ void load_pixmap (const char* filename, GtkWidget* widget, GdkPixmap **gdkpixmap if (*gdkpixmap == NULL) { printf("gdkpixmap was null\n"); - char *dummy[] = { "1 1 1 1", " c None", " " }; + gchar *dummy[] = { "1 1 1 1", " c None", " " }; printf("calling gdk_pixmap_create_from_xpm_d\n"); *gdkpixmap = gdk_pixmap_create_from_xpm_d (gdk_get_default_root_window(), mask, NULL, dummy); } @@ -715,17 +715,17 @@ bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **m if (*gdkpixmap == NULL) { - + // look in core modules str = g_strAppPath; str += g_strModulesDir; str += "bitmaps/"; str += filename; bmp_to_pixmap (str.GetBuffer (), (GdkPixmap **)gdkpixmap, (GdkBitmap **)mask); - + if (*gdkpixmap == NULL) { - char *dummy[] = { "1 1 1 1", " c None", " " }; + gchar *dummy[] = { "1 1 1 1", " c None", " " }; *gdkpixmap = gdk_pixmap_create_from_xpm_d (gdk_get_default_root_window(), (GdkBitmap **)mask, NULL, dummy); return false; } @@ -735,7 +735,7 @@ bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **m } // Load a xpm file and return a pixmap widget. -GtkWidget* new_pixmap (GtkWidget* widget, char* filename) +GtkWidget* new_pixmap (GtkWidget* widget, const char* filename) { GdkPixmap *gdkpixmap; GdkBitmap *mask; @@ -748,7 +748,7 @@ GtkWidget* new_pixmap (GtkWidget* widget, char* filename) gdk_drawable_unref (mask); return pixmap; -} +} // ============================================================================= // Menu stuff @@ -770,8 +770,8 @@ GtkWidget* menu_tearoff (GtkWidget *menu) gtk_widget_show (menu_item); return menu_item; } - -GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, gchar *mnemonic) + +GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, const gchar *mnemonic) { GtkWidget *item, *sub_menu; @@ -787,7 +787,7 @@ GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, gchar *mnemonic) extern void AddMenuItem (GtkWidget* menu, unsigned int id); -GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id) +GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id) { GtkWidget *item; @@ -801,7 +801,7 @@ GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, Gtk return item; } -GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id, gboolean active) +GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean active) { GtkWidget *item; @@ -816,7 +816,7 @@ GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemoni return item; } -GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, gchar *mnemonic, GtkSignalFunc func, int id, gboolean state) +GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean state) { GtkWidget *item; GSList *group = (GSList*)NULL; @@ -922,7 +922,7 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti hbox = gtk_hbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2); gtk_widget_show (hbox); - + if (mode == MB_OK) { w = gtk_button_new_with_label ("Ok"); @@ -964,13 +964,13 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); - + w = gtk_button_new_with_label ("No"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDNO)); gtk_widget_show (w); - + w = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", @@ -987,7 +987,7 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_widget_show (w); - + w = gtk_button_new_with_label ("No"); gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (w), "clicked", @@ -1037,7 +1037,7 @@ static void file_sel_callback (GtkWidget *widget, gpointer data) parent = gtk_widget_get_toplevel (widget); loop = (int*)g_object_get_data (G_OBJECT (parent), "loop"); success = (bool*)g_object_get_data (G_OBJECT (parent), "success"); - + if ((int)data == IDOK) *success = true; @@ -1045,18 +1045,18 @@ static void file_sel_callback (GtkWidget *widget, gpointer data) else Sys_Printf("file_sel_callback != IDOK\n"); #endif - + *loop = 0; } #ifdef _WIN32 #include -static OPENFILENAME ofn; /* common dialog box structure */ -static char szDirName[MAX_PATH]; /* directory string */ -static char szFile[MAX_PATH]; /* filename string */ -static char szFileTitle[MAX_PATH]; /* file title string */ -static int i, cbString; /* integer count variables */ -static HANDLE hf; /* file handle */ +static OPENFILENAME ofn; /* common dialog box structure */ +static char szDirName[MAX_PATH]; /* directory string */ +static char szFile[MAX_PATH]; /* filename string */ +static char szFileTitle[MAX_PATH]; /* file title string */ +static int i, cbString; /* integer count variables */ +static HANDLE hf; /* file handle */ #else static char szFile[QER_MAX_NAMELEN]; #endif @@ -1107,7 +1107,7 @@ public: ConstructGTKMasks(); ConstructWin32Filters(); } - + filetype_t GetTypeForWin32Filter(const char *filter) const { for(int i=0; im_pWidget->window); if (pattern) { @@ -1250,7 +1250,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c ofn.lpstrCustomFilter = customfilter; ofn.nMaxCustFilter = sizeof(customfilter); ofn.lpstrFile = szFile; - ofn.nMaxFile = sizeof(szFile); + ofn.nMaxFile = sizeof(szFile); ofn.lpstrFileTitle = NULL; // we don't need to get the name of the file if(path) { @@ -1265,7 +1265,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c } else ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = title; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; /* Display the Open dialog box. */ // it's open or close depending on 'open' parameter @@ -1282,7 +1282,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c if(pattern != NULL) type = typelist.GetTypeForWin32Filter(customfilter+1); - + #ifdef FILEDLG_DBG Sys_Printf("Done.\n"); #endif @@ -1293,7 +1293,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c // do that the Gtk way if (title == NULL) title = open ? "Open File" : "Save File"; - + #ifdef FILEDLG_DBG Sys_Printf("Doing Gtk file dialog:\nBuilding new_path.."); #endif @@ -1351,10 +1351,10 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c gtk_signal_connect (GTK_OBJECT (file_sel), "delete_event", GTK_SIGNAL_FUNC (dialog_delete_callback), NULL); gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_sel)); - + if (parent != NULL) gtk_window_set_transient_for (GTK_WINDOW (file_sel), GTK_WINDOW (parent)); - + #ifdef FILEDLG_DBG Sys_Printf("set_data..."); #endif @@ -1364,7 +1364,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c #ifdef FILEDLG_DBG Sys_Printf("Done.\n"); #endif - + if (!open) { #ifdef FILEDLG_DBG @@ -1375,11 +1375,11 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c Sys_Printf("Done.\n"); #endif } - + if (new_path != NULL) { #ifdef FILEDLG_DBG - Sys_Printf("gtk_file_selection_set_filename... %p", file_sel); + Sys_Printf("gtk_file_selection_set_filename... %p", file_sel); #endif gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_sel), new_path); delete[] new_path; @@ -1390,15 +1390,15 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c gtk_grab_add (file_sel); #ifdef FILEDLG_DBG - Sys_Printf("gtk_widget_show... %p", file_sel); + Sys_Printf("gtk_widget_show... %p", file_sel); #endif gtk_widget_show (file_sel); #ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); + Sys_Printf("Done.\n"); #endif #ifdef FILEDLG_DBG - Sys_Printf("gtk_main_iteration..."); + Sys_Printf("gtk_main_iteration..."); #endif while (loop) gtk_main_iteration (); @@ -1413,7 +1413,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c #ifdef FILEDLG_DBG Sys_Printf("Done.\n"); #endif - + gtk_grab_remove (file_sel); gtk_widget_destroy (file_sel); #ifdef _WIN32 diff --git a/radiant/gtkmisc.h b/radiant/gtkmisc.h index c8446d6f..56c5f3ce 100644 --- a/radiant/gtkmisc.h +++ b/radiant/gtkmisc.h @@ -2,30 +2,30 @@ Copyright (c) 2001, Loki software, inc. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Loki software nor the names of its contributors may be used -to endorse or promote products derived from this software without specific prior -written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Neither the name of Loki software nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GTK_MISC_H_ @@ -62,14 +62,14 @@ gint widget_delete_hide (GtkWidget *widget); // GdkPixmap **gdkpixmap, GdkBitmap **mask bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **mask); void load_pixmap (const char* filename, GtkWidget* widget, GdkPixmap **gdkpixmap, GdkBitmap **mask); -GtkWidget* new_pixmap (GtkWidget* widget, char* filename); +GtkWidget* new_pixmap (GtkWidget* widget, const char* filename); GtkWidget* menu_separator (GtkWidget *menu); GtkWidget* menu_tearoff (GtkWidget *menu); -GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, char *mnemonic); -GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id); -GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id, gboolean active); -GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, gchar *mnemonic, GtkSignalFunc func, int id, gboolean state); +GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, const gchar *mnemonic); +GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id); +GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean active); +GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean state); GtkWidget* create_menu_in_menu_with_mnemonic (GtkWidget *menu, const gchar *mnemonic); diff --git a/radiant/main.cpp b/radiant/main.cpp index 82fab216..31a8511f 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #if defined (__linux__) || defined (__APPLE__) #include #include - #include + #include #ifdef __linux__ #include #endif @@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif #include +#include #include "stdafx.h" #include #include @@ -231,10 +232,10 @@ int loki_getmountpoint(const char *device, char *mntpt, int max_size) endmntent( mountfp ); } return(mounted); -} +} #endif -/* +/* This function gets the directory containing the running program. argv0 - the 0'th argument to the program */ @@ -563,7 +564,7 @@ int main( int argc, char* argv[] ) { // (for now I had to create symlinks) g_strBitmapsPath = g_strAppPath; g_strBitmapsPath += "bitmaps/"; - + // we will set this right after the game selection is done g_strGameToolsPath = g_strAppPath; @@ -631,7 +632,7 @@ int main( int argc, char* argv[] ) { if ( pid ) { fclose( pid ); } - + // a safe check to avoid people running broken installations // (otherwise, they run it, crash it, and blame us for not forcing them hard enough to pay attention while installing) // make something idiot proof and someone will make better idiots, this may be overkill @@ -640,7 +641,7 @@ int main( int argc, char* argv[] ) { #ifndef _DEBUG //#define CHECK_VERSION #endif -#ifdef CHECK_VERSION +#ifdef CHECK_VERSION // locate and open RADIANT_MAJOR and RADIANT_MINOR qboolean bVerIsGood = true; Str ver_file_name; @@ -703,7 +704,7 @@ int main( int argc, char* argv[] ) { _exit(-1); } #endif - + g_qeglobals.disable_ini = false; g_PrefsDlg.Init(); @@ -713,7 +714,7 @@ int main( int argc, char* argv[] ) { msg = "WARNING: Could not delete "; msg += g_pidGameFile; gtk_MessageBox (NULL, msg, "Radiant", MB_OK | MB_ICONERROR ); } - + /*! now the secondary game dependant .pid file http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297 @@ -867,7 +868,7 @@ int main( int argc, char* argv[] ) { gtk_window_set_transient_for( GTK_WINDOW( splash_screen ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); gtk_timeout_add( 1000, try_destroy_splash, NULL ); #endif - + g_pParentWnd->GetSynapseServer().DumpActiveClients(); //++timo: temporary debug @@ -935,7 +936,7 @@ void QE_ExpandBspString (char *bspaction, GPtrArray *out_array, char *mapname) // HACK: halflife compiler tools don't support -fs_game // HACK: neither does JKII/SoF2/ etc.. // do we use & have fs_game? - + if (g_pGameDescription->mGameFile != "hl.game" && *ValueForKey(g_qeglobals.d_project_entity,"gamename") != '\0') { @@ -1090,9 +1091,9 @@ void RunBsp (char *command) { strSys += (char *)g_ptr_array_index( sys, i); #ifdef _WIN32 // write temp\junk.txt in win32... NOTE: stops output to shell prompt window - if (i==0) + if (i==0) strSys += " >"; - else + else strSys += " >>"; strSys += "\""; strSys += temppath; @@ -1124,7 +1125,7 @@ void RunBsp (char *command) if (!hFile) Error ("Can't write to %s", batpath); fprintf (hFile, strSys.GetBuffer()); - fclose (hFile); + fclose (hFile); #endif Pointfile_Delete (); @@ -1188,7 +1189,7 @@ int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer ) 0, // reserved 0, 0, 0 // layer masks ignored }; // - int pixelformat = 0; + int pixelformat = 0; zbuffer = true; if ( !zbuffer ) @@ -1198,15 +1199,15 @@ int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer ) { LPVOID lpMsgBuf; FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); Sys_FPrintf (SYS_WRN, "GetLastError: %s", lpMsgBuf); Error ("ChoosePixelFormat failed"); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index d347d7b7..39d6cf68 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -28,12 +28,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #ifdef _WIN32 extern "C" { -#include +#include #define COMPILE_MULTIMON_STUBS #include } #endif #include +#include #include #include #include @@ -304,7 +305,7 @@ SKeyInfo g_Keys[] = {"F11", GDK_F11}, {"F12", GDK_F12}, {"Tab", GDK_Tab}, - {"Return", GDK_Return}, + {"Return", GDK_Return}, {"Comma", GDK_comma}, {"Period", GDK_period}, {"Plus", GDK_KP_Add}, @@ -334,7 +335,7 @@ int g_nKeyCount = sizeof(g_Keys) / sizeof(SKeyInfo); void WINAPI Sys_UpdateWindows (int nBits) { g_nUpdateBits |= nBits; -} +} // ============================================================================= // Static functions @@ -346,10 +347,10 @@ void HandleKeyUp (GtkWidget *widget, gpointer data) #ifdef DBG_KBD Sys_Printf("HandleKeyUp: %d\n", id); #endif - + if(g_bIgnoreCommands) return; - + switch (id) { case ID_CAMERA_FORWARD: g_pParentWnd->OnCameraForward (FALSE); break; @@ -481,7 +482,7 @@ gint HandleCommand (GtkWidget *widget, gpointer data) case ID_SELECTION_CSGSUBTRACT: g_pParentWnd->OnSelectionCsgsubtract (); break; case ID_SELECTION_CSGMERGE: g_pParentWnd->OnSelectionCsgmerge (); break; case ID_SELECTION_NOOUTLINE: g_pParentWnd->OnSelectionNoOutline (); break; - case ID_SELECTION_OUTLINESTYLE: g_pParentWnd->OnSelectionOutlineStyle (); break; + case ID_SELECTION_OUTLINESTYLE: g_pParentWnd->OnSelectionOutlineStyle (); break; case ID_SELECTION_SELECTCOMPLETETALL: g_pParentWnd->OnSelectionSelectcompletetall (); break; case ID_SELECTION_SELECTTOUCHING: g_pParentWnd->OnSelectionSelecttouching (); break; case ID_SELECTION_SELECTPARTIALTALL: g_pParentWnd->OnSelectionSelectpartialtall (); break; @@ -510,7 +511,7 @@ gint HandleCommand (GtkWidget *widget, gpointer data) case ID_TEXTURES_LOAD: g_pParentWnd->OnTexturesLoad (); break; case ID_TEXTURES_RELOADSHADERS: g_pParentWnd->OnTexturesReloadshaders (); break; case ID_TEXTURES_SHADERS_SHOW: g_pParentWnd->OnTexturesShadersShow (); break; - case ID_TEXTURES_TEXTUREWINDOWSCALE_200: + case ID_TEXTURES_TEXTUREWINDOWSCALE_200: case ID_TEXTURES_TEXTUREWINDOWSCALE_100: case ID_TEXTURES_TEXTUREWINDOWSCALE_50: case ID_TEXTURES_TEXTUREWINDOWSCALE_25: @@ -719,14 +720,14 @@ static void mainframe_destroy (GtkWidget *widget, gpointer data) // NOTE TTimo this is very clumsy, in MainFrame::OnDestroy we might call SavePrefs again // we will do more stuff in OnDestroy for window position saving too, so I guess this call is still relevant? g_PrefsDlg.SavePrefs (); - + wnd->OnDestroy (); - + // shutdown modules // NOTE: I've decided to do this before SavePrefs in case we broadcast some shutdown info // and modules / plugins decide to save some stuff g_pParentWnd->GetPlugInMgr().Shutdown(); - + delete wnd; QGL_Shutdown(); @@ -746,7 +747,7 @@ static gint mainframe_keypress (GtkWidget* widget, GdkEventKey* event, gpointer if(code == GDK_ISO_Left_Tab) { code = GDK_Tab; } - + #ifdef DBG_KBD Sys_Printf("key: %d (keyval: %d) (ctrl: %d)\n", code, event->keyval, event->state & GDK_CONTROL_MASK); #endif @@ -788,10 +789,10 @@ static gint mainframe_keypress (GtkWidget* widget, GdkEventKey* event, gpointer static gint mainframe_keyrelease (GtkWidget* widget, GdkEventKey* event, gpointer data) { unsigned int code = gdk_keyval_to_upper(event->keyval); - + if (gtk_accelerator_valid (event->keyval, (GdkModifierType)0)) return TRUE; - + for (int i = 0; i < g_nCommandCount; i++) { if (g_Commands[i].m_nKey == code) // find a match? @@ -849,7 +850,7 @@ void HandleHelpCommand (GtkWidget *widget, gpointer data) g_pParentWnd->handle_help_command(id); } -void MainFrame::process_xlink (Str &FileName, char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel) +void MainFrame::process_xlink (Str &FileName, const char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel) { xmlDocPtr pDoc; pDoc = xmlParseFile(FileName.GetBuffer()); @@ -926,7 +927,7 @@ void MainFrame::create_main_menu (GtkWidget *window, GtkWidget *vbox) global_accel = accel; gtk_window_add_accel_group (GTK_WINDOW (window), accel); - handle_box = gtk_handle_box_new (); + handle_box = gtk_handle_box_new (); gtk_box_pack_start (GTK_BOX (vbox), handle_box, FALSE, FALSE, 0); gtk_widget_show (handle_box); @@ -999,7 +1000,7 @@ void MainFrame::create_main_menu (GtkWidget *window, GtkWidget *vbox) GTK_SIGNAL_FUNC (HandleCommand), ID_FILE_CHECKUPDATE); // disable, the functionality is no longer available gtk_widget_set_sensitive( item, FALSE ); - + create_menu_item_with_mnemonic (menu, "E_xit", GTK_SIGNAL_FUNC (HandleCommand), ID_FILE_EXIT); @@ -1405,7 +1406,7 @@ void MainFrame::create_main_menu (GtkWidget *window, GtkWidget *vbox) create_menu_item_with_mnemonic (menu_in_menu, "Default Brush...", GTK_SIGNAL_FUNC (HandleCommand), ID_COLORS_BRUSH); create_menu_item_with_mnemonic (menu_in_menu, "Camera Background...", - GTK_SIGNAL_FUNC (HandleCommand), ID_COLORS_CAMERABACK); + GTK_SIGNAL_FUNC (HandleCommand), ID_COLORS_CAMERABACK); create_menu_item_with_mnemonic (menu_in_menu, "Selected Brush...", GTK_SIGNAL_FUNC (HandleCommand), ID_COLORS_SELECTEDBRUSH); create_menu_item_with_mnemonic (menu_in_menu, "Selected Brush (Camera)...", @@ -2259,7 +2260,7 @@ BOOL CALLBACK m_pCountMonitor (HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMon return TRUE; } -struct monitorInfo_s { +struct monitorInfo_s { GdkRectangle *win_monitors; int i_win_mon; }; @@ -2395,7 +2396,7 @@ static ZWnd *create_floating_zwnd(MainFrame *mainframe) gtk_widget_realize (wnd); - // turn OFF minimize and maximize boxes. + // turn OFF minimize and maximize boxes. // Must be *after* realize, or wnd->window is NULL // should do the right thing on *nix, need to verify. gdk_window_set_decorations ( wnd->window, @@ -2405,7 +2406,7 @@ static ZWnd *create_floating_zwnd(MainFrame *mainframe) GdkGeometry geometry; geometry.min_width = 50; //we only care about width, but have to set this too, or get nasty bugs - geometry.min_height = 10; + geometry.min_height = 10; gdk_window_set_geometry_hints( wnd->window,&geometry,GDK_HINT_MIN_SIZE); } @@ -2483,7 +2484,7 @@ void MainFrame::Create () screen = gdk_display_get_screen( display, 1 ); n_gdk_monitors = gdk_screen_get_n_monitors( screen ); - + Sys_Printf( "GDK detects that screen 1 has %d monitors\n", n_gdk_monitors ); for( i_mon = 0; i_mon < n_gdk_monitors; i_mon++ ) { @@ -2499,9 +2500,9 @@ void MainFrame::Create () PositionWindowOnPrimaryScreen( g_PrefsDlg.mWindowInfo.position ); } else { - primaryMonitorRect.x = primaryMonitorRect.y = 0; + primaryMonitorRect.x = primaryMonitorRect.y = 0; primaryMonitorRect.width = gdk_screen_width (); - primaryMonitorRect.height = gdk_screen_height (); + primaryMonitorRect.height = gdk_screen_height (); } #endif @@ -2920,7 +2921,7 @@ void MainFrame::Create () SetActiveXY(m_pXYWnd); - s_idle_id = gtk_timeout_add (25, mainframe_idle, this); + s_idle_id = gtk_timeout_add (25, mainframe_idle, this); QGL_InitExtensions (); @@ -2931,7 +2932,7 @@ void MainFrame::Create () } // remove the pid file - remove (g_pidGameFile.GetBuffer ()); + remove (g_pidGameFile.GetBuffer ()); Sys_Printf ("Entering message loop\n"); @@ -3016,8 +3017,8 @@ static void Sys_Iconify (GtkWidget *w) return; #if defined (__linux__) || defined (__APPLE__) - Sys_FPrintf(SYS_WRN, "FIXME: Sys_Iconify\n"); -#if 0 + Sys_FPrintf(SYS_WRN, "FIXME: Sys_Iconify\n"); +#if 0 XWindowAttributes xattr; GdkWindowPrivate *Private; @@ -3126,7 +3127,7 @@ void MainFrame::OnSleep() if (CurrentStyle() == eSplit) Sys_Iconify (m_pZWnd->m_pParent); - Sys_Iconify (m_pWidget); + Sys_Iconify (m_pWidget); Select_Deselect(); QERApp_FreeShaders (); g_bScreenUpdates = false; @@ -3665,15 +3666,15 @@ void MainFrame::CreateQEChildren() char buf[PATH_MAX]; const char *r; bool bTriedTemplate = false; - + if (g_PrefsDlg.m_nLastProjectVer != 0 && g_PrefsDlg.m_nLastProjectVer != PROJECT_VERSION) { // we need to regenerate from template Sys_Printf("last project has version %d, this binary wants version %d - regenerating from the template\n", g_PrefsDlg.m_nLastProjectVer, PROJECT_VERSION); g_PrefsDlg.m_strLastProject = ""; } - - r = g_PrefsDlg.m_strLastProject.GetBuffer(); - + + r = g_PrefsDlg.m_strLastProject.GetBuffer(); + while(r == NULL || *r == '\0' || access(r, R_OK) != 0 || !QE_LoadProject(r)) { if(!bTriedTemplate) @@ -3703,7 +3704,7 @@ void MainFrame::CreateQEChildren() QE_Init (); } -void MainFrame::OnTimer() +void MainFrame::OnTimer() { GdkModifierType mask; @@ -3765,7 +3766,7 @@ void MainFrame::SetButtonMenuStates() (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLUSTERPORTALS) != 0); item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_lightgrid")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), - (g_qeglobals.d_savedinfo.exclude & EXCLUDE_LIGHTGRID) != 0); + (g_qeglobals.d_savedinfo.exclude & EXCLUDE_LIGHTGRID) != 0); item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_world")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD) != 0); @@ -3789,7 +3790,7 @@ void MainFrame::SetButtonMenuStates() (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP) != 0); item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_botclips")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), - (g_qeglobals.d_savedinfo.exclude & EXCLUDE_BOTCLIP) != 0); + (g_qeglobals.d_savedinfo.exclude & EXCLUDE_BOTCLIP) != 0); item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_structural")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), (g_qeglobals.d_savedinfo.exclude & EXCLUDE_STRUCTURAL) != 0); @@ -3864,7 +3865,7 @@ void MainFrame::SetButtonMenuStates() /* if (g_qeglobals.d_project_entity) { - FillTextureMenu(); // redundant but i'll clean it up later.. yeah right.. + FillTextureMenu(); // redundant but i'll clean it up later.. yeah right.. FillBSPMenu(); } */ @@ -4106,26 +4107,26 @@ void SignalToolbarButton(GtkWidget *widget, gpointer data) void MainFrame::AddPlugInToolbarButton(const IToolbarButton* button) { - GtkWidget*const toolbar = GTK_WIDGET(g_object_get_data (G_OBJECT (m_pWidget), "toolbar_plugin")); + GtkWidget*const toolbar = GTK_WIDGET(g_object_get_data (G_OBJECT (m_pWidget), "toolbar_plugin")); toolbar_insert(toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), GTK_SIGNAL_FUNC(SignalToolbarButton), reinterpret_cast(const_cast(button))); } -void MainFrame::OnSelectionSelectNudgedown() +void MainFrame::OnSelectionSelectNudgedown() { NudgeSelection(3, g_qeglobals.d_gridsize); } -void MainFrame::OnSelectionSelectNudgeleft() +void MainFrame::OnSelectionSelectNudgeleft() { NudgeSelection(0, g_qeglobals.d_gridsize); } -void MainFrame::OnSelectionSelectNudgeright() +void MainFrame::OnSelectionSelectNudgeright() { NudgeSelection(2, g_qeglobals.d_gridsize); } -void MainFrame::OnSelectionSelectNudgeup() +void MainFrame::OnSelectionSelectNudgeup() { NudgeSelection(1, g_qeglobals.d_gridsize); } @@ -4213,10 +4214,10 @@ void MainFrame::Nudge(int nDim, float fNudge) vec3_t vMove; vMove[0] = vMove[1] = vMove[2] = 0; vMove[nDim] = fNudge; - - if((g_qeglobals.d_select_mode == sel_vertex || - g_qeglobals.d_select_mode == sel_curvepoint) - && g_qeglobals.d_num_move_points) + + if((g_qeglobals.d_select_mode == sel_vertex || + g_qeglobals.d_select_mode == sel_curvepoint) + && g_qeglobals.d_num_move_points) Select_NudgePoint(vMove, true); else Select_Move(vMove, true); @@ -4249,13 +4250,13 @@ void MainFrame::UpdatePatchToolbarButtons() // ============================================================================= // Command handlers -void MainFrame::OnFileNew() +void MainFrame::OnFileNew() { if (ConfirmModified()) Map_New (); } -void MainFrame::OnFileOpen() +void MainFrame::OnFileOpen() { if (!ConfirmModified()) return; @@ -4276,7 +4277,7 @@ void MainFrame::OnFileOpen() } } -void MainFrame::OnFileImportmap() +void MainFrame::OnFileImportmap() { const char *str; char buf[NAME_MAX]; @@ -4292,7 +4293,7 @@ void MainFrame::OnFileImportmap() } } -void MainFrame::OnFileSave() +void MainFrame::OnFileSave() { if (!strcmp(currentmap, "unnamed.map")) OnFileSaveas(); @@ -4300,16 +4301,16 @@ void MainFrame::OnFileSave() Map_SaveFile (currentmap, false); } -void MainFrame::OnFileSaveas() +void MainFrame::OnFileSaveas() { const char* str; char buf[NAME_MAX]; - + strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); strcat(buf, "maps/"); str = file_dialog (g_pParentWnd->m_pWidget, FALSE, "Save Map", buf, MAP_MAJOR); - + if (str != NULL) { strcpy (currentmap, str); @@ -4318,7 +4319,7 @@ void MainFrame::OnFileSaveas() } } -void MainFrame::OnFileExportmap() +void MainFrame::OnFileExportmap() { const char* str; char buf[NAME_MAX]; @@ -4334,7 +4335,7 @@ void MainFrame::OnFileExportmap() } } -void MainFrame::OnFileSaveregion() +void MainFrame::OnFileSaveregion() { const char* str; char buf[NAME_MAX]; @@ -4343,14 +4344,14 @@ void MainFrame::OnFileSaveregion() strcat(buf, "maps/"); str = file_dialog (g_pParentWnd->m_pWidget, FALSE, "Export Region", buf, MAP_MAJOR); - + if (str != NULL) { Map_SaveFile (str, true); // ignore region } } -void MainFrame::OnFileNewproject() +void MainFrame::OnFileNewproject() { char* name = DoNewProjectDlg (); @@ -4369,7 +4370,7 @@ void MainFrame::OnFileNewproject() CString strProjToLoad; CString strMapToLoad; - + // if the dir exists, ask the user if they want to continue anyway if (Q_mkdir (strNewBasePath.GetBuffer(), 0755) != 0) { @@ -4383,7 +4384,7 @@ void MainFrame::OnFileNewproject() return; } } - + CString strDir; strDir = strNewBasePath; strDir += "maps/"; @@ -4400,13 +4401,13 @@ void MainFrame::OnFileNewproject() // print a warning for total conversions, since setting the basepath when required files are // not there _will_ break things (ie; textures/radiant/notex.tga, scripts/entities.def) Sys_FPrintf(SYS_WRN, "*** Note: basepath unchanged\n"); - + SetKeyValue( g_qeglobals.d_project_entity, "gamename", name); - - strDir = strNewBasePath; + + strDir = strNewBasePath; strDir += "maps/autosave.map"; SetKeyValue( g_qeglobals.d_project_entity, "autosave", strDir.GetBuffer() ); - + // state that this is a user project file, no templating SetKeyValue( g_qeglobals.d_project_entity, "user_project", "1" ); // create the project file @@ -4414,19 +4415,19 @@ void MainFrame::OnFileNewproject() strProjToLoad += "scripts/"; strProjToLoad += name; strProjToLoad += "."; - strProjToLoad += PROJECT_FILETYPE; + strProjToLoad += PROJECT_FILETYPE; QE_SaveProject(strProjToLoad.GetBuffer()); free (name); } } -void MainFrame::OnFileLoadproject() +void MainFrame::OnFileLoadproject() { if (ConfirmModified()) ProjectDialog (); } -void MainFrame::OnFileProjectsettings() +void MainFrame::OnFileProjectsettings() { DoProjectSettings(); } @@ -4439,13 +4440,13 @@ void MainFrame::OnFilePointfile() Pointfile_Check (); } -void MainFrame::OnMru(unsigned int nID) +void MainFrame::OnMru(unsigned int nID) { if (ConfirmModified()) MRU_Activate (nID - ID_FILE_RECENT1); } -void MainFrame::OnFileExit() +void MainFrame::OnFileExit() { if (ConfirmModified()) { @@ -4468,29 +4469,29 @@ void MainFrame::OnFileCheckUpdate() #ifdef _WIN32 URL += "&OS_dlup=1"; #else - URL += "&OS_dlup=2"; + URL += "&OS_dlup=2"; #endif URL += "&Version_dlup=" RADIANT_VERSION; g_PrefsDlg.mGamesDialog.AddPacksURL(URL); OpenURL(URL.GetBuffer()); } -void MainFrame::OnEditUndo() +void MainFrame::OnEditUndo() { Undo_Undo(); } -void MainFrame::OnEditRedo() +void MainFrame::OnEditRedo() { Undo_Redo(); } -void MainFrame::OnEditCopybrush() +void MainFrame::OnEditCopybrush() { Copy(); } -void MainFrame::OnEditPastebrush() +void MainFrame::OnEditPastebrush() { Select_Deselect(); @@ -4504,7 +4505,7 @@ void MainFrame::OnEditPastebrush() void MainFrame::OnEditPastebrushToCamera() { - Select_Deselect(); + Select_Deselect(); if (ActiveXY()) { vec3_t mid, camorigin, delta; @@ -4531,7 +4532,7 @@ void MainFrame::OnEditPastebrushToCamera() } } -void MainFrame::OnSelectionDelete() +void MainFrame::OnSelectionDelete() { brush_t *brush; //if (ActiveXY()) @@ -4549,22 +4550,22 @@ void MainFrame::OnSelectionDelete() Undo_End(); } -void MainFrame::OnEditMapinfo() +void MainFrame::OnEditMapinfo() { DoMapInfo (); } -void MainFrame::OnEditEntityinfo() +void MainFrame::OnEditEntityinfo() { DoEntityList (); } -void MainFrame::OnBrushScripts() +void MainFrame::OnBrushScripts() { DoScriptsDlg (); } -void MainFrame::OnEditLoadprefab() +void MainFrame::OnEditLoadprefab() { const char *filename; CString CurPath; @@ -4583,7 +4584,7 @@ void MainFrame::OnEditLoadprefab() } } -void MainFrame::OnEditSaveprefab() +void MainFrame::OnEditSaveprefab() { const char *filename; CString CurPath; @@ -4606,7 +4607,7 @@ void MainFrame::OnEditSaveprefab() } } -void MainFrame::OnPrefs() +void MainFrame::OnPrefs() { int nView = g_PrefsDlg.m_nView; bool bToolbar = g_PrefsDlg.m_bWideToolbar; @@ -4615,7 +4616,7 @@ void MainFrame::OnPrefs() int nTextureQuality = g_PrefsDlg.m_nTextureQuality; int nLightRadiuses = g_PrefsDlg.m_nLightRadiuses; g_PrefsDlg.LoadPrefs(); - + if (g_PrefsDlg.DoModal() == IDOK) { if ((g_PrefsDlg.m_nLatchedView != nView) || @@ -4624,7 +4625,7 @@ void MainFrame::OnPrefs() (g_PrefsDlg.m_bLatchedPatchToolbar != bToolbar) || (g_PrefsDlg.m_bLatchedPluginToolbar != bPluginToolbar) || (g_PrefsDlg.m_nLatchedShader != nShader) || - (g_PrefsDlg.m_nLatchedTextureQuality != nTextureQuality) + (g_PrefsDlg.m_nLatchedTextureQuality != nTextureQuality) || (g_PrefsDlg.m_bLatchedFloatingZ != g_PrefsDlg.m_bFloatingZ) ) gtk_MessageBox(m_pWidget, "You must restart Radiant for the changes to take effect."); @@ -4648,7 +4649,7 @@ void MainFrame::OnPrefs() } } -void MainFrame::OnTogglecamera() +void MainFrame::OnTogglecamera() { if (CurrentStyle() == eFloating) // floating views { @@ -4668,7 +4669,7 @@ void MainFrame::OnTogglecamera() } } -void MainFrame::OnToggleconsole() +void MainFrame::OnToggleconsole() { if (FloatingGroupDialog()) // QE4 style { @@ -4692,7 +4693,7 @@ void MainFrame::OnViewEntity() // make sure we're working with the current selection (bugzilla #436) if( ! GTK_WIDGET_VISIBLE (g_qeglobals_gui.d_entity)) Select_Reselect(); - + if (!FloatingGroupDialog()) { if (GTK_WIDGET_VISIBLE (g_qeglobals_gui.d_entity) && inspector_mode == W_ENTITY) @@ -4745,7 +4746,7 @@ void MainFrame::OnViewGroups() } } -void MainFrame::OnToggleview() +void MainFrame::OnToggleview() { if (CurrentStyle() == eFloating) // QE4 style { @@ -4759,7 +4760,7 @@ void MainFrame::OnToggleview() } } -void MainFrame::OnToggleviewXz() +void MainFrame::OnToggleviewXz() { if (CurrentStyle() == eFloating) // QE4 style { @@ -4777,7 +4778,7 @@ void MainFrame::OnToggleviewXz() } } -void MainFrame::OnToggleviewYz() +void MainFrame::OnToggleviewYz() { if (CurrentStyle() == eFloating) // QE4 style { @@ -4794,7 +4795,7 @@ void MainFrame::OnToggleviewYz() } } -void MainFrame::OnTogglez() +void MainFrame::OnTogglez() { if ( g_pParentWnd->FloatingGroupDialog() ) // QE4 style { @@ -4812,19 +4813,19 @@ void MainFrame::OnTogglez() } } -void MainFrame::OnViewCenter() +void MainFrame::OnViewCenter() { m_pCamWnd->Camera()->angles[ROLL] = m_pCamWnd->Camera()->angles[PITCH] = 0; m_pCamWnd->Camera()->angles[YAW] = 22.5 * floor((m_pCamWnd->Camera()->angles[YAW]+11)/22.5); Sys_UpdateWindows (W_CAMERA | W_XY_OVERLAY); } -void MainFrame::OnViewUpfloor() +void MainFrame::OnViewUpfloor() { m_pCamWnd->Cam_ChangeFloor (true); } -void MainFrame::OnViewDownfloor() +void MainFrame::OnViewDownfloor() { m_pCamWnd->Cam_ChangeFloor (false); } @@ -4844,7 +4845,7 @@ void MainFrame::OnViewCenterview() } } -void MainFrame::OnViewNextview() +void MainFrame::OnViewNextview() { if (CurrentStyle() == eSplit) { @@ -4866,7 +4867,7 @@ void MainFrame::OnViewNextview() } } -void MainFrame::OnViewXy() +void MainFrame::OnViewXy() { if(!FloatingGroupDialog()) { @@ -4876,7 +4877,7 @@ void MainFrame::OnViewXy() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewSide() +void MainFrame::OnViewSide() { if (!FloatingGroupDialog()) { @@ -4886,7 +4887,7 @@ void MainFrame::OnViewSide() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewFront() +void MainFrame::OnViewFront() { if (!FloatingGroupDialog()) { @@ -4896,7 +4897,7 @@ void MainFrame::OnViewFront() Sys_UpdateWindows (W_XY); } -void MainFrame::OnView100() +void MainFrame::OnView100() { if (m_pXYWnd) m_pXYWnd->SetScale(1); @@ -4907,7 +4908,7 @@ void MainFrame::OnView100() Sys_UpdateWindows (W_XY|W_XY_OVERLAY); } -void MainFrame::OnViewZoomin() +void MainFrame::OnViewZoomin() { if (m_pXYWnd && m_pXYWnd->Active()) { @@ -4936,7 +4937,7 @@ void MainFrame::OnViewZoomin() // NOTE: the zoom out factor is 4/5, we could think about customizing it // we don't go below a zoom factor corresponding to 10% of the max world size // (this has to be computed against the window size) -void MainFrame::OnViewZoomout() +void MainFrame::OnViewZoomout() { float min_scale; if (m_pXYWnd && m_pXYWnd->Active()) @@ -4962,13 +4963,13 @@ void MainFrame::OnViewZoomout() Sys_UpdateWindows (W_XY|W_XY_OVERLAY); } -void MainFrame::OnViewZ100() +void MainFrame::OnViewZ100() { z.scale = 1; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); } -void MainFrame::OnViewZzoomin() +void MainFrame::OnViewZzoomin() { z.scale *= 5.0/4; if (z.scale > 4) @@ -4976,7 +4977,7 @@ void MainFrame::OnViewZzoomin() Sys_UpdateWindows (W_Z|W_Z_OVERLAY); } -void MainFrame::OnViewZzoomout() +void MainFrame::OnViewZzoomout() { z.scale *= 4.0f/5; if (z.scale < 0.125) @@ -4984,7 +4985,7 @@ void MainFrame::OnViewZzoomout() Sys_UpdateWindows (W_Z|W_Z_OVERLAY); } -void MainFrame::OnViewCubein() +void MainFrame::OnViewCubein() { g_PrefsDlg.m_nCubicScale--; if (g_PrefsDlg.m_nCubicScale < 1) @@ -4994,7 +4995,7 @@ void MainFrame::OnViewCubein() SetGridStatus(); } -void MainFrame::OnViewCubeout() +void MainFrame::OnViewCubeout() { g_PrefsDlg.m_nCubicScale++; if (g_PrefsDlg.m_nCubicScale > 22) @@ -5004,7 +5005,7 @@ void MainFrame::OnViewCubeout() SetGridStatus(); } -void MainFrame::OnViewShownames() +void MainFrame::OnViewShownames() { g_qeglobals.d_savedinfo.show_names = !g_qeglobals.d_savedinfo.show_names; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_view_shownames")); @@ -5015,7 +5016,7 @@ void MainFrame::OnViewShownames() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewShowAngles() +void MainFrame::OnViewShowAngles() { g_qeglobals.d_savedinfo.show_angles = !g_qeglobals.d_savedinfo.show_angles; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_view_showangles")); @@ -5026,7 +5027,7 @@ void MainFrame::OnViewShowAngles() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewShowblocks() +void MainFrame::OnViewShowblocks() { g_qeglobals.show_blocks ^= 1; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_view_showblocks")); @@ -5036,7 +5037,7 @@ void MainFrame::OnViewShowblocks() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewShowcoordinates() +void MainFrame::OnViewShowcoordinates() { g_qeglobals.d_savedinfo.show_coordinates ^= 1; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_view_showcoordinates")); @@ -5086,21 +5087,21 @@ void MainFrame::OnViewShowWorkzone() Sys_UpdateWindows (W_XY); } -void MainFrame::OnViewHideshowHideselected() +void MainFrame::OnViewHideshowHideselected() { Select_Hide(); Select_Deselect(); } -void MainFrame::OnViewHideshowShowhidden() +void MainFrame::OnViewHideshowShowhidden() { Select_ShowAllHidden(); } -/** +/** sets the view mode for the entities called upon LoadPrefs too -NOTE TTimo previous implementation had a SavePrefs call +NOTE TTimo previous implementation had a SavePrefs call .. I don't think it is relevant, removed (the prefs are saved upon exit) NOTE TTimo we activate the menu item, this is only needed when we are called upon a prefs load (otherwise we are always called following user action on the widget) @@ -5181,7 +5182,7 @@ void MainFrame::OnEntitiesSetViewAs(int mode) Sys_UpdateWindows(W_ALL); } -void MainFrame::OnViewCubicclipping() +void MainFrame::OnViewCubicclipping() { GtkWidget *w; @@ -5197,7 +5198,7 @@ void MainFrame::OnViewCubicclipping() Sys_UpdateWindows(W_CAMERA); } -void MainFrame::OnViewOpengllighting() +void MainFrame::OnViewOpengllighting() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_view_opengllighting")); g_PrefsDlg.m_bGLLighting ^= 1; @@ -5208,7 +5209,7 @@ void MainFrame::OnViewOpengllighting() g_bIgnoreCommands--; } -void MainFrame::OnSelectionDragedges() +void MainFrame::OnSelectionDragedges() { if (g_qeglobals.d_select_mode == sel_edge) { @@ -5223,7 +5224,7 @@ void MainFrame::OnSelectionDragedges() } } -void MainFrame::OnSelectionDragvertecies() +void MainFrame::OnSelectionDragvertecies() { if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_curvepoint) { @@ -5245,13 +5246,13 @@ void MainFrame::OnSelectionDragvertecies() } } -void MainFrame::OnSelectionClone() +void MainFrame::OnSelectionClone() { Select_Clone(); } // called when the escape key is used (either on the main window or on an inspector) -void MainFrame::OnSelectionDeselect() +void MainFrame::OnSelectionDeselect() { if (g_bClipMode) OnViewClipper(); @@ -5280,7 +5281,7 @@ void MainFrame::OnSelectionDeselect() } } -void MainFrame::OnBrushFlipx() +void MainFrame::OnBrushFlipx() { Undo_Start("flip X"); Undo_AddBrushList(&selected_brushes); @@ -5305,7 +5306,7 @@ void MainFrame::OnBrushFlipx() Undo_End(); } -void MainFrame::OnBrushFlipy() +void MainFrame::OnBrushFlipy() { Undo_Start("flip Y"); Undo_AddBrushList(&selected_brushes); @@ -5338,14 +5339,14 @@ void MainFrame::OnBrushFlipy() SetKeyValue(b->owner, "angle", buf); Brush_Build(b,true,true,false,false); // don't filter } - + } */ Undo_EndBrushList(&selected_brushes); Undo_End(); } -void MainFrame::OnBrushFlipz() +void MainFrame::OnBrushFlipz() { Undo_Start("flip Z"); Undo_AddBrushList(&selected_brushes); @@ -5354,7 +5355,7 @@ void MainFrame::OnBrushFlipz() Undo_End(); } -void MainFrame::OnBrushRotatex() +void MainFrame::OnBrushRotatex() { Undo_Start("rotate X"); Undo_AddBrushList(&selected_brushes); @@ -5363,7 +5364,7 @@ void MainFrame::OnBrushRotatex() Undo_End(); } -void MainFrame::OnBrushRotatey() +void MainFrame::OnBrushRotatey() { Undo_Start("rotate Y"); Undo_AddBrushList(&selected_brushes); @@ -5372,7 +5373,7 @@ void MainFrame::OnBrushRotatey() Undo_End(); } -void MainFrame::OnBrushRotatez() +void MainFrame::OnBrushRotatez() { Undo_Start("rotate Z"); Undo_AddBrushList(&selected_brushes); @@ -5381,7 +5382,7 @@ void MainFrame::OnBrushRotatez() Undo_End(); } -void MainFrame::OnSelectionArbitraryrotation() +void MainFrame::OnSelectionArbitraryrotation() { Undo_Start("arbitrary rotation"); Undo_AddBrushList(&selected_brushes); @@ -5392,7 +5393,7 @@ void MainFrame::OnSelectionArbitraryrotation() Undo_End(); } -void MainFrame::OnSelectScale() +void MainFrame::OnSelectScale() { Undo_Start("scale"); Undo_AddBrushList(&selected_brushes); @@ -5401,7 +5402,7 @@ void MainFrame::OnSelectScale() Undo_End(); } -void MainFrame::OnSelectionMakehollow() +void MainFrame::OnSelectionMakehollow() { //if (ActiveXY()) // ActiveXY()->UndoCopy(); @@ -5412,7 +5413,7 @@ void MainFrame::OnSelectionMakehollow() Undo_End(); } -void MainFrame::OnSelectionCsgsubtract() +void MainFrame::OnSelectionCsgsubtract() { Undo_Start("CSG subtract"); CSG_Subtract(); @@ -5456,29 +5457,29 @@ void MainFrame::OnSelectionOutlineStyle() Sys_UpdateWindows (W_CAMERA); } -void MainFrame::OnSelectionSelectcompletetall() +void MainFrame::OnSelectionSelectcompletetall() { if (ActiveXY()) ActiveXY()->UndoCopy(); Select_CompleteTall (); } -void MainFrame::OnSelectionSelecttouching() +void MainFrame::OnSelectionSelecttouching() { Select_Touching(); } -void MainFrame::OnSelectionSelectpartialtall() +void MainFrame::OnSelectionSelectpartialtall() { Select_PartialTall(); } -void MainFrame::OnSelectionSelectinside() +void MainFrame::OnSelectionSelectinside() { Select_Inside (); } -void MainFrame::OnViewClipper() +void MainFrame::OnViewClipper() { GtkWidget *w = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_view_clipper")); g_bIgnoreCommands++; @@ -5500,7 +5501,7 @@ void MainFrame::OnViewClipper() g_bIgnoreCommands--; } -void MainFrame::OnClipSelected() +void MainFrame::OnClipSelected() { if (m_pActiveXY && m_pActiveXY->ClipMode()) { @@ -5518,7 +5519,7 @@ void MainFrame::OnClipSelected() } } -void MainFrame::OnSplitSelected() +void MainFrame::OnSplitSelected() { if (m_pActiveXY) { @@ -5530,13 +5531,13 @@ void MainFrame::OnSplitSelected() } } -void MainFrame::OnFlipClip() +void MainFrame::OnFlipClip() { if (m_pActiveXY) m_pActiveXY->FlipClip(); } -void MainFrame::OnSelectionConnect() +void MainFrame::OnSelectionConnect() { Undo_Start("connect selected entities"); Undo_AddBrushList(&selected_brushes); @@ -5545,7 +5546,7 @@ void MainFrame::OnSelectionConnect() Undo_End(); } -void MainFrame::OnSelectionUngroupentity() +void MainFrame::OnSelectionUngroupentity() { Undo_Start("ungroup selected entities"); Undo_AddBrushList(&selected_brushes); @@ -5554,7 +5555,7 @@ void MainFrame::OnSelectionUngroupentity() Undo_End(); } -void MainFrame::OnSelectionMergeentity() +void MainFrame::OnSelectionMergeentity() { Undo_Start("merge entity"); Undo_AddBrushList(&selected_brushes); @@ -5563,7 +5564,7 @@ void MainFrame::OnSelectionMergeentity() Undo_End(); } -void MainFrame::OnSelectionGroupworld() +void MainFrame::OnSelectionGroupworld() { Undo_Start("group world"); Undo_AddBrushList(&selected_brushes); @@ -5572,7 +5573,7 @@ void MainFrame::OnSelectionGroupworld() Undo_End(); } -void MainFrame::OnSelectionMakeDetail() +void MainFrame::OnSelectionMakeDetail() { Undo_Start("make detail"); Undo_AddBrushList(&selected_brushes); @@ -5581,7 +5582,7 @@ void MainFrame::OnSelectionMakeDetail() Undo_End(); } -void MainFrame::OnSelectionMakeStructural() +void MainFrame::OnSelectionMakeStructural() { Undo_Start("make structural"); Undo_AddBrushList(&selected_brushes); @@ -5590,7 +5591,7 @@ void MainFrame::OnSelectionMakeStructural() Undo_End(); } -void MainFrame::OnBspCommand (unsigned int nID) +void MainFrame::OnBspCommand (unsigned int nID) { // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=503 // make sure we don't attempt to region compile a map with the camera outside the region @@ -5599,9 +5600,9 @@ void MainFrame::OnBspCommand (unsigned int nID) vec3_t vOrig; VectorSet(vOrig, (int)g_pParentWnd->GetCamWnd()->Camera()->origin[0], - (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], + (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], (int)g_pParentWnd->GetCamWnd()->Camera()->origin[2]); - + int i; for (i=0 ; i<3 ; i++) { @@ -5632,7 +5633,7 @@ void MainFrame::OnBspCommand (unsigned int nID) } } -void MainFrame::OnGrid (unsigned int nID) +void MainFrame::OnGrid (unsigned int nID) { if (nID == ID_GRID_025) { @@ -5670,7 +5671,7 @@ void MainFrame::OnGrid (unsigned int nID) Sys_UpdateWindows (W_XY|W_Z); } -void MainFrame::OnSnaptogrid() +void MainFrame::OnSnaptogrid() { g_PrefsDlg.m_bNoClamp ^= 1; g_PrefsDlg.SavePrefs (); @@ -5681,7 +5682,7 @@ void MainFrame::OnSnaptogrid() g_bIgnoreCommands--; } -void MainFrame::OnTexturesShowinuse() +void MainFrame::OnTexturesShowinuse() { Sys_BeginWait (); Texture_ShowInuse (); @@ -5693,28 +5694,28 @@ void MainFrame::OnTexturesShowinuse() Sys_EndWait (); } -void MainFrame::OnTexturesShowall() +void MainFrame::OnTexturesShowall() { Texture_ShowAll(); } // do some triggering on/off, if the inspector is already up then hide it -void MainFrame::OnTexturesInspector() +void MainFrame::OnTexturesInspector() { ToggleSurface(); } -void MainFrame::OnViewNearest(unsigned int nID) +void MainFrame::OnViewNearest(unsigned int nID) { Texture_SetMode(nID); } -void MainFrame::OnTextureReplaceall() +void MainFrame::OnTextureReplaceall() { FindTextureDialog::show(); } -void MainFrame::OnToggleLock() +void MainFrame::OnToggleLock() { g_PrefsDlg.m_bTextureLock = !g_PrefsDlg.m_bTextureLock; @@ -5726,7 +5727,7 @@ void MainFrame::OnToggleLock() SetGridStatus(); } -void MainFrame::OnToggleRotatelock() +void MainFrame::OnToggleRotatelock() { g_PrefsDlg.m_bRotateLock ^= 1; @@ -5740,7 +5741,7 @@ void MainFrame::OnToggleRotatelock() // use a dialog for direct selection of a texture menu // the API is a bit crappy, we need to set texture_directory to the directory name in /textures/ -void MainFrame::OnTexturesLoad() +void MainFrame::OnTexturesLoad() { char def_path[NAME_MAX]; @@ -5776,7 +5777,7 @@ void MainFrame::OnTexturesLoad() Sys_FPrintf(SYS_WRN, "texture load dialog cancelled\n"); } -void MainFrame::OnTexturesReloadshaders() +void MainFrame::OnTexturesReloadshaders() { Sys_BeginWait (); QERApp_ReloadShaders(); @@ -5787,7 +5788,7 @@ void MainFrame::OnTexturesReloadshaders() Sys_EndWait(); } -void MainFrame::OnTexturesShadersShow() +void MainFrame::OnTexturesShadersShow() { g_PrefsDlg.m_bShowShaders ^= 1; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_textures_shaders_show")); @@ -5832,7 +5833,7 @@ void MainFrame::SetTextureScale(int id) Texture_ResetPosition(); } -void MainFrame::OnTexturewindowScaleup() +void MainFrame::OnTexturewindowScaleup() { switch(g_PrefsDlg.m_nTextureScale) { // 200, all the way in, don't do anything @@ -5851,7 +5852,7 @@ void MainFrame::OnTexturewindowScaleup() } } -void MainFrame::OnTexturewindowScaledown() +void MainFrame::OnTexturewindowScaledown() { switch(g_PrefsDlg.m_nTextureScale) { case 200: @@ -5870,12 +5871,12 @@ void MainFrame::OnTexturewindowScaledown() } } -void MainFrame::OnTexturesLoadlist() +void MainFrame::OnTexturesLoadlist() { DoTextureListDlg (); } -void MainFrame::OnTexturesShaderlistonly() +void MainFrame::OnTexturesShaderlistonly() { g_PrefsDlg.m_bTexturesShaderlistOnly ^= 1; GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget),"menu_textures_shaderlistonly")); @@ -5885,7 +5886,7 @@ void MainFrame::OnTexturesShaderlistonly() FillTextureMenu(); } -void MainFrame::OnTextureWad(unsigned int nID) +void MainFrame::OnTextureWad(unsigned int nID) { Sys_BeginWait (); Texture_ShowDirectory (nID); @@ -5893,12 +5894,12 @@ void MainFrame::OnTextureWad(unsigned int nID) Sys_EndWait (); } -void MainFrame::OnMiscBenchmark() +void MainFrame::OnMiscBenchmark() { m_pCamWnd->BenchMark(); } -void MainFrame::OnColorSetoriginal() +void MainFrame::OnColorSetoriginal() { for (int i=0 ; i<3 ; i++) { @@ -5950,7 +5951,7 @@ void MainFrame::OnColorSetoriginal() Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorSetqer() +void MainFrame::OnColorSetqer() { for (int i=0 ; i<3 ; i++) { @@ -5992,7 +5993,7 @@ void MainFrame::OnColorSetqer() Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorSetblack() +void MainFrame::OnColorSetblack() { for (int i=0 ; i<3 ; i++) { @@ -6038,7 +6039,7 @@ void MainFrame::OnColorSetblack() } /* ydnar: to emulate maya/max/lightwave color schemes */ -void MainFrame::OnColorSetydnar() +void MainFrame::OnColorSetydnar() { for (int i=0 ; i<3 ; i++) { @@ -6080,91 +6081,91 @@ void MainFrame::OnColorSetydnar() Sys_UpdateWindows (W_ALL); } -void MainFrame::OnTexturebk() +void MainFrame::OnTexturebk() { DoColor(COLOR_TEXTUREBACK); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsXybk() +void MainFrame::OnColorsXybk() { DoColor(COLOR_GRIDBACK); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsMajor() +void MainFrame::OnColorsMajor() { DoColor(COLOR_GRIDMAJOR); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsMinor() +void MainFrame::OnColorsMinor() { DoColor(COLOR_GRIDMINOR); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsMajor_Alt() +void MainFrame::OnColorsMajor_Alt() { DoColor(COLOR_GRIDMAJOR_ALT); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsMinor_Alt() +void MainFrame::OnColorsMinor_Alt() { DoColor(COLOR_GRIDMINOR_ALT); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsGridtext() +void MainFrame::OnColorsGridtext() { DoColor(COLOR_GRIDTEXT); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsGridblock() +void MainFrame::OnColorsGridblock() { DoColor(COLOR_GRIDBLOCK); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsCameraBack() +void MainFrame::OnColorsCameraBack() { DoColor(COLOR_CAMERABACK); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsBrush() +void MainFrame::OnColorsBrush() { DoColor(COLOR_BRUSHES); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsSelectedbrush() +void MainFrame::OnColorsSelectedbrush() { DoColor(COLOR_SELBRUSHES); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsSelectedbrush3D() +void MainFrame::OnColorsSelectedbrush3D() { DoColor(COLOR_SELBRUSHES3D); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsClipper() +void MainFrame::OnColorsClipper() { DoColor(COLOR_CLIPPER); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnColorsViewname() +void MainFrame::OnColorsViewname() { DoColor(COLOR_VIEWNAME); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnMiscGamma() +void MainFrame::OnMiscGamma() { float fSave = g_qeglobals.d_savedinfo.fGamma; DoGamma(); @@ -6173,27 +6174,27 @@ void MainFrame::OnMiscGamma() gtk_MessageBox(m_pWidget, "You must restart Radiant for Gamma settings to take effect."); } } -void MainFrame::OnMiscFindbrush() +void MainFrame::OnMiscFindbrush() { DoFind(); } -void MainFrame::OnMiscNextleakspot() +void MainFrame::OnMiscNextleakspot() { Pointfile_Next(); } -void MainFrame::OnMiscPreviousleakspot() +void MainFrame::OnMiscPreviousleakspot() { Pointfile_Prev(); } -void MainFrame::OnMiscPrintxy() +void MainFrame::OnMiscPrintxy() { // WXY_Print(); } -void MainFrame::OnMiscSelectentitycolor() +void MainFrame::OnMiscSelectentitycolor() { if (edit_entity) { @@ -6229,7 +6230,7 @@ void MainFrame::OnMiscSelectentitycolor() } } -void MainFrame::OnConvertcurves() +void MainFrame::OnConvertcurves() { #if 0 Select_Deselect(); @@ -6251,32 +6252,32 @@ void MainFrame::OnConvertcurves() #endif } -void MainFrame::OnRegionOff() +void MainFrame::OnRegionOff() { Map_RegionOff (); } -void MainFrame::OnRegionSetxy() +void MainFrame::OnRegionSetxy() { Map_RegionXY (); } -void MainFrame::OnRegionSettallbrush() +void MainFrame::OnRegionSettallbrush() { Map_RegionTallBrush (); } -void MainFrame::OnRegionSetbrush() +void MainFrame::OnRegionSetbrush() { Map_RegionBrush (); } -void MainFrame::OnRegionSetselection() +void MainFrame::OnRegionSetselection() { Map_RegionSelectedBrushes (); } -void MainFrame::OnBrush3sided() +void MainFrame::OnBrush3sided() { Undo_Start("3 sided"); Undo_AddBrushList(&selected_brushes); @@ -6285,7 +6286,7 @@ void MainFrame::OnBrush3sided() Undo_End(); } -void MainFrame::OnBrush4sided() +void MainFrame::OnBrush4sided() { Undo_Start("4 sided"); Undo_AddBrushList(&selected_brushes); @@ -6294,7 +6295,7 @@ void MainFrame::OnBrush4sided() Undo_End(); } -void MainFrame::OnBrush5sided() +void MainFrame::OnBrush5sided() { Undo_Start("5 sided"); Undo_AddBrushList(&selected_brushes); @@ -6303,7 +6304,7 @@ void MainFrame::OnBrush5sided() Undo_End(); } -void MainFrame::OnBrush6sided() +void MainFrame::OnBrush6sided() { Undo_Start("6 sided"); Undo_AddBrushList(&selected_brushes); @@ -6312,7 +6313,7 @@ void MainFrame::OnBrush6sided() Undo_End(); } -void MainFrame::OnBrush7sided() +void MainFrame::OnBrush7sided() { Undo_Start("7 sided"); Undo_AddBrushList(&selected_brushes); @@ -6321,7 +6322,7 @@ void MainFrame::OnBrush7sided() Undo_End(); } -void MainFrame::OnBrush8sided() +void MainFrame::OnBrush8sided() { Undo_Start("8 sided"); Undo_AddBrushList(&selected_brushes); @@ -6330,7 +6331,7 @@ void MainFrame::OnBrush8sided() Undo_End(); } -void MainFrame::OnBrush9sided() +void MainFrame::OnBrush9sided() { Undo_Start("9 sided"); Undo_AddBrushList(&selected_brushes); @@ -6339,7 +6340,7 @@ void MainFrame::OnBrush9sided() Undo_End(); } -void MainFrame::OnBrushArbitrarysided() +void MainFrame::OnBrushArbitrarysided() { Undo_Start("arbitrary sided"); Undo_AddBrushList(&selected_brushes); @@ -6348,7 +6349,7 @@ void MainFrame::OnBrushArbitrarysided() Undo_End(); } -void MainFrame::OnBrushMakecone() +void MainFrame::OnBrushMakecone() { Undo_Start("make cone"); Undo_AddBrushList(&selected_brushes); @@ -6357,7 +6358,7 @@ void MainFrame::OnBrushMakecone() Undo_End(); } -void MainFrame::OnBrushPrimitivesSphere() +void MainFrame::OnBrushPrimitivesSphere() { Undo_Start("make sphere"); Undo_AddBrushList(&selected_brushes); @@ -6368,7 +6369,7 @@ void MainFrame::OnBrushPrimitivesSphere() Undo_End(); } -void MainFrame::OnCurvePatchtube() +void MainFrame::OnCurvePatchtube() { Undo_Start("make curve cylinder"); Undo_AddBrushList(&selected_brushes); @@ -6378,7 +6379,7 @@ void MainFrame::OnCurvePatchtube() Undo_End(); } -void MainFrame::OnCurvePatchdensetube() +void MainFrame::OnCurvePatchdensetube() { Undo_Start("dense cylinder"); Undo_AddBrushList(&selected_brushes); @@ -6391,7 +6392,7 @@ void MainFrame::OnCurvePatchdensetube() Undo_End(); } -void MainFrame::OnCurvePatchverydensetube() +void MainFrame::OnCurvePatchverydensetube() { Undo_Start("very dense cylinder"); Undo_AddBrushList(&selected_brushes); @@ -6406,7 +6407,7 @@ void MainFrame::OnCurvePatchverydensetube() Undo_End(); } -void MainFrame::OnCurvePatchsquare() +void MainFrame::OnCurvePatchsquare() { Undo_Start("square cylinder"); Undo_AddBrushList(&selected_brushes); @@ -6418,7 +6419,7 @@ void MainFrame::OnCurvePatchsquare() Undo_End(); } -void MainFrame::OnCurvePatchendcap() +void MainFrame::OnCurvePatchendcap() { Undo_Start("make end cap"); Undo_AddBrushList(&selected_brushes); @@ -6428,7 +6429,7 @@ void MainFrame::OnCurvePatchendcap() Undo_End(); } -void MainFrame::OnCurvePatchbevel() +void MainFrame::OnCurvePatchbevel() { Undo_Start("make bevel"); Undo_AddBrushList(&selected_brushes); @@ -6438,7 +6439,7 @@ void MainFrame::OnCurvePatchbevel() Undo_End(); } -void MainFrame::OnCurveMoreendcapsbevelsSquarebevel() +void MainFrame::OnCurveMoreendcapsbevelsSquarebevel() { Undo_Start("square bevel"); Undo_AddBrushList(&selected_brushes); @@ -6450,7 +6451,7 @@ void MainFrame::OnCurveMoreendcapsbevelsSquarebevel() Undo_End(); } -void MainFrame::OnCurveMoreendcapsbevelsSquareendcap() +void MainFrame::OnCurveMoreendcapsbevelsSquareendcap() { Undo_Start("square endcap"); Undo_AddBrushList(&selected_brushes); @@ -6462,7 +6463,7 @@ void MainFrame::OnCurveMoreendcapsbevelsSquareendcap() Undo_End(); } -void MainFrame::OnCurvePatchcone() +void MainFrame::OnCurvePatchcone() { Undo_Start("make curve cone"); Undo_AddBrushList(&selected_brushes); @@ -6472,7 +6473,7 @@ void MainFrame::OnCurvePatchcone() Undo_End(); } -void MainFrame::OnCurveSimplepatchmesh() +void MainFrame::OnCurveSimplepatchmesh() { Undo_Start("make simpe patch mesh"); Undo_AddBrushList(&selected_brushes); @@ -6481,7 +6482,7 @@ void MainFrame::OnCurveSimplepatchmesh() Undo_End(); } -void MainFrame::OnCurveInsertInsertcolumn() +void MainFrame::OnCurveInsertInsertcolumn() { Undo_Start("insert (2) columns"); Undo_AddBrushList(&selected_brushes); @@ -6491,7 +6492,7 @@ void MainFrame::OnCurveInsertInsertcolumn() Undo_End(); } -void MainFrame::OnCurveInsertAddcolumn() +void MainFrame::OnCurveInsertAddcolumn() { Undo_Start("add (2) columns"); Undo_AddBrushList(&selected_brushes); @@ -6501,7 +6502,7 @@ void MainFrame::OnCurveInsertAddcolumn() Undo_End(); } -void MainFrame::OnCurveInsertInsertrow() +void MainFrame::OnCurveInsertInsertrow() { Undo_Start("insert (2) rows"); Undo_AddBrushList(&selected_brushes); @@ -6511,7 +6512,7 @@ void MainFrame::OnCurveInsertInsertrow() Undo_End(); } -void MainFrame::OnCurveInsertAddrow() +void MainFrame::OnCurveInsertAddrow() { Undo_Start("add (2) rows"); Undo_AddBrushList(&selected_brushes); @@ -6521,7 +6522,7 @@ void MainFrame::OnCurveInsertAddrow() Undo_End(); } -void MainFrame::OnCurveDeleteFirstcolumn() +void MainFrame::OnCurveDeleteFirstcolumn() { Undo_Start("delete first (2) columns"); Undo_AddBrushList(&selected_brushes); @@ -6531,7 +6532,7 @@ void MainFrame::OnCurveDeleteFirstcolumn() Undo_End(); } -void MainFrame::OnCurveDeleteLastcolumn() +void MainFrame::OnCurveDeleteLastcolumn() { Undo_Start("delete last (2) columns"); Undo_AddBrushList(&selected_brushes); @@ -6541,7 +6542,7 @@ void MainFrame::OnCurveDeleteLastcolumn() Undo_End(); } -void MainFrame::OnCurveDeleteFirstrow() +void MainFrame::OnCurveDeleteFirstrow() { Undo_Start("delete first (2) rows"); Undo_AddBrushList(&selected_brushes); @@ -6551,7 +6552,7 @@ void MainFrame::OnCurveDeleteFirstrow() Undo_End(); } -void MainFrame::OnCurveDeleteLastrow() +void MainFrame::OnCurveDeleteLastrow() { Undo_Start("delete last (2) rows"); Undo_AddBrushList(&selected_brushes); @@ -6561,13 +6562,13 @@ void MainFrame::OnCurveDeleteLastrow() Undo_End(); } -void MainFrame::OnCurveNegative() +void MainFrame::OnCurveNegative() { Patch_ToggleInverted(); //Sys_UpdateWindows(W_ALL); } -void MainFrame::OnCurveRedisperseRows() +void MainFrame::OnCurveRedisperseRows() { Undo_Start("redisperse rows"); Undo_AddBrushList(&selected_brushes); @@ -6577,7 +6578,7 @@ void MainFrame::OnCurveRedisperseRows() Undo_End(); } -void MainFrame::OnCurveRedisperseIntermediateCols() +void MainFrame::OnCurveRedisperseIntermediateCols() { Undo_Start("redisperse im cols"); Undo_AddBrushList(&selected_brushes); @@ -6587,7 +6588,7 @@ void MainFrame::OnCurveRedisperseIntermediateCols() Undo_End(); } -void MainFrame::OnCurveRedisperseIntermediateRows() +void MainFrame::OnCurveRedisperseIntermediateRows() { Undo_Start("redisperse im rows"); Undo_AddBrushList(&selected_brushes); @@ -6597,37 +6598,37 @@ void MainFrame::OnCurveRedisperseIntermediateRows() Undo_End(); } -void MainFrame::OnCurveMatrixTranspose() +void MainFrame::OnCurveMatrixTranspose() { Patch_Transpose(); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnCurveCap() +void MainFrame::OnCurveCap() { Patch_CapCurrent(); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnCurveCyclecap() +void MainFrame::OnCurveCyclecap() { Patch_CycleCapSelected(); Sys_UpdateWindows (W_ALL); } -void MainFrame::OnCurveOverlaySet() +void MainFrame::OnCurveOverlaySet() { Patch_SetOverlays(); Sys_UpdateWindows(W_ALL); } -void MainFrame::OnCurveOverlayClear() +void MainFrame::OnCurveOverlayClear() { Patch_ClearOverlays(); Sys_UpdateWindows(W_ALL); } -void MainFrame::OnCurveThicken() +void MainFrame::OnCurveThicken() { Undo_Start("curve thicken"); Undo_AddBrushList(&selected_brushes); @@ -6640,14 +6641,14 @@ void MainFrame::OnCurveThicken() this can no longer be trigger manually from the menu happens only once at startup */ -void MainFrame::OnPluginsRefresh() +void MainFrame::OnPluginsRefresh() { CleanPlugInMenu(); m_PlugInMgr.Init(); } // open the Q3Rad manual -void MainFrame::OnHelp() +void MainFrame::OnHelp() { // at least on win32, g_strGameToolsPath + "Q3Rad_Manual/index.htm" Str help; @@ -6657,7 +6658,7 @@ void MainFrame::OnHelp() } // FIXME: we'll go towards a unified help thing soon -void MainFrame::OnHelpLinks() +void MainFrame::OnHelpLinks() { Str link; link = g_strAppPath; @@ -6665,25 +6666,25 @@ void MainFrame::OnHelpLinks() OpenURL(link.GetBuffer()); } -void MainFrame::OnHelpBugreport() +void MainFrame::OnHelpBugreport() { OpenURL("http://www.qeradiant.com/faq/fom-serve/cache/138.html"); } -void MainFrame::OnHelpCommandlist() +void MainFrame::OnHelpCommandlist() { DoCommandListDlg (); } -void MainFrame::OnHelpAbout() +void MainFrame::OnHelpAbout() { DoAbout(); } -void MainFrame::OnPopupSelection() +void MainFrame::OnPopupSelection() { GtkWidget *menu, *item; - char *labels[] = { "Select Complete Tall", "Select Touching", "Select Partial Tall", "Select Inside"}; + const gchar *labels[] = { _("Select Complete Tall"), _("Select Touching"), _("Select Partial Tall"), _("Select Inside")}; int ids[] = { ID_SELECTION_SELECTCOMPLETETALL, ID_SELECTION_SELECTTOUCHING, ID_SELECTION_SELECTPARTIALTALL, ID_SELECTION_SELECTINSIDE}; @@ -6701,13 +6702,13 @@ void MainFrame::OnPopupSelection() gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); } -void MainFrame::OnViewChange() +void MainFrame::OnViewChange() { OnViewNextview(); - //HandlePopup(this, IDR_POPUP_VIEW); + //HandlePopup(this, IDR_POPUP_VIEW); } -void MainFrame::OnTexturesPopup() +void MainFrame::OnTexturesPopup() { gpointer item = g_object_get_data (G_OBJECT (m_pWidget), "render_quality_menu"); gtk_menu_popup (GTK_MENU (item), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); @@ -6721,12 +6722,12 @@ void MainFrame::ToggleCamera() m_bCamPreview = true; } -void MainFrame::OnViewCameraupdate() +void MainFrame::OnViewCameraupdate() { Sys_UpdateWindows(W_CAMERA); } -void MainFrame::OnSelectMouserotate() +void MainFrame::OnSelectMouserotate() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_select_mouserotate")); g_bIgnoreCommands++; @@ -6753,7 +6754,7 @@ void MainFrame::OnSelectMouserotate() g_bIgnoreCommands--; } -void MainFrame::OnSelectMousescale() +void MainFrame::OnSelectMousescale() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_select_mousescale")); g_bIgnoreCommands++; @@ -6781,7 +6782,7 @@ void MainFrame::OnSelectMousescale() g_bIgnoreCommands--; } -void MainFrame::OnScalelockx() +void MainFrame::OnScalelockx() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelockx")); g_bIgnoreCommands++; @@ -6798,7 +6799,7 @@ void MainFrame::OnScalelockx() g_bIgnoreCommands--; } -void MainFrame::OnScalelocky() +void MainFrame::OnScalelocky() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelocky")); g_bIgnoreCommands++; @@ -6815,7 +6816,7 @@ void MainFrame::OnScalelocky() g_bIgnoreCommands--; } -void MainFrame::OnScalelockz() +void MainFrame::OnScalelockz() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelockz")); g_bIgnoreCommands++; @@ -6832,7 +6833,7 @@ void MainFrame::OnScalelockz() g_bIgnoreCommands--; } -void MainFrame::OnDontselectcurve() +void MainFrame::OnDontselectcurve() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_dontselectcurve")); g_bIgnoreCommands++; @@ -6851,7 +6852,7 @@ void MainFrame::OnPatchToggleBox() Sys_UpdateWindows(W_ALL); } -void MainFrame::OnPatchWireframe() +void MainFrame::OnPatchWireframe() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_patch_wireframe")); g_bIgnoreCommands++; @@ -6861,7 +6862,7 @@ void MainFrame::OnPatchWireframe() Sys_UpdateWindows(W_ALL); } -void MainFrame::OnPatchBend() +void MainFrame::OnPatchBend() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_patch_bend")); g_bIgnoreCommands++; @@ -6871,7 +6872,7 @@ void MainFrame::OnPatchBend() Sys_UpdateWindows(W_ALL); } -void MainFrame::OnPatchWeld() +void MainFrame::OnPatchWeld() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_patch_weld")); g_bIgnoreCommands++; @@ -6881,7 +6882,7 @@ void MainFrame::OnPatchWeld() Sys_UpdateWindows(W_ALL); } -void MainFrame::OnPatchDrilldown() +void MainFrame::OnPatchDrilldown() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_patch_drilldown")); g_bIgnoreCommands++; @@ -6891,13 +6892,13 @@ void MainFrame::OnPatchDrilldown() Sys_UpdateWindows(W_ALL); } -void MainFrame::OnShowEntities() +void MainFrame::OnShowEntities() { gpointer item = g_object_get_data (G_OBJECT (m_pWidget), "view_entitiesas_menu"); // use pointer to existing menu object gtk_menu_popup (GTK_MENU (item), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); } -void MainFrame::OnDropGroupName() +void MainFrame::OnDropGroupName() { /* char* name = DoNameDlg ("Name Selection"); @@ -6911,12 +6912,12 @@ void MainFrame::OnDropGroupName() */ } -void MainFrame::OnDropGroupNewgroup() +void MainFrame::OnDropGroupNewgroup() { } -void MainFrame::OnDropGroupRemove() +void MainFrame::OnDropGroupRemove() { /* Select_AddToGroup("World"); @@ -6930,7 +6931,7 @@ void MainFrame::OnFaceFit() SurfaceDlgFitAll(); } -void MainFrame::OnDontselectmodel() +void MainFrame::OnDontselectmodel() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_dontselectmodel")); g_bIgnoreCommands++; @@ -6939,7 +6940,7 @@ void MainFrame::OnDontselectmodel() g_bIgnoreCommands--; } -void MainFrame::OnViewTexture() +void MainFrame::OnViewTexture() { if (FloatingGroupDialog()) // QE4 style { @@ -6962,13 +6963,13 @@ void MainFrame::OnPatchInspector() TogglePatchInspector(); } -void MainFrame::OnCurveNegativeTextureX() +void MainFrame::OnCurveNegativeTextureX() { Patch_InvertTexture(false); //Sys_UpdateWindows(W_ALL); } -void MainFrame::OnCurveNegativeTextureY() +void MainFrame::OnCurveNegativeTextureY() { Patch_InvertTexture(true); //Sys_UpdateWindows(W_ALL); @@ -7000,7 +7001,7 @@ void MainFrame::OnCurveInsertrow() Undo_End(); } -void MainFrame::OnCurveDeletecolumn() +void MainFrame::OnCurveDeletecolumn() { if (&selected_brushes == selected_brushes.next) return; @@ -7012,7 +7013,7 @@ void MainFrame::OnCurveDeletecolumn() Undo_End(); } -void MainFrame::OnCurveDeleterow() +void MainFrame::OnCurveDeleterow() { if (&selected_brushes == selected_brushes.next) return; @@ -7024,7 +7025,7 @@ void MainFrame::OnCurveDeleterow() Undo_End(); } -void MainFrame::OnPatchTab() +void MainFrame::OnPatchTab() { if (g_bPatchBendMode) Patch_BendHandleTAB(); @@ -7033,7 +7034,7 @@ void MainFrame::OnPatchTab() else { // check to see if the selected brush is part of a func group - // if it is, deselect everything and reselect the next brush + // if it is, deselect everything and reselect the next brush // in the group brush_t *b2, *b = selected_brushes.next; entity_t * e; @@ -7061,7 +7062,7 @@ void MainFrame::OnPatchTab() } } -void MainFrame::OnCameraForward(bool keydown) +void MainFrame::OnCameraForward(bool keydown) { if (g_PrefsDlg.m_bCamDiscrete && (m_pCamWnd && !m_pCamWnd->m_bFreeMove) ) { @@ -7080,7 +7081,7 @@ void MainFrame::OnCameraForward(bool keydown) } } -void MainFrame::OnCameraBack(bool keydown) +void MainFrame::OnCameraBack(bool keydown) { if (g_PrefsDlg.m_bCamDiscrete && (m_pCamWnd && !m_pCamWnd->m_bFreeMove) ) { @@ -7099,7 +7100,7 @@ void MainFrame::OnCameraBack(bool keydown) } } -void MainFrame::OnCameraLeft(bool keydown) +void MainFrame::OnCameraLeft(bool keydown) { if (m_pCamWnd) { @@ -7127,7 +7128,7 @@ void MainFrame::OnCameraLeft(bool keydown) } } -void MainFrame::OnCameraRight(bool keydown) +void MainFrame::OnCameraRight(bool keydown) { if (m_pCamWnd) { @@ -7155,21 +7156,21 @@ void MainFrame::OnCameraRight(bool keydown) } } -void MainFrame::OnCameraUp() +void MainFrame::OnCameraUp() { m_pCamWnd->Camera()->origin[2] += SPEED_MOVE; int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY | W_Z) : (W_CAMERA); Sys_UpdateWindows (nUpdate); } -void MainFrame::OnCameraDown() +void MainFrame::OnCameraDown() { m_pCamWnd->Camera()->origin[2] -= SPEED_MOVE; int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY | W_Z) : (W_CAMERA); Sys_UpdateWindows (nUpdate); } -void MainFrame::OnCameraAngleup() +void MainFrame::OnCameraAngleup() { m_pCamWnd->Camera()->angles[0] += SPEED_TURN; if (m_pCamWnd->Camera()->angles[0] > 85) @@ -7177,7 +7178,7 @@ void MainFrame::OnCameraAngleup() Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); } -void MainFrame::OnCameraAngledown() +void MainFrame::OnCameraAngledown() { m_pCamWnd->Camera()->angles[0] -= SPEED_TURN; if (m_pCamWnd->Camera()->angles[0] < -85) @@ -7185,7 +7186,7 @@ void MainFrame::OnCameraAngledown() Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); } -void MainFrame::OnCameraStrafeleft(bool keydown) +void MainFrame::OnCameraStrafeleft(bool keydown) { // FIXME: as soon as gtk supports proper keyup/down support, remove this bit if (m_pCamWnd) @@ -7208,7 +7209,7 @@ void MainFrame::OnCameraStrafeleft(bool keydown) m_pCamWnd->Camera()->movementflags &= ~MOVE_STRAFELEFT; } -void MainFrame::OnCameraStraferight(bool keydown) +void MainFrame::OnCameraStraferight(bool keydown) { // FIXME: as soon as gtk supports proper keyup/down support, remove this bit if (m_pCamWnd) @@ -7231,69 +7232,69 @@ void MainFrame::OnCameraStraferight(bool keydown) m_pCamWnd->Camera()->movementflags &= ~MOVE_STRAFERIGHT; } -void MainFrame::OnGridToggle() +void MainFrame::OnGridToggle() { g_qeglobals.d_showgrid = !g_qeglobals.d_showgrid; Sys_UpdateWindows (W_XY|W_Z); } -void MainFrame::OnViewCrosshair() +void MainFrame::OnViewCrosshair() { - g_bCrossHairs ^= 1; + g_bCrossHairs ^= 1; Sys_UpdateWindows (W_XY); } -void MainFrame::OnSelectionTextureRotateclock() +void MainFrame::OnSelectionTextureRotateclock() { Select_RotateTexture(abs(g_PrefsDlg.m_nRotation)); } -void MainFrame::OnSelectionTextureRotatecounter() +void MainFrame::OnSelectionTextureRotatecounter() { Select_RotateTexture(-abs(g_PrefsDlg.m_nRotation)); } -void MainFrame::OnSelectionTextureScaleup() +void MainFrame::OnSelectionTextureScaleup() { Select_ScaleTexture(0, g_qeglobals.d_savedinfo.m_SIIncrement.scale[1]); } -void MainFrame::OnSelectionTextureScaledown() +void MainFrame::OnSelectionTextureScaledown() { Select_ScaleTexture(0, -g_qeglobals.d_savedinfo.m_SIIncrement.scale[1]); } -void MainFrame::OnSelectionTextureScaleLeft() +void MainFrame::OnSelectionTextureScaleLeft() { Select_ScaleTexture(-g_qeglobals.d_savedinfo.m_SIIncrement.scale[0],0); } -void MainFrame::OnSelectionTextureScaleRight() +void MainFrame::OnSelectionTextureScaleRight() { Select_ScaleTexture(g_qeglobals.d_savedinfo.m_SIIncrement.scale[0],0); } -void MainFrame::OnSelectionTextureShiftleft() +void MainFrame::OnSelectionTextureShiftleft() { Select_ShiftTexture((int)-g_qeglobals.d_savedinfo.m_SIIncrement.shift[0], 0); } -void MainFrame::OnSelectionTextureShiftright() +void MainFrame::OnSelectionTextureShiftright() { Select_ShiftTexture((int)g_qeglobals.d_savedinfo.m_SIIncrement.shift[0], 0); } -void MainFrame::OnSelectionTextureShiftup() +void MainFrame::OnSelectionTextureShiftup() { Select_ShiftTexture(0, (int)g_qeglobals.d_savedinfo.m_SIIncrement.shift[1]); } -void MainFrame::OnSelectionTextureShiftdown() +void MainFrame::OnSelectionTextureShiftdown() { Select_ShiftTexture(0, (int)-g_qeglobals.d_savedinfo.m_SIIncrement.shift[1]); } -void MainFrame::OnGridPrev() +void MainFrame::OnGridPrev() { GtkWidget *item; if (g_qeglobals.d_gridsize == 1) @@ -7340,7 +7341,7 @@ void MainFrame::OnGridPrev() Sys_UpdateWindows(W_XY | W_Z); } -void MainFrame::OnGridNext() +void MainFrame::OnGridNext() { GtkWidget *item; if (g_qeglobals.d_gridsize == 0.25) @@ -7369,6 +7370,7 @@ void MainFrame::OnGridNext() case 64: item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_grid_64")); break; case 128: item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_grid_128")); break; case 256: item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_grid_256")); break; + default: item = NULL; } } else @@ -7387,7 +7389,7 @@ void MainFrame::OnGridNext() Sys_UpdateWindows(W_XY | W_Z); } -void MainFrame::OnSelectionMovedown() +void MainFrame::OnSelectionMovedown() { if (&selected_brushes == selected_brushes.next) return; @@ -7404,7 +7406,7 @@ void MainFrame::OnSelectionMovedown() Undo_End(); } -void MainFrame::OnSelectionMoveup() +void MainFrame::OnSelectionMoveup() { if (&selected_brushes == selected_brushes.next) return; @@ -7421,13 +7423,13 @@ void MainFrame::OnSelectionMoveup() Undo_End(); } -void MainFrame::OnSelectionPrint() +void MainFrame::OnSelectionPrint() { for (brush_t* b=selected_brushes.next ; b != &selected_brushes ; b=b->next) Brush_Print(b); } -void MainFrame::OnSelectionTogglesizepaint() +void MainFrame::OnSelectionTogglesizepaint() { g_PrefsDlg.m_bSizePaint = !g_PrefsDlg.m_bSizePaint; Sys_UpdateWindows(W_XY); @@ -7474,7 +7476,7 @@ void PerformFiltering () { brush_t *brush; - // mattn - this should be removed - otherwise the filters from the + // mattn - this should be removed - otherwise the filters from the // plugins are wiped away with each update #if 0 // spog - deletes old filters list and creates new one when @@ -7490,7 +7492,7 @@ void PerformFiltering () brush->bFiltered = FilterBrush( brush ); } -void MainFrame::OnFilterAreaportals() +void MainFrame::OnFilterAreaportals() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_areaportals")); g_bIgnoreCommands++; @@ -7503,7 +7505,7 @@ void MainFrame::OnFilterAreaportals() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterCaulk() +void MainFrame::OnFilterCaulk() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_caulk")); g_bIgnoreCommands++; @@ -7516,7 +7518,7 @@ void MainFrame::OnFilterCaulk() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterClips() +void MainFrame::OnFilterClips() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_clips")); g_bIgnoreCommands++; @@ -7542,7 +7544,7 @@ void MainFrame::OnFilterBotClips() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterStructural() +void MainFrame::OnFilterStructural() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_structural")); g_bIgnoreCommands++; @@ -7555,7 +7557,7 @@ void MainFrame::OnFilterStructural() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterDetails() +void MainFrame::OnFilterDetails() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_details")); g_bIgnoreCommands++; @@ -7568,7 +7570,7 @@ void MainFrame::OnFilterDetails() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterEntities() +void MainFrame::OnFilterEntities() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_entities")); g_bIgnoreCommands++; @@ -7581,7 +7583,7 @@ void MainFrame::OnFilterEntities() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterHintsskips() +void MainFrame::OnFilterHintsskips() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_hintsskips")); g_bIgnoreCommands++; @@ -7594,7 +7596,7 @@ void MainFrame::OnFilterHintsskips() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterLights() +void MainFrame::OnFilterLights() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_lights")); g_bIgnoreCommands++; @@ -7607,7 +7609,7 @@ void MainFrame::OnFilterLights() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterLiquids() +void MainFrame::OnFilterLiquids() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_liquids")); g_bIgnoreCommands++; @@ -7620,7 +7622,7 @@ void MainFrame::OnFilterLiquids() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterModels() +void MainFrame::OnFilterModels() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_models")); g_bIgnoreCommands++; @@ -7633,7 +7635,7 @@ void MainFrame::OnFilterModels() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterPatches() +void MainFrame::OnFilterPatches() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_patches")); g_bIgnoreCommands++; @@ -7646,7 +7648,7 @@ void MainFrame::OnFilterPatches() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterPaths() +void MainFrame::OnFilterPaths() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_paths")); g_bIgnoreCommands++; @@ -7659,7 +7661,7 @@ void MainFrame::OnFilterPaths() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterClusterportals() +void MainFrame::OnFilterClusterportals() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_clusterportals")); g_bIgnoreCommands++; @@ -7685,7 +7687,7 @@ void MainFrame::OnFilterLightgrid() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterTranslucent() +void MainFrame::OnFilterTranslucent() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_translucent")); g_bIgnoreCommands++; @@ -7698,7 +7700,7 @@ void MainFrame::OnFilterTranslucent() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterTriggers() +void MainFrame::OnFilterTriggers() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_triggers")); g_bIgnoreCommands++; @@ -7711,7 +7713,7 @@ void MainFrame::OnFilterTriggers() Sys_UpdateWindows (W_XY|W_CAMERA); } -void MainFrame::OnFilterWorld() +void MainFrame::OnFilterWorld() { GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "menu_filter_world")); g_bIgnoreCommands++; @@ -7734,7 +7736,7 @@ void MainFrame::OnFilterWorld() // ============================================================================= // leo: Unused functions, not called anywhere from the code (need to check) -void MainFrame::OnViewConsole() +void MainFrame::OnViewConsole() { if (FloatingGroupDialog()) // QE4 style { @@ -7782,7 +7784,7 @@ void MainFrame::OnPatchEnter() } -void MainFrame::OnDropGroupAddtoWorld() +void MainFrame::OnDropGroupAddtoWorld() { /* Select_AddToGroup("World"); diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 23a42642..2ddde05b 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "gtkr_vector.h" #ifdef __APPLE__ -#define __toascii(c) ((c) & 0x7f) +#define __toascii(c) ((c) & 0x7f) #endif const int RAD_SHIFT = 0x01; @@ -44,16 +44,16 @@ const int RAD_PRESS = 0x08; struct SCommandInfo { - char* m_strCommand; + const char* m_strCommand; unsigned int m_nKey; unsigned int m_nModifiers; unsigned int m_nCommand; - char* m_strMenu; + const char* m_strMenu; }; struct SKeyInfo { - char* m_strName; + const char* m_strName; unsigned int m_nVKKey; }; @@ -431,13 +431,13 @@ public: bool RequestAPI(APIDescriptor_t *pAPI); const char* GetInfo(); const char* GetName(); - + void ImportMap(IDataStream *in, CPtrArray *ents, const char *type); void ExportMap(CPtrArray *ents, IDataStream *out, const char *type); CSynapseClientRadiant() { } virtual ~CSynapseClientRadiant() { } -}; +}; class MainFrame { @@ -475,7 +475,7 @@ protected: /*! build the menu once the filename is found */ - void process_xlink (Str &FileName, char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel); + void process_xlink (Str &FileName, const char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel); void Create (); void create_main_menu (GtkWidget *window, GtkWidget *vbox); @@ -542,7 +542,7 @@ public: void ReleaseContexts (); void CreateContexts (); - void SetActiveXY(XYWnd* p) + void SetActiveXY(XYWnd* p) { if (m_pActiveXY) m_pActiveXY->SetActive(false); diff --git a/radiant/map.cpp b/radiant/map.cpp index 59290f2a..3c4a1ef7 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA extern MainFrame* g_pParentWnd; int modified; // for quit confirmation (0 = clean, 1 = unsaved, - // 2 = autosaved, but not regular saved) + // 2 = autosaved, but not regular saved) char currentmap[1024]; @@ -136,7 +136,7 @@ void Map_BuildBrushData(void) Sys_EndWait(); } -entity_t *Map_FindClass (char *cname) +entity_t *Map_FindClass (const char *cname) { entity_t *ent; @@ -335,7 +335,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false) num_brushes = 0; e = (entity_t*)ents->GetAt(i); brushes = (CPtrArray*)e->pData; - + num_brushes = brushes->GetSize(); // link brushes into entity for(j=0; jeclass->name,"func_group") == 0)) { - + // two aux pointers to the shaders used in the terrain entity // we don't keep refcount on them since they are only temporary // this avoids doing expensive lookups by name for all faces IShader *pTerrainShader, *pCaulk; - + pTerrainShader = NULL; pCaulk = QERApp_Shader_ForName(SHADER_CAULK); - + for(b = e->brushes.onext; b!=&e->brushes; b=b->onext) { if (pTerrainShader == NULL) for(f = b->brush_faces; f != NULL; f = f->next) if (strcmp(f->texdef.GetName(), SHADER_CAULK)!=0) pTerrainShader = f->pShader; - + if (pTerrainShader) { for(f = b->brush_faces; f != NULL; f = f->next) @@ -473,7 +473,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false) entity_t *e_target; const char *target = ValueForKey(e, "target"); qboolean bCollision=FALSE; - + // check the current map entities for an actual collision for (e_target = entities.next; e_target != &entities; e_target = e_target->next) { @@ -488,7 +488,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false) } } } - + // find the matching targeted entity(s) if(bCollision) { @@ -513,17 +513,17 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false) g_ptr_array_free(t_ents, FALSE); } } - + // add the entity to the end of the entity list Entity_AddToList(e, &entities); g_qeglobals.d_num_entities++; - + // keep a list of ents added to avoid testing collisions against them g_ptr_array_add(new_ents, (gpointer)e); } } g_ptr_array_free(new_ents, FALSE); - + ents->RemoveAll(); g_qeglobals.bNeedConvert = false; @@ -551,7 +551,7 @@ void Map_LoadFile (const char *filename) Sys_BeginWait (); Select_Deselect(); /*! - \todo FIXME TTimo why is this commented out? + \todo FIXME TTimo why is this commented out? stability issues maybe? or duplicate feature? forcing to show the console during map load was a good thing IMO */ @@ -609,15 +609,15 @@ void Map_LoadFile (const char *filename) Sys_Printf ("--- LoadMapFile ---\n"); Sys_Printf ("%s\n", filename ); - + Sys_Printf ("%5i brushes\n", g_qeglobals.d_parsed_brushes ); Sys_Printf ("%5i entities\n", g_qeglobals.d_num_entities); Sys_Printf ("%5.2f second(s) load time\n", elapsed_time ); - + Sys_EndWait(); - + Map_RestoreBetween (); - + // // move the view to a start position // @@ -707,11 +707,11 @@ void Map_ExportEntities(CPtrArray* ents, bool bRegionOnly = false, bool bSelecte /*! \todo the entity_t needs to be reworked and asbtracted some more - + keeping the entity_t as the struct providing access to a list of map objects, a list of epairs and various other info? but separating some more the data that belongs to the entity_t and the 'sons' data on a side note, I don't think that doing that with linked list would be a good thing - + for now, we use the blind void* in entity_t casted to a CPtrArray of brush_t* to hand out a list of the brushes for map write the next step is very likely to be a change of the brush_t* to a more abstract object? */ @@ -747,7 +747,7 @@ void Map_Export(IDataStream *out, const char *type, bool bRegionOnly, bool bSele entity_t *e; CPtrArray ents; - + if (bRegionOnly && region_active) AddRegionBrushes(); @@ -855,7 +855,7 @@ void Map_New (void) Sys_SetTitle (currentmap); world_entity = (entity_s*)qmalloc(sizeof(*world_entity)); - world_entity->brushes.onext = + world_entity->brushes.onext = world_entity->brushes.oprev = &world_entity->brushes; SetKeyValue (world_entity, "classname", "worldspawn"); world_entity->eclass = Eclass_ForName ("worldspawn", true); @@ -935,13 +935,13 @@ void AddRegionBrushes (void) region_sides[i+3] = Brush_Create (mins, maxs, &td); } - + // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=503 - // this is a safe check, but it should not really happen anymore + // this is a safe check, but it should not really happen anymore vec3_t vOrig; VectorSet(vOrig, (int)g_pParentWnd->GetCamWnd()->Camera()->origin[0], - (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], + (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], (int)g_pParentWnd->GetCamWnd()->Camera()->origin[2]); for (i=0 ; i<3 ; i++) @@ -951,7 +951,7 @@ void AddRegionBrushes (void) Sys_FPrintf(SYS_ERR, "Camera is NOT in the region, it's likely that the region won't compile correctly\n"); } } - + // write the info_playerstart region_startpoint = Entity_Alloc(); SetKeyValue(region_startpoint, "classname", "info_player_start"); @@ -1010,7 +1010,7 @@ void Map_RegionOff (void) region_maxs[i] = g_MaxWorldCoord-64; region_mins[i] = g_MinWorldCoord+64; } - + for (b=filtered_brushes.next ; b != &filtered_brushes ; b=next) { next = b->next; @@ -1193,7 +1193,7 @@ GList *find_string(GList *glist, const char *buf) void Map_ImportBuffer(char *buf) { Select_Deselect(); - + Undo_Start("import buffer"); MemStream stream; @@ -1201,10 +1201,10 @@ void Map_ImportBuffer(char *buf) stream.Write(buf, strlen(buf)); Map_Import(&stream, "xmap"); stream.Close(); - + Sys_UpdateWindows (W_ALL); Sys_MarkMapModified(); - + Undo_End(); } @@ -1313,9 +1313,9 @@ void Region_SpawnPoint(FILE *f) // write the info_player_start, we use the camera position fprintf (f, "{\n"); fprintf (f, "\"classname\" \"info_player_start\"\n"); - fprintf (f, "\"origin\" \"%i %i %i\"\n", + fprintf (f, "\"origin\" \"%i %i %i\"\n", (int)g_pParentWnd->GetCamWnd()->Camera()->origin[0], - (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], + (int)g_pParentWnd->GetCamWnd()->Camera()->origin[1], (int)g_pParentWnd->GetCamWnd()->Camera()->origin[2]); fprintf (f, "\"angle\" \"%i\"\n", (int)g_pParentWnd->GetCamWnd()->Camera()->angles[YAW]); fprintf (f, "}\n"); diff --git a/radiant/pmesh.cpp b/radiant/pmesh.cpp index ca8b5297..dea9ef0a 100644 --- a/radiant/pmesh.cpp +++ b/radiant/pmesh.cpp @@ -19,10 +19,10 @@ along with GtkRadiant; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// +// // Preliminary patch stuff // -// +// #include "stdafx.h" #include "gtkmisc.h" @@ -92,9 +92,9 @@ patchMesh_t* MakeNewPatch() // used for a save spot patchMesh_t patchSave; -// Tracks the selected patch for point manipulation/update. FIXME: Need to revert back to a generalized +// Tracks the selected patch for point manipulation/update. FIXME: Need to revert back to a generalized // brush approach -//--int g_nSelectedPatch = -1; +//--int g_nSelectedPatch = -1; // HACK: for tracking which view generated the click // as we dont want to deselect a point on a same point @@ -238,38 +238,38 @@ int Patch_MemorySize(patchMesh_t *p) InterpolateInteriorPoints =============== */ -void InterpolateInteriorPoints( patchMesh_t *p ) +void InterpolateInteriorPoints( patchMesh_t *p ) { int i, j, k; int next, prev; - for ( i = 0 ; i < p->width ; i += 2 ) + for ( i = 0 ; i < p->width ; i += 2 ) { next = ( i == p->width - 1 ) ? 1 : ( i + 1 ) % p->width; prev = ( i == 0 ) ? p->width - 2 : i - 1; #if 0 - if ( i == 0 ) + if ( i == 0 ) { next = ( i + 1 ) % p->width; prev = p->width - 2; // joined wrap case - } - else if ( i == p->width - 1 ) + } + else if ( i == p->width - 1 ) { next = 1; prev = i - 1; - } - else + } + else { next = ( i + 1 ) % p->width; prev = i - 1; } #endif - for ( j = 0 ; j < p->height ; j++ ) + for ( j = 0 ; j < p->height ; j++ ) { - for ( k = 0 ; k < 3 ; k++ ) + for ( k = 0 ; k < 3 ; k++ ) { p->ctrl[i][j].xyz[k] = ( p->ctrl[next][j].xyz[k] + p->ctrl[prev][j].xyz[k] ) * 0.5; } @@ -287,7 +287,7 @@ int neighbors[8][2] = { {0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1}, {-1,0}, {-1,1} }; -void Patch_MeshNormals(patchMesh_t *in ) +void Patch_MeshNormals(patchMesh_t *in ) { int i, j, k, dist; vec3_t normal; @@ -303,90 +303,90 @@ void Patch_MeshNormals(patchMesh_t *in ) float len; wrapWidth = false; - for ( i = 0 ; i < in->height ; i++ ) + for ( i = 0 ; i < in->height ; i++ ) { - VectorSubtract( in->ctrl[0][i].xyz, + VectorSubtract( in->ctrl[0][i].xyz, in->ctrl[in->width-1][i].xyz, delta ); len = VectorLength( delta ); - if ( len > 1.0 ) + if ( len > 1.0 ) { break; } } - if ( i == in->height ) + if ( i == in->height ) { wrapWidth = true; } wrapHeight = false; - for ( i = 0 ; i < in->width ; i++ ) + for ( i = 0 ; i < in->width ; i++ ) { - VectorSubtract( in->ctrl[i][0].xyz, + VectorSubtract( in->ctrl[i][0].xyz, in->ctrl[i][in->height-1].xyz, delta ); len = VectorLength( delta ); - if ( len > 1.0 ) + if ( len > 1.0 ) { break; } } - if ( i == in->width) + if ( i == in->width) { wrapHeight = true; } - for ( i = 0 ; i < in->width ; i++ ) + for ( i = 0 ; i < in->width ; i++ ) { - for ( j = 0 ; j < in->height ; j++ ) + for ( j = 0 ; j < in->height ; j++ ) { count = 0; //--dv = reinterpret_cast(in.ctrl[j*in.width+i]); dv = &in->ctrl[i][j]; VectorCopy( dv->xyz, base ); - for ( k = 0 ; k < 8 ; k++ ) + for ( k = 0 ; k < 8 ; k++ ) { VectorClear( around[k] ); good[k] = false; - for ( dist = 1 ; dist <= 3 ; dist++ ) + for ( dist = 1 ; dist <= 3 ; dist++ ) { x = i + neighbors[k][0] * dist; y = j + neighbors[k][1] * dist; - if ( wrapWidth ) + if ( wrapWidth ) { - if ( x < 0 ) + if ( x < 0 ) { x = in->width - 1 + x; - } - else if ( x >= in->width ) + } + else if ( x >= in->width ) { x = 1 + x - in->width; } } - if ( wrapHeight ) + if ( wrapHeight ) { - if ( y < 0 ) + if ( y < 0 ) { y = in->height - 1 + y; - } - else if ( y >= in->height ) + } + else if ( y >= in->height ) { y = 1 + y - in->height; } } - if ( x < 0 || x >= in->width || y < 0 || y >= in->height ) + if ( x < 0 || x >= in->width || y < 0 || y >= in->height ) { break; // edge of patch } //--VectorSubtract( in.ctrl[y*in.width+x]->xyz, base, temp ); VectorSubtract( in->ctrl[x][y].xyz, base, temp ); - if ( __VectorNormalize( temp, temp ) == 0 ) + if ( __VectorNormalize( temp, temp ) == 0 ) { continue; // degenerate edge, get more dist - } - else + } + else { good[k] = true; VectorCopy( temp, around[k] ); @@ -396,21 +396,21 @@ void Patch_MeshNormals(patchMesh_t *in ) } VectorClear( sum ); - for ( k = 0 ; k < 8 ; k++ ) + for ( k = 0 ; k < 8 ; k++ ) { - if ( !good[k] || !good[(k+1)&7] ) + if ( !good[k] || !good[(k+1)&7] ) { continue; // didn't get two points } CrossProduct( around[(k+1)&7], around[k], normal ); - if ( __VectorNormalize( normal, normal ) == 0 ) + if ( __VectorNormalize( normal, normal ) == 0 ) { continue; } VectorAdd( normal, sum, sum ); count++; } - if ( count == 0 ) + if ( count == 0 ) { //printf("bad normal\n"); count = 1; @@ -459,7 +459,7 @@ Brush_RebuildBrush void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) { // - // Total hack job + // Total hack job // Rebuilds a brush int i, j; face_t *f, *next; @@ -476,7 +476,7 @@ void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) } } - + for (f=b->brush_faces ; f ; f=next) { next = f->next; @@ -495,16 +495,16 @@ void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) pts[0][0][0] = vMins[0]; pts[0][0][1] = vMins[1]; - + pts[1][0][0] = vMins[0]; pts[1][0][1] = vMaxs[1]; - + pts[2][0][0] = vMaxs[0]; pts[2][0][1] = vMaxs[1]; - + pts[3][0][0] = vMaxs[0]; pts[3][0][1] = vMins[1]; - + for (i=0 ; i<4 ; i++) { pts[i][0][2] = vMins[2]; @@ -519,7 +519,7 @@ void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) f->texdef = texdef; f->texdef.flags &= ~SURF_KEEP; f->texdef.contents &= ~CONTENTS_KEEP; -// f->texdef.flags |= SURF_PATCH; +// f->texdef.flags |= SURF_PATCH; f->next = b->brush_faces; b->brush_faces = f; j = (i+1)%4; @@ -528,12 +528,12 @@ void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) VectorCopy (pts[i][1], f->planepts[1]); VectorCopy (pts[i][0], f->planepts[2]); } - + f = Face_Alloc(); f->texdef = texdef; f->texdef.flags &= ~SURF_KEEP; f->texdef.contents &= ~CONTENTS_KEEP; -// f->texdef.flags |= SURF_PATCH; +// f->texdef.flags |= SURF_PATCH; f->next = b->brush_faces; b->brush_faces = f; @@ -545,7 +545,7 @@ void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs) f->texdef = texdef; f->texdef.flags &= ~SURF_KEEP; f->texdef.contents &= ~CONTENTS_KEEP; -// f->texdef.flags |= SURF_PATCH; +// f->texdef.flags |= SURF_PATCH; f->next = b->brush_faces; b->brush_faces = f; @@ -700,10 +700,10 @@ void WINAPI Patch_Naturalize(patchMesh_t *p) float fPHeight = Patch_Height(p); float xAccum = 0.0f; - for ( int i = 0; i < p->width ; i++ ) + for ( int i = 0; i < p->width ; i++ ) { float yAccum = 0.0f; - for ( int j = p->height-1; j >= 0 ; j-- ) + for ( int j = p->height-1; j >= 0 ; j-- ) { p->ctrl[i][j].st[0] = (fPWidth / nWidth) * xAccum / fPWidth; p->ctrl[i][j].st[1] = (fPHeight / nHeight) * yAccum / fPHeight; @@ -823,12 +823,12 @@ void Patch_CapTexture(patchMesh_t *p, bool bFaceCycle = false) VectorClear ( Plane3.normal ); bThing = false; } - + // find normal for plane from next 3 corner points if (!Plane_FromPoints(p->ctrl[p->width-1][p->height-1].xyz,p->ctrl[p->width-1][0].xyz,p->ctrl[0][0].xyz,&Plane2)) { if (bThing) - { + { VectorCopy ( Plane1.normal, Plane3.normal ); Plane3.dist = Plane1.dist; } @@ -903,7 +903,7 @@ void patchInvert(patchMesh_t *p) { drawVert_t vertTemp; p->bDirty = true; - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { for (int j = 0; j < p->height / 2; j++) { @@ -946,7 +946,7 @@ brush_t* Cap(patchMesh_t *pParent, bool bByColumn, bool bFirst) vMax[0] = vMax[1] = vMax[2] = -9999; // we seam the column edge, FIXME: this might need to be able to seem either edge - // + // int nSize = (bByColumn) ? pParent->width : pParent->height; int nIndex = (bFirst) ? 0 : (bByColumn) ? pParent->height-1 : pParent->width-1; @@ -976,7 +976,7 @@ brush_t* Cap(patchMesh_t *pParent, bool bByColumn, bool bFirst) VectorCopy(pParent->ctrl[nIndex][i].xyz, p->ctrl[Index5By[i][0]][Index5By[i][1]].xyz); } } - + for (j = 0; j < 3; j++) { float f = (bSmall) ? p->ctrl[Index3By[i][0]][Index3By[i][1]].xyz[j] : p->ctrl[Index5By[i][0]][Index5By[i][1]].xyz[j]; @@ -1062,7 +1062,7 @@ brush_t* CapSpecial(patchMesh_t *pParent, int nType, bool bFirst) { vTemp[j] = vMin[j] + fabs((vMax[j] - vMin[j]) * 0.5); } - + if (nType == IBEVEL) { VectorCopy(pParent->ctrl[0][nIndex].xyz, p->ctrl[0][0].xyz); @@ -1082,11 +1082,11 @@ brush_t* CapSpecial(patchMesh_t *pParent, int nType, bool bFirst) VectorCopy(pParent->ctrl[0][nIndex].xyz, p3); VectorCopy(pParent->ctrl[1][nIndex].xyz, p1); VectorCopy(pParent->ctrl[2][nIndex].xyz, p2); - + //Sys_Printf("CapSpecial() p1: %f %f %f\n",p1[0],p1[1],p1[2]); //Sys_Printf("CapSpecial() p2: %f %f %f\n",p2[0],p2[1],p2[2]); //Sys_Printf("CapSpecial() p3: %f %f %f\n",p3[0],p3[1],p3[2]); - + VectorSubtract(p2, p1, p4); VectorAdd(p3, p4, p4); // spog - use opposite-point-on-parallelogram to find p4 @@ -1130,7 +1130,7 @@ brush_t* CapSpecial(patchMesh_t *pParent, int nType, bool bFirst) VectorCopy(pParent->ctrl[2][nIndex].xyz, p->ctrl[1][2].xyz); VectorCopy(pParent->ctrl[2][nIndex].xyz, p->ctrl[2][2].xyz); VectorCopy(pParent->ctrl[2][nIndex].xyz, p->ctrl[1][1].xyz); - + VectorCopy(pParent->ctrl[1][nIndex].xyz, p->ctrl[0][1].xyz); VectorCopy(pParent->ctrl[3][nIndex].xyz, p->ctrl[2][1].xyz); } @@ -1141,7 +1141,7 @@ brush_t* CapSpecial(patchMesh_t *pParent, int nType, bool bFirst) VectorCopy(pParent->ctrl[2][nIndex].xyz, p->ctrl[2][0].xyz); VectorCopy(pParent->ctrl[1][nIndex].xyz, p->ctrl[3][0].xyz); VectorCopy(pParent->ctrl[0][nIndex].xyz, p->ctrl[4][0].xyz); - + VectorCopy(pParent->ctrl[3][nIndex].xyz, p->ctrl[0][1].xyz); VectorCopy(pParent->ctrl[3][nIndex].xyz, p->ctrl[1][1].xyz); VectorCopy(pParent->ctrl[2][nIndex].xyz, p->ctrl[2][1].xyz); @@ -1185,14 +1185,14 @@ void Patch_CapCurrent() b[0] = b[1] = b[2] = b[3] = NULL; int nIndex = 0; bool b_GroupResult = TRUE; - + if (!QE_SingleBrush(true)) { Sys_Printf("Patch_CapCurrent: you must have a single patch selected\n"); return; } - - + + for (brush_t *pb = selected_brushes.next ; pb != NULL && pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) @@ -1200,7 +1200,7 @@ void Patch_CapCurrent() pParent = pb->pPatch; // decide which if any ends we are going to cap // if any of these compares hit, it is a closed patch and as such - // the generic capping will work.. if we do not find a closed edge + // the generic capping will work.. if we do not find a closed edge // then we need to ask which kind of cap to add if (VectorCompare(pParent->ctrl[0][0].xyz, pParent->ctrl[pParent->width-1][0].xyz)) { @@ -1236,21 +1236,21 @@ void Patch_CapCurrent() } } } - + if (pParent) { // if we did not cap anything with the above tests if (nIndex == 0) { int type; - + if (DoCapDlg (&type, &b_GroupResult) == IDOK) { b[nIndex++] = CapSpecial(pParent, type, false); b[nIndex++] = CapSpecial(pParent, type, true); } } - + if (nIndex > 0) { while (nIndex > 0) @@ -1338,7 +1338,7 @@ void Patch_BrushToMesh(bool bCone, bool bBevel, bool bEndcap, bool bSquare, int p->ctrl[2][i].xyz[0] = b->mins[0] + ((b->maxs[0] - b->mins[0]) * 0.5); p->ctrl[2][i].xyz[1] = b->maxs[1]; p->ctrl[2][i].xyz[2] = nStart; - + p->ctrl[3][i].xyz[0] = b->maxs[0]; p->ctrl[3][i].xyz[1] = b->maxs[1]; p->ctrl[3][i].xyz[2] = nStart; @@ -1364,7 +1364,7 @@ void Patch_BrushToMesh(bool bCone, bool bBevel, bool bEndcap, bool bSquare, int p->ctrl[7][0].xyz[0] = b->mins[0]; p->ctrl[7][0].xyz[1] = b->maxs[1]; - for ( i = 1 ; i < p->width - 1 ; i += 2 ) + for ( i = 1 ; i < p->width - 1 ; i += 2 ) { p->ctrl[i][0].xyz[2] = b->mins[2]; @@ -1425,8 +1425,8 @@ void Patch_BrushToMesh(bool bCone, bool bBevel, bool bEndcap, bool bSquare, int if (bCone) { p->type = PATCH_CONE; - float xc = (b->maxs[0] + b->mins[0]) * 0.5; - float yc = (b->maxs[1] + b->mins[1]) * 0.5; + float xc = (b->maxs[0] + b->mins[0]) * 0.5; + float yc = (b->maxs[1] + b->mins[1]) * 0.5; for ( i = 0 ; i < p->width ; i ++) { @@ -1434,7 +1434,7 @@ void Patch_BrushToMesh(bool bCone, bool bBevel, bool bEndcap, bool bSquare, int p->ctrl[i][2].xyz[1] = yc; } } - + b = AddBrushForPatch(p); Select_Delete(); @@ -1594,9 +1594,9 @@ void AddPoint(patchMesh_t* p, vec3_t v, bool bWeldOrDrill = true) g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = v; if ((g_bPatchWeld || g_bPatchDrillDown) && bWeldOrDrill) { - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { - for ( int j = 0 ; j < p->height ; j++ ) + for ( int j = 0 ; j < p->height ; j++ ) { if (g_bPatchWeld) { @@ -1609,8 +1609,8 @@ void AddPoint(patchMesh_t* p, vec3_t v, bool bWeldOrDrill = true) } if (g_bPatchDrillDown && g_nPatchClickedView != W_CAMERA) { - if ( (fabs(v[nDim1] - p->ctrl[i][j].xyz[nDim1]) <= EQUAL_EPSILON) - &&(fabs(v[nDim2] - p->ctrl[i][j].xyz[nDim2]) <= EQUAL_EPSILON)) + if ( (fabs(v[nDim1] - p->ctrl[i][j].xyz[nDim1]) <= EQUAL_EPSILON) + &&(fabs(v[nDim2] - p->ctrl[i][j].xyz[nDim2]) <= EQUAL_EPSILON)) { if (PointInMoveList(p->ctrl[i][j].xyz) == -1) { @@ -1675,9 +1675,9 @@ void AddPatchMovePoint(vec3_t v, bool bMulti, bool bFull) if (pb->patchBrush) { patchMesh_t* p = pb->pPatch; - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { - for ( int j = 0 ; j < p->height ; j++ ) + for ( int j = 0 ; j < p->height ; j++ ) { if (VectorCompare(v, p->ctrl[i][j].xyz)) { @@ -1744,19 +1744,19 @@ void Patch_UpdateSelected(vec3_t vMove) { } } - + //--patchMesh_t* p = &patchMeshes[g_nSelectedPatch]; for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) { patchMesh_t* p = pb->pPatch; - + #if 0 //moving to SelectCurvePointByRay g_qeglobals.d_numpoints = 0; - for (i = 0 ; i < p->width ; i++ ) + for (i = 0 ; i < p->width ; i++ ) { - for ( j = 0 ; j < p->height ; j++ ) + for ( j = 0 ; j < p->height ; j++ ) { VectorCopy (p->ctrl[i][j].xyz, g_qeglobals.d_points[g_qeglobals.d_numpoints]); if (g_qeglobals.d_numpoints < MAX_POINTS-1) @@ -1765,7 +1765,7 @@ void Patch_UpdateSelected(vec3_t vMove) } } } -#endif +#endif vec3_t vMin, vMax; Patch_CalcBounds(p, vMin, vMax); Brush_RebuildBrush(p->pSymbiot, vMin, vMax); @@ -1788,9 +1788,9 @@ void SampleSinglePatch (float ctrl[3][3][5], float u, float v, float out[5]) { int axis; // find the control points for the v coordinate - for (vPoint = 0 ; vPoint < 3 ; vPoint++) + for (vPoint = 0 ; vPoint < 3 ; vPoint++) { - for (axis = 0 ; axis < 5 ; axis++) + for (axis = 0 ; axis < 5 ; axis++) { float a, b, c; float qA, qB, qC; @@ -1807,7 +1807,7 @@ void SampleSinglePatch (float ctrl[3][3][5], float u, float v, float out[5]) { } // interpolate the v value - for (axis = 0 ; axis < 5 ; axis++) + for (axis = 0 ; axis < 5 ; axis++) { float a, b, c; float qA, qB, qC; @@ -1834,7 +1834,7 @@ float ShadeForNormal(vec3_t normal) L[1] = 1.0f; L[2] = 1.0f; - + // quick diffuse shading f = DotProduct(L, normal); @@ -1843,7 +1843,7 @@ float ShadeForNormal(vec3_t normal) //if (f < 0.0f) f = 0.0f; f += 0.5f; - + return f; } @@ -1883,7 +1883,7 @@ void Patch_CurveSplit(drawVert_t *vCurve[3], drawVert_t &pLeft, drawVert_t &pRig // float a, b; drawVert_t v1, v2, v3; // vec3_t v4; - + for (i=0; i<3; i++) { // xyz @@ -1930,7 +1930,7 @@ float Patch_CurveIndex(vec3_t vCurve[]) float index, dot; VectorClear(vClear); - + VectorSubtract(vCurve[2], vCurve[0], vTemp); VectorSubtract(vCurve[1], vCurve[0], v1); VectorSubtract(vCurve[2], vCurve[1], v2); @@ -1942,13 +1942,13 @@ float Patch_CurveIndex(vec3_t vCurve[]) VectorNormalize(v2, v2); if (VectorCompare(v1, v2)) return 0.0f; - + VectorCopy(vTemp, v3); width = VectorNormalize(v3, v3); if (VectorCompare(v1, v3) && VectorCompare(v2, v3)) return 0.0f; - + dot = DotProduct(v1, v2); angle = acos(dot) / Q_PI; @@ -2108,7 +2108,7 @@ void Patch_BezierInterpolate(vec3_t vCurve[], vec3_t &pMid) // take a pointer to the list of subtrees, and a threshold value // generate REAL surface curvature for the subtree curves, using bezier interpolation -// if any of the real curves has an index greater than the threshold, return true +// if any of the real curves has an index greater than the threshold, return true bool Patch_MostCurvedRow(BTreeList_t *pBTList, int threshold) { BTreeList_t *p; @@ -2123,7 +2123,7 @@ bool Patch_MostCurvedRow(BTreeList_t *pBTList, int threshold) VectorCopy(p->vLeft.xyz, vCurve[0]); VectorCopy(p->pBT->info.xyz, vCurve[1]); VectorCopy(p->vRight.xyz, vCurve[2]); - + index = Patch_CurveIndex(vCurve); if (index > threshold) return true; @@ -2170,18 +2170,20 @@ void BTree_ListCurveRecurse(BTreeList_t *pBTList) //int i; bool bFlipped = false; - if (g_PrefsDlg.m_nSubdivisions >= 1) - threshold = g_PrefsDlg.m_nSubdivisions; - + if (g_PrefsDlg.m_nSubdivisions >= 1) + threshold = g_PrefsDlg.m_nSubdivisions; + else + threshold = 0; + leftBTList = rightBTList = NULL; - + if (Patch_MostCurvedRow(pBTList, threshold)) // split all subtrees in list if any subtree is above threshold { //Sys_Printf("| "); // traverse nodes in list for (p = pBTList; p != NULL; p=p->next) { - if (p->pBT == NULL) + if (p->pBT == NULL) { leftBTList = BTree_AddLinkToList(leftBTList, (p->vLeft.normal[0] == 1.0f)); rightBTList = BTree_AddLinkToList(rightBTList, (p->vLeft.normal[0] == 1.0f)); @@ -2193,7 +2195,7 @@ void BTree_ListCurveRecurse(BTreeList_t *pBTList) BTNode_t *newLeft = new BTNode_t; p->pBT->left = newLeft; newLeft->left = newLeft->right = NULL; - + // create right node for this subtree BTNode_t *newRight = new BTNode_t; p->pBT->right = newRight; @@ -2207,13 +2209,13 @@ void BTree_ListCurveRecurse(BTreeList_t *pBTList) memcpy(&newLeft->vMid, &newLeft->info, sizeof(drawVert_t)); memcpy(&newRight->vMid, &newRight->info, sizeof(drawVert_t)); - - + + if (!bFlipped) { // add new left subtree to left subtree list leftBTList = BTree_AddToList(leftBTList, newLeft, p->vLeft, p->pBT->vMid); - + // add new right subtree to right subtree list rightBTList = BTree_AddToList(rightBTList, newRight, p->pBT->vMid, p->vRight); } @@ -2221,7 +2223,7 @@ void BTree_ListCurveRecurse(BTreeList_t *pBTList) { // add new left subtree to right subtree list rightBTList = BTree_AddToList(rightBTList, newLeft, p->vLeft, p->pBT->vMid); - + // add new right subtree to left subtree list leftBTList = BTree_AddToList(leftBTList, newRight, p->pBT->vMid, p->vRight); } @@ -2269,7 +2271,7 @@ BTreeList_t *Patch_CreateBTListForRows(BTreeList_t *pBTList, patchMesh_t *patch, { int row, pos; patch->colDirty[(col-1)/2] = true; - + if (start == 0) { for (row=0; rowheight; row++) @@ -2434,7 +2436,7 @@ BTreeList_t *Patch_FindLODMatches(patchMesh_t *patch, BTreeList_t *pBTList, draw { pBTList = BTree_AddLinkToList(pBTList, true); // flip pBTList = Patch_CreateBTListForRows(pBTList, pb->pPatch, row, col); - pBTList = Patch_FindLODMatches(pb->pPatch, pBTList, pBTList->pBT->info, pBTList->vLeft, pBTList->vRight); + pBTList = Patch_FindLODMatches(pb->pPatch, pBTList, pBTList->pBT->info, pBTList->vLeft, pBTList->vRight); pb->pPatch->LODUpdated = true; bAlreadyAdded = true; } @@ -2497,12 +2499,12 @@ void Patch_CreateLODTrees(patchMesh_t *patch) BTListList_t *LODLists; LODLists = NULL; - + pBTList = NULL; patch->bDirty = false; patch->LODUpdated = true; - + for(col=1; colwidth; col+=2) { if (patch->colDirty[(col-1)/2]) continue; @@ -2516,7 +2518,7 @@ void Patch_CreateLODTrees(patchMesh_t *patch) patch->rowLOD[pos] = BTree_Create(patch->ctrl[col][row]); pBTList = BTree_AddToList(pBTList, patch->rowLOD[pos], patch->ctrl[col-1][row], patch->ctrl[col+1][row]); } - + //create connection list for first row pBTList = Patch_FindLODMatches(patch, pBTList, patch->ctrl[col][0], patch->ctrl[col-1][0], patch->ctrl[col+1][0]); //create connection list for last row @@ -2574,13 +2576,15 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) { vec3_t v1, v2, vTemp1, vTemp2; int a, b; - + a = Patch_GetCVTangent(v1, ctrl[0][0], ctrl[1][0], ctrl[2][0]); b = Patch_GetCVTangent(v2, ctrl[0][0], ctrl[0][1], ctrl[0][2]); //Sys_Printf("p1: (%1.1f %1.1f %1.1f) p2: (%1.1f %1.1f %1.1f) p2: (%1.1f %1.1f %1.1f)\n", // ctrl[0][0][0], ctrl[0][0][1], ctrl[0][0][2], ctrl[0][2][0], ctrl[0][2][1], ctrl[0][2][2], ctrl[2][0][0], ctrl[2][0][1], ctrl[2][0][2]); - + + v1[0] = v1[1] = v1[2] = v2[0] = v2[1] = v2[2] = 0; + if (a == 2) { a = Patch_GetCVTangent(v1, ctrl[0][0], ctrl[1][1], ctrl[1][2]); @@ -2589,7 +2593,7 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) { b = Patch_GetCVTangent(v2, ctrl[0][0], ctrl[1][1], ctrl[2][1]); } - + if (a == 2) { a = Patch_GetCVTangent(v1, ctrl[0][0], ctrl[2][1], ctrl[2][2]); @@ -2597,11 +2601,11 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) if (b == 2) { b = Patch_GetCVTangent(v2, ctrl[0][0], ctrl[1][2], ctrl[2][2]); - } + } CrossProduct(v1, v2, normal); - + if (normal[0] == 0.0f && normal[1] == 0.0f && normal[2] == 0.0f) { // more degenerate cases @@ -2628,12 +2632,12 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) Patch_BezierInterpolate(vCurve, pMid); VectorSubtract(pMid, ctrl[0][0], v1); } - - + + } else if (VectorCompare(ctrl[0][0], ctrl[0][2])) // endcap right { - + if (VectorCompare(ctrl[2][0], ctrl[2][1])) { VectorSubtract(ctrl[2][2], ctrl[0][0], v2); @@ -2643,7 +2647,7 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) VectorSubtract(ctrl[2][0], ctrl[0][0], v2); } else - + b = Patch_DegenCurve(ctrl[2][0], ctrl[2][1], ctrl[2][2]); if (b == 0) { @@ -2653,7 +2657,7 @@ void Patch_CVNormal(vec3_t ctrl[3][3], vec3_t &normal) Patch_BezierInterpolate(vCurve, pMid); VectorSubtract(pMid, ctrl[0][0], v2); } - + } */ if (VectorCompare(ctrl[0][0], ctrl[2][0])) // bottom degen @@ -2814,7 +2818,7 @@ void BTree_GenerateNormals(BTNode_t *pBTMid, BTNode_t *pBTLeft, BTNode_t *pBTRig if (pBTMid->left != NULL && pBTMid->right != NULL) { vec3_t normal; - + if (noleft) // left curve is degenerate { if (nomid) // mid curve is degenerate @@ -2870,7 +2874,7 @@ void BTree_GenerateNormals(BTNode_t *pBTMid, BTNode_t *pBTLeft, BTNode_t *pBTRig for (int i=0; i<3; i++) pBTLeft->vMid.normal[i] = (normal[i] + pBTLeft->vMid.normal[i]) / 2.0f; else VectorCopy(normal, pBTLeft->vMid.normal); - + VectorNormalize(pBTLeft->vMid.normal, pBTLeft->vMid.normal); VectorNormalize(pBTRight->vMid.normal, pBTRight->vMid.normal); @@ -2893,11 +2897,11 @@ void Patch_GenerateLODNormals(patchMesh_t *patch) { for(row=0; row+2height; row+=2) { - if (!patch->colDirty[col/2] && !patch->rowDirty[row/2]) continue; - + if (!patch->colDirty[col/2] && !patch->rowDirty[row/2]) continue; + rowpos = ((col/2)*patch->height)+row; colpos = ((row/2)*patch->width)+col; - + if (row==0) rowAvg = false; else rowAvg = true; if (col==0) colAvg = false; @@ -2907,7 +2911,7 @@ void Patch_GenerateLODNormals(patchMesh_t *patch) { tree[0][i] = patch->rowLOD[rowpos+i]; tree[1][i] = patch->colLOD[colpos+i]; - + degen[0][i] = Patch_DegenCurve(patch->ctrl[col][row+i].xyz, patch->ctrl[col+1][row+i].xyz, patch->ctrl[col+2][row+i].xyz); degen[1][i] = Patch_DegenCurve(patch->ctrl[col+i][row].xyz, patch->ctrl[col+i][row+1].xyz, patch->ctrl[col+i][row+2].xyz); } @@ -3131,11 +3135,11 @@ void Patch_CreateDrawLists(patchMesh_t *patch) Patch_AddBTreeToDrawListInOrder((*iter1), patch->rowLOD[rowpos]); (*iter1)->push_back(patch->ctrl[col+2][row]); - + if (row+1 == patch->height) continue; - - iter1++; + + iter1++; Patch_TraverseColBTInOrder(iter1, patch->colLOD[colpos], patch->colLOD[colpos+1], patch->colLOD[colpos+2], patch->rowLOD[rowpos+1], patch->rowLOD[rowpos], 0.5, 0.25); } @@ -3231,7 +3235,7 @@ void Patch_DrawLODPatchMesh(patchMesh_t *patch) } /* -// fast memory-efficient ray-triangle intersection - MollerTrumbore97 +// fast memory-efficient ray-triangle intersection - MollerTrumbore97 #define EPSILON 0.000001 #define CROSS(dest,v1,v2) {dest[0]=v1[1]*v2[2]-v1[2]*v2[1];dest[1]=v1[2]*v2[0]-v1[0]*v2[2];dest[2]=v1[0]*v2[1]-v1[1]*v2[0];} @@ -3249,7 +3253,7 @@ int intersect_triangle(float orig[3], float dir[3], SUB(edge1, vert1, vert0); SUB(edge2, vert2, vert0); - // begin calculating determinant - also used to calculate U parameter + // begin calculating determinant - also used to calculate U parameter CROSS(pvec, dir, edge2); // if determinant is near zero, ray lies in plane of triangle @@ -3315,38 +3319,38 @@ int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, { float edge1[3], edge2[3], tvec[3], pvec[3], qvec[3]; double det,inv_det; - + /* find vectors for two edges sharing vert0 */ VectorSubtract(vert1, vert0, edge1); VectorSubtract(vert2, vert0, edge2); - + /* begin calculating determinant - also used to calculate U parameter */ CrossProduct(dir, edge2, pvec); - + /* if determinant is near zero, ray lies in plane of triangle */ det = DotProduct(edge1, pvec); - + if (bCullBack) { if (det < 0.000001) return 0; - + // calculate distance from vert0 to ray origin VectorSubtract(orig, vert0, tvec); - + // calculate U parameter and test bounds *u = DotProduct(tvec, pvec); if (*u < 0.0 || *u > det) return 0; - + // prepare to test V parameter CrossProduct(tvec, edge1, qvec); - + // calculate V parameter and test bounds *v = DotProduct(dir, qvec); if (*v < 0.0 || *u + *v > det) return 0; - + // calculate t, scale parameters, ray intersects triangle *t = DotProduct(edge2, qvec); inv_det = 1.0 / det; @@ -3360,23 +3364,23 @@ int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, if (det > -0.000001 && det < 0.000001) return 0; inv_det = 1.0 / det; - + /* calculate distance from vert0 to ray origin */ VectorSubtract(orig, vert0, tvec); - + /* calculate U parameter and test bounds */ *u = DotProduct(tvec, pvec) * inv_det; if (*u < 0.0 || *u > 1.0) return 0; - + /* prepare to test V parameter */ CrossProduct(tvec, edge1, qvec); - + /* calculate V parameter and test bounds */ *v = DotProduct(dir, qvec) * inv_det; if (*v < 0.0 || *u + *v > 1.0) return 0; - + /* calculate t, ray intersects triangle */ *t = DotProduct(edge2, qvec) * inv_det; } @@ -3415,7 +3419,7 @@ bool Patch_Ray(patchMesh_t *patch, vec3_t origin, vec3_t dir, double *t, double bIntersect = true; if (*t < tBest) tBest = *t; - } + } if (Triangle_Ray(origin, dir, false, (*i3).xyz, (*i4).xyz, (*i2).xyz, t, u, v)) { bIntersect = true; @@ -3462,7 +3466,7 @@ void DrawPatchMesh(patchMesh_t *pm) Patch_DeleteDrawLists(pm); Patch_CreateDrawLists(pm); - + Patch_DrawLODPatchMesh(pm); if (pm->nListID > 0) @@ -3499,8 +3503,8 @@ DrawPatchControls void DrawPatchControls(patchMesh_t *pm) { int i, j; - bool bSelectedPoints[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT]; - + bool bSelectedPoints[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT]; + bool bOverlay = pm->bOverlay; // bending @@ -3529,33 +3533,33 @@ void DrawPatchControls(patchMesh_t *pm) } qglEnd(); qglLineWidth(1.0); - } - + } + if (g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN) { if(!g_PrefsDlg.m_bGlPtWorkaround) { qglColor3f(0, 0, 1); qglBegin(GL_POINTS); - if (g_nPatchBendState == BEND_SELECT_ORIGIN) + if (g_nPatchBendState == BEND_SELECT_ORIGIN) { qglVertex3fv(g_vBendOrigin); } - else + else { - for (i = 0; i < pm->width; i++) + for (i = 0; i < pm->width; i++) { - if (g_bPatchLowerEdge) + if (g_bPatchLowerEdge) { for (j = 0; j < g_nPatchAxisIndex; j++) qglVertex3fv(pm->ctrl[i][j].xyz); } - else + else { for (j = pm->height-1; j > g_nPatchAxisIndex; j--) qglVertex3fv(pm->ctrl[i][j].xyz); } - } + } } qglEnd(); } @@ -3563,29 +3567,29 @@ void DrawPatchControls(patchMesh_t *pm) qglColor3f(0, 0, 1); qglLineWidth(2.0); qglBegin(GL_LINES); - if(g_nPatchBendState == BEND_SELECT_ORIGIN) + if(g_nPatchBendState == BEND_SELECT_ORIGIN) { DrawAlternatePoint(g_vBendOrigin, 0); } - else + else { - for(i = 0; i < pm->width; i++) + for(i = 0; i < pm->width; i++) { - if(g_bPatchLowerEdge) + if(g_bPatchLowerEdge) { for(j = 0; j < g_nPatchAxisIndex; j++) { DrawAlternatePoint(pm->ctrl[i][j].xyz, 0); - } + } } - else + else { - for (j = pm->height-1; j > g_nPatchAxisIndex; j--) + for (j = pm->height-1; j > g_nPatchAxisIndex; j--) { DrawAlternatePoint(pm->ctrl[i][j].xyz, 0); - } - } - } + } + } + } } qglEnd(); qglLineWidth(1.0); @@ -3615,7 +3619,7 @@ void DrawPatchControls(patchMesh_t *pm) qglEnd(); qglLineWidth(1.0); } - + if (g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN) { if(!g_PrefsDlg.m_bGlPtWorkaround) @@ -3678,7 +3682,7 @@ void DrawPatchControls(patchMesh_t *pm) } } } - else + else { //qglDisable(GL_TEXTURE_2D); // stops point colours being multiplied by texture colour.. //draw CV lattice - could be made optional @@ -3692,7 +3696,7 @@ void DrawPatchControls(patchMesh_t *pm) for ( i = 0 ; i+1 < pm->width ; i++ ) { qglBegin(GL_QUAD_STRIP); - for ( j = 0 ; j < pm->height ; j++ ) + for ( j = 0 ; j < pm->height ; j++ ) { qglVertex3fv(pm->ctrl[i][j].xyz); qglVertex3fv(pm->ctrl[i+1][j].xyz); @@ -3702,7 +3706,7 @@ void DrawPatchControls(patchMesh_t *pm) qglDisable (GL_POLYGON_OFFSET_LINE); //if (g_PrefsDlg.m_bNoStipple == FALSE) // qglEnable (GL_LINE_STIPPLE); - + // draw selection handles if(!g_PrefsDlg.m_bGlPtWorkaround) { @@ -3710,20 +3714,20 @@ void DrawPatchControls(patchMesh_t *pm) qglBegin(GL_POINTS); for ( i = 0 ; i < pm->width ; i++ ) { - for ( j = 0 ; j < pm->height ; j++ ) + for ( j = 0 ; j < pm->height ; j++ ) { if (PointInMoveList(pm->ctrl[i][j].xyz) != -1) { bSelectedPoints[i][j] = true; } else - { + { bSelectedPoints[i][j] = false; if (i & 0x01 || j & 0x01) qglColor3f(1, 0, 1); else qglColor3f(0, 1, 0); - + qglVertex3fv(pm->ctrl[i][j].xyz); } } @@ -3731,7 +3735,7 @@ void DrawPatchControls(patchMesh_t *pm) qglColor3f(0, 0, 1); for ( i = 0 ; i < pm->width ; i++ ) { - for ( j = 0 ; j < pm->height ; j++ ) + for ( j = 0 ; j < pm->height ; j++ ) { if (bSelectedPoints[i][j]) qglVertex3fv(pm->ctrl[i][j].xyz); @@ -3758,7 +3762,7 @@ void DrawPatchControls(patchMesh_t *pm) qglColor3f(1, 0, 1); else qglColor3f(0, 1, 0); - + // draw verts DrawAlternatePoint(pm->ctrl[i][j].xyz, 0); } @@ -3776,7 +3780,7 @@ void DrawPatchControls(patchMesh_t *pm) } } } - qglEnd(); + qglEnd(); qglLineWidth(1.0); } } @@ -3788,7 +3792,7 @@ void DrawPatchControls(patchMesh_t *pm) qglBegin(GL_POINTS); for ( i = 0 ; i < pm->width ; i++ ) { - for ( j = 0 ; j < pm->height ; j++ ) + for ( j = 0 ; j < pm->height ; j++ ) { if (i & 0x01 || j & 0x01) qglColor3f(1, 0, 1); @@ -3805,7 +3809,7 @@ void DrawPatchControls(patchMesh_t *pm) qglBegin(GL_LINES); for ( i = 0 ; i < pm->width ; i++ ) { - for ( j = 0 ; j < pm->height ; j++ ) + for ( j = 0 ; j < pm->height ; j++ ) { if (i & 0x01 || j & 0x01) qglColor3f(1, 0, 1); @@ -3884,7 +3888,7 @@ void Patch_DrawCam(patchMesh_t *pm) qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglColor4f(pm->d_texture->color[0], pm->d_texture->color[1], pm->d_texture->color[2], pm->pShader->getTrans()); } - + DrawPatchMesh(pm); // both sides } @@ -3902,13 +3906,13 @@ void BrushesForSection( float section[2][4][7] ) { Patch_BuildPoints ================ */ -void Patch_BuildPoints (brush_t *b) +void Patch_BuildPoints (brush_t *b) { face_t *f; b->patchBrush = false; - for (f=b->brush_faces ; f ; f=f->next) + for (f=b->brush_faces ; f ; f=f->next) { - if (f->texdef.flags & SURF_PATCH) + if (f->texdef.flags & SURF_PATCH) { b->patchBrush = true; //vec3_t vMin, vMax; @@ -3954,7 +3958,7 @@ Patch_ApplyMatrix void Patch_ApplyMatrix(patchMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[3], bool bSnap) { vec3_t vTemp; - + for (int w = 0; w < p->width; w++) { for (int h = 0; h < p->height; h++) @@ -3988,15 +3992,15 @@ void Patch_EditPatch() //--patchMesh_t* p = &patchMeshes[n]; g_qeglobals.d_numpoints = 0; g_qeglobals.d_num_move_points = 0; - + for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) { patchMesh_t* p = pb->pPatch; - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { - for ( int j = 0 ; j < p->height ; j++ ) + for ( int j = 0 ; j < p->height ; j++ ) { VectorCopy (p->ctrl[i][j].xyz, g_qeglobals.d_points[g_qeglobals.d_numpoints]); if (g_qeglobals.d_numpoints < MAX_POINTS-1) @@ -4049,7 +4053,7 @@ Patch_Select */ void Patch_Select(patchMesh_t *p) { - // maintained for point manip.. which i need to fix as this + // maintained for point manip.. which i need to fix as this // is pf error prone //--g_nSelectedPatch = n; p->bSelected = true; @@ -4095,7 +4099,7 @@ void Patch_Delete(patchMesh_t *p) // delete display list associated with patch if (p->nListID != -1) qglDeleteLists (p->nListID, 1); // list#, number of lists - + // delete LOD drawLists Patch_DeleteDrawLists(p); @@ -4103,7 +4107,7 @@ void Patch_Delete(patchMesh_t *p) free(p); p = NULL; - + UpdatePatchInspector(); } @@ -4194,7 +4198,7 @@ bool Patch_DragScale(patchMesh_t *p, vec3_t vAmt, vec3_t vMove) return false; } } - + for (i=0 ; i<3 ; i++) vMid[i] = (vMin[i] + ((vMax[i] - vMin[i]) / 2)); @@ -4215,7 +4219,7 @@ bool Patch_DragScale(patchMesh_t *p, vec3_t vAmt, vec3_t vMove) VectorSubtract(vMax, vMin, vTemp); Patch_CalcBounds(p, vMin, vMax); - + VectorSubtract(vMax, vMin, vMid); VectorSubtract(vMid, vTemp, vTemp); @@ -4246,10 +4250,11 @@ void Patch_InsertColumn(patchMesh_t *p, bool bAdd) int w, h, i, width; vec3_t vTemp; float stTemp[2]; - + if (p->width + 2 >= MAX_PATCH_WIDTH) return; + w = 1; // check for selected column points for (h = 0; h < p->height; h++) { @@ -4278,19 +4283,19 @@ void Patch_InsertColumn(patchMesh_t *p, bool bAdd) { for (width = p->width-1; width > w; width--) memcpy(&p->ctrl[width+2][h],&p->ctrl[width][h], sizeof(drawVert_t)); - + // set two new column points memcpy(&p->ctrl[w+2][h],&p->ctrl[w][h], sizeof(drawVert_t)); memcpy(&p->ctrl[w+1][h],&p->ctrl[w-1][h], sizeof(drawVert_t)); - + for (i=0; i<3; i++) // xyz { vTemp[i] = p->ctrl[w][h].xyz[i] - p->ctrl[w-1][h].xyz[i]; p->ctrl[w+1][h].xyz[i] = p->ctrl[w+1][h].xyz[i] + (vTemp[i] / 2); - + vTemp[i] = p->ctrl[w-2][h].xyz[i] - p->ctrl[w-1][h].xyz[i]; p->ctrl[w-1][h].xyz[i] = p->ctrl[w-1][h].xyz[i] + (vTemp[i] / 2); - + vTemp[i] = p->ctrl[w+1][h].xyz[i] - p->ctrl[w-1][h].xyz[i]; p->ctrl[w][h].xyz[i] = p->ctrl[w-1][h].xyz[i] + (vTemp[i] / 2); } @@ -4298,10 +4303,10 @@ void Patch_InsertColumn(patchMesh_t *p, bool bAdd) { stTemp[i] = p->ctrl[w][h].st[i] - p->ctrl[w-1][h].st[i]; p->ctrl[w+1][h].st[i] = p->ctrl[w+1][h].st[i] + (stTemp[i] / 2); - + stTemp[i] = p->ctrl[w-2][h].st[i] - p->ctrl[w-1][h].st[i]; p->ctrl[w-1][h].st[i] = p->ctrl[w-1][h].st[i] + (stTemp[i] / 2); - + stTemp[i] = p->ctrl[w+1][h].st[i] - p->ctrl[w-1][h].st[i]; p->ctrl[w][h].st[i] = p->ctrl[w-1][h].st[i] + (stTemp[i] / 2); } @@ -4326,10 +4331,11 @@ void Patch_InsertRow(patchMesh_t *p, bool bAdd) int h, w, i, height; vec3_t vTemp; float stTemp[2]; - + if (p->height + 2 >= MAX_PATCH_HEIGHT) return; + h = 1; // check for selected row points for (w = 0; w < p->width; w++) { @@ -4357,19 +4363,19 @@ void Patch_InsertRow(patchMesh_t *p, bool bAdd) { for (height = p->height-1; height > h; height--) memcpy(&p->ctrl[w][height+2],&p->ctrl[w][height], sizeof(drawVert_t)); - + // set two new row points memcpy(&p->ctrl[w][h+2],&p->ctrl[w][h], sizeof(drawVert_t)); memcpy(&p->ctrl[w][h+1],&p->ctrl[w][h-1], sizeof(drawVert_t)); - + for (i=0; i<3; i++) // xyz { vTemp[i] = p->ctrl[w][h].xyz[i] - p->ctrl[w][h-1].xyz[i]; p->ctrl[w][h+1].xyz[i] = p->ctrl[w][h+1].xyz[i] + (vTemp[i] / 2); - + vTemp[i] = p->ctrl[w][h-2].xyz[i] - p->ctrl[w][h-1].xyz[i]; p->ctrl[w][h-1].xyz[i] = p->ctrl[w][h-1].xyz[i] + (vTemp[i] / 2); - + vTemp[i] = p->ctrl[w][h+1].xyz[i] - p->ctrl[w][h-1].xyz[i]; p->ctrl[w][h].xyz[i] = p->ctrl[w][h-1].xyz[i] + (vTemp[i] / 2); } @@ -4377,10 +4383,10 @@ void Patch_InsertRow(patchMesh_t *p, bool bAdd) { stTemp[i] = p->ctrl[w][h].st[i] - p->ctrl[w][h-1].st[i]; p->ctrl[w][h+1].st[i] = p->ctrl[w][h+1].st[i] + (stTemp[i] / 2); - + stTemp[i] = p->ctrl[w][h-2].st[i] - p->ctrl[w][h-1].st[i]; p->ctrl[w][h-1].st[i] = p->ctrl[w][h-1].st[i] + (stTemp[i] / 2); - + stTemp[i] = p->ctrl[w][h+1].st[i] - p->ctrl[w][h-1].st[i]; p->ctrl[w][h].st[i] = p->ctrl[w][h-1].st[i] + (stTemp[i] / 2); } @@ -4405,10 +4411,11 @@ void Patch_RemoveRow(patchMesh_t *p, bool bFirst) vec3_t vTemp; float stTemp[2]; bool bExtrapolate = true; - + if (p->height <= MIN_PATCH_HEIGHT) return; + h = 0; for (w = 0; w < p->width; w++) { for (h = 0; h < p->height; h+=2) @@ -4432,7 +4439,7 @@ void Patch_RemoveRow(patchMesh_t *p, bool bFirst) else if (h <= 0) h=2; else if (h > p->height-3) h = p->height-3; else if (h%2) h++; - + p->height -= 2; for (w = 0; w < p->width; w++) @@ -4464,12 +4471,12 @@ void Patch_RemoveRow(patchMesh_t *p, bool bFirst) else h=0; } for (height = h; height < p->height; height++) - memcpy(&p->ctrl[w][height], &p->ctrl[w][height+2], sizeof(drawVert_t)); + memcpy(&p->ctrl[w][height], &p->ctrl[w][height+2], sizeof(drawVert_t)); } // deselect all points to keep things neat if (g_qeglobals.d_select_mode == sel_curvepoint) Patch_EditPatch(); - + UpdatePatchInspector(); } @@ -4484,10 +4491,11 @@ void Patch_RemoveColumn(patchMesh_t *p, bool bFirst) vec3_t vTemp; float stTemp[2]; bool bExtrapolate = true; - + if (p->width <= MIN_PATCH_WIDTH) return; + w = 0; for (h = 0; h < p->height; h++) { for (w = 0; w < p->width; w+=2) @@ -4511,7 +4519,7 @@ void Patch_RemoveColumn(patchMesh_t *p, bool bFirst) else if (w<=0) w=2; else if (w > p->width-3) w = p->width-3; else if (w%2) w++; - + p->width -= 2; for (h = 0; h < p->height; h++) @@ -4542,9 +4550,9 @@ void Patch_RemoveColumn(patchMesh_t *p, bool bFirst) continue; else w=0; } - + for (width = w; width < p->width; width++) - memcpy(&p->ctrl[width][h], &p->ctrl[width+2][h], sizeof(drawVert_t)); + memcpy(&p->ctrl[width][h], &p->ctrl[width+2][h], sizeof(drawVert_t)); } // deselect all points to keep things neat if (g_qeglobals.d_select_mode == sel_curvepoint) @@ -4572,10 +4580,10 @@ void Patch_AdjustColumns(patchMesh_t *p, int nCols) for (h = 0; h < p->height; h++) { - // for each column, we need to evenly disperse p->width number + // for each column, we need to evenly disperse p->width number // of points across the old bounds - - // calc total distance to interpolate + + // calc total distance to interpolate VectorSubtract(p->ctrl[p->width - 1 - nCols][h].xyz, p->ctrl[0][h].xyz, vTemp); // amount per cycle @@ -4591,9 +4599,9 @@ void Patch_AdjustColumns(patchMesh_t *p, int nCols) } } - for ( w = 0 ; w < p->width ; w++ ) + for ( w = 0 ; w < p->width ; w++ ) { - for ( h = 0 ; h < p->height ; h++ ) + for ( h = 0 ; h < p->height ; h++ ) { p->ctrl[w][h].st[0] = 4 * (float)w / (p->width - 1); p->ctrl[w][h].st[1] = 4 * (float)h / (p->height - 1); @@ -4622,12 +4630,12 @@ void Patch_AdjustRows(patchMesh_t *p, int nRows) for (w = 0; w < p->width; w++) { - // for each row, we need to evenly disperse p->height number + // for each row, we need to evenly disperse p->height number // of points across the old bounds - // calc total distance to interpolate + // calc total distance to interpolate VectorSubtract(p->ctrl[w][p->height - 1 - nRows].xyz, p->ctrl[w][0].xyz, vTemp); - + //vTemp[0] = vTemp[1] = vTemp[2] = 0; //for (h = 0; h < p->height - nRows; h ++) //{ @@ -4647,9 +4655,9 @@ void Patch_AdjustRows(patchMesh_t *p, int nRows) } } - for ( w = 0 ; w < p->width ; w++ ) + for ( w = 0 ; w < p->width ; w++ ) { - for ( h = 0 ; h < p->height ; h++ ) + for ( h = 0 ; h < p->height ; h++ ) { p->ctrl[w][h].st[0] = 4 * (float)w / (p->width - 1); p->ctrl[w][h].st[1] = 4 * (float)h / (p->height - 1); @@ -4669,8 +4677,8 @@ void Patch_DisperseRows() { vec3_t vTemp, vTemp2; int i, w, h; - - + + for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) @@ -4679,31 +4687,31 @@ void Patch_DisperseRows() Patch_Rebuild(p); for (w = 0; w < p->width; w++) { - // for each row, we need to evenly disperse p->height number + // for each row, we need to evenly disperse p->height number // of points across the old bounds - - // calc total distance to interpolate + + // calc total distance to interpolate VectorSubtract(p->ctrl[w][p->height - 1].xyz, p->ctrl[w][0].xyz, vTemp); - + //vTemp[0] = vTemp[1] = vTemp[2] = 0; //for (h = 0; h < p->height - nRows; h ++) //{ // VectorAdd(vTemp, p->ctrl[w][h], vTemp); //} - + // amount per cycle for (i = 0; i < 3; i ++) { vTemp2[i] = vTemp[i] / (p->height - 1); } - + // move along for (h = 0; h < p->height-1; h++) { VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w][h+1].xyz); } Patch_Naturalize(p); - + } } } @@ -4720,8 +4728,8 @@ void Patch_DisperseIntermediateRows() { vec3_t vTemp, vTemp2; int i, w, h; - - + + for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) @@ -4733,15 +4741,15 @@ void Patch_DisperseIntermediateRows() // move along for (h = 0; h < p->height; h+=2) { - // calc distance to interpolate + // calc distance to interpolate VectorSubtract(p->ctrl[w][h+2].xyz, p->ctrl[w][h].xyz, vTemp); - + // halve distance for (i = 0; i < 3; i ++) { vTemp2[i] = vTemp[i] / 2; } - + // move control points VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w][h+1].xyz); } @@ -4760,8 +4768,8 @@ void Patch_DisperseIntermediateColumns() { vec3_t vTemp, vTemp2; int i, w, h; - - + + for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { if (pb->patchBrush) @@ -4773,15 +4781,15 @@ void Patch_DisperseIntermediateColumns() // move along for (w = 0; w < p->width; w+=2) { - // calc distance to interpolate + // calc distance to interpolate VectorSubtract(p->ctrl[w+2][h].xyz, p->ctrl[w][h].xyz, vTemp); - + // halve distance for (i = 0; i < 3; i ++) { vTemp2[i] = vTemp[i] / 2; } - + // move control points VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w+1][h].xyz); } @@ -4859,7 +4867,7 @@ void Patch_AdjustSelectedRowCols(int nRows, int nCols) { Patch_AdjustRows(pb->pPatch, nRows); } - + if (nCols != 0) { Patch_AdjustColumns(pb->pPatch, nCols); @@ -4905,7 +4913,7 @@ void CheckName( patchMesh_t *p, char *pname ) /* ================== -Patch_Write +Patch_Write ================== */ void Patch_Write (patchMesh_t *p, MemStream *file) @@ -5043,7 +5051,7 @@ void Patch_ScaleTexture(patchMesh_t *p, float fx, float fy, bool bFixup) if (fy == 0) fy = 1.0; } - + for (int w = 0; w < p->width; w++) { for (int h = 0; h < p->height; h++) @@ -5163,7 +5171,7 @@ void Patch_InvertTexture(bool bY) p->bDirty = true; if (bY) { - for ( int i = 0 ; i < p->height ; i++ ) + for ( int i = 0 ; i < p->height ; i++ ) { for (int j = 0; j < p->width / 2; j++) { @@ -5175,7 +5183,7 @@ void Patch_InvertTexture(bool bY) } else { - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { for (int j = 0; j < p->height / 2; j++) { @@ -5202,7 +5210,7 @@ void Patch_InvertTexture(bool bY) ================== Patch_Save ================== - Saves patch ctrl info (originally to deal with a + Saves patch ctrl info (originally to deal with a cancel in the surface dialog */ void Patch_Save(patchMesh_t *p) @@ -5233,9 +5241,9 @@ void Patch_ResetTexturing(float fx, float fy) { patchMesh_t *p = pb->pPatch; p->bDirty = true; - for ( int i = 0 ; i < p->width ; i++ ) + for ( int i = 0 ; i < p->width ; i++ ) { - for ( int j = 0 ; j < p->height ; j++ ) + for ( int j = 0 ; j < p->height ; j++ ) { p->ctrl[i][j].st[0] = fx * (float)i / (p->width - 1); p->ctrl[i][j].st[1] = 1 - fy * (float)j / (p->height - 1); @@ -5443,7 +5451,7 @@ void Patch_BendHandleENTER() else if (g_nPatchBendState == BEND_BENDIT) { - // basically we go into rotation mode, set the axis to the center of the + // basically we go into rotation mode, set the axis to the center of the } } else @@ -5550,7 +5558,7 @@ void Patch_SelectBendAxis() SelectColumn(p, g_nPatchAxisIndex, false); } - //FIXME: this only needs to be set once... + //FIXME: this only needs to be set once... Patch_SetBendRotateOrigin(p); } @@ -5860,7 +5868,7 @@ void Patch_SelectAreaPoints(bool bMulti) CrossProduct( ray[1], ray[2], norm[2] ); VectorNormalize( norm[2], norm[2] ); CrossProduct( ray[2], ray[3], norm[3] ); VectorNormalize( norm[3], norm[3] ); CrossProduct( ray[3], ray[0], norm[4] ); VectorNormalize( norm[4], norm[4] ); - + // 3D clipping for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next) { @@ -5933,7 +5941,7 @@ patchMesh_t* Patch_Duplicate(patchMesh_t *pFrom) { patchMesh_t* p = MakeNewPatch(); memcpy(p, pFrom , sizeof(patchMesh_t)); - + // spog - initialise patch LOD pointers (again) Patch_InitialiseLODPointers(p); p->drawLists = NULL; @@ -5943,7 +5951,7 @@ patchMesh_t* Patch_Duplicate(patchMesh_t *pFrom) p->bOverlay = false; p->nListID = -1; AddBrushForPatch(p); - + return p; } @@ -5988,7 +5996,7 @@ void Patch_Thicken(int nAmount, bool bSeam, qboolean bGroupResult) { // FIXME: this should detect if any edges of the patch are closed and act appropriately - // + // if (!(p->type & PATCH_CYLINDER)) { b = Patch_GenericMesh(3, p->height, 2, false, true); @@ -6027,7 +6035,7 @@ void Patch_Thicken(int nAmount, bool bSeam, qboolean bGroupResult) Patch_Naturalize(pSeam); brushes.Add(b); } - + //--{ // otherwise we will add one per end b = Patch_GenericMesh(p->width, 3, 2, false, true); @@ -6076,7 +6084,7 @@ void Patch_Thicken(int nAmount, bool bSeam, qboolean bGroupResult) Select_Brush(reinterpret_cast(brushes.GetAt(i))); } - if(bGroupResult) + if(bGroupResult) { entity_t *e = Entity_Alloc(); SetKeyValue(e, "classname", "func_group"); @@ -6084,7 +6092,7 @@ void Patch_Thicken(int nAmount, bool bSeam, qboolean bGroupResult) Select_GroupEntity(e); Entity_AddToList(e, &entities); } - + UpdatePatchInspector(); } @@ -6179,41 +6187,41 @@ void Patch_Transpose() { patchMesh_t *p = pb->pPatch; - if ( p->width > p->height ) + if ( p->width > p->height ) { - for ( i = 0 ; i < p->height ; i++ ) + for ( i = 0 ; i < p->height ; i++ ) { - for ( j = i + 1 ; j < p->width ; j++ ) + for ( j = i + 1 ; j < p->width ; j++ ) { - if ( j < p->height ) + if ( j < p->height ) { // swap the value memcpy(&dv,&p->ctrl[j][i],sizeof(drawVert_t)); memcpy(&p->ctrl[j][i],&p->ctrl[i][j], sizeof(drawVert_t)); memcpy(&p->ctrl[i][j],&dv, sizeof(drawVert_t)); - } - else + } + else { // just copy memcpy(&p->ctrl[i][j],&p->ctrl[j][i], sizeof(drawVert_t)); } } } - } - else + } + else { - for ( i = 0 ; i < p->width ; i++ ) + for ( i = 0 ; i < p->width ; i++ ) { - for ( j = i + 1 ; j < p->height ; j++ ) + for ( j = i + 1 ; j < p->height ; j++ ) { - if ( j < p->width ) + if ( j < p->width ) { // swap the value memcpy(&dv,&p->ctrl[i][j], sizeof(drawVert_t)); memcpy(&p->ctrl[i][j],&p->ctrl[j][i], sizeof(drawVert_t)); memcpy(&p->ctrl[j][i],&dv, sizeof(drawVert_t)); - } - else + } + else { // just copy memcpy(&p->ctrl[j][i],&p->ctrl[i][j], sizeof(drawVert_t)); @@ -6236,20 +6244,20 @@ void Patch_Transpose() void Patch_SnapToGrid(patchMesh_t *p) { int i,j,k; - + // if patch points selected, snap only selected points if (g_qeglobals.d_select_mode == sel_curvepoint && g_qeglobals.d_num_move_points != 0) for (i=0; iwidth; i++) for (j = 0; j < p->height; j++) for (k = 0; k < 3; k++) p->ctrl[i][j].xyz[k] = floor(p->ctrl[i][j].xyz[k] / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize; - + vec3_t vMin, vMax; Patch_CalcBounds(p, vMin, vMax); Brush_RebuildBrush(p->pSymbiot, vMin, vMax); @@ -6351,7 +6359,7 @@ void Patch_FromTriangle(vec5_t vx, vec5_t vy, vec5_t vz) //Patch_Naturalize(p); - // brush_t *b = + // brush_t *b = AddBrushForPatch(p); } @@ -6372,7 +6380,7 @@ void Patch_SetEpair(patchMesh_t *p, const char *pKey, const char *pValue) } } -/* +/* ================= Patch_GetKeyValue ================= diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index df20d71d..aafe6381 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -231,7 +231,7 @@ CXMLPropertyBag::CXMLPropertyBag() { // generic preference functions -void CXMLPropertyBag::PushAssignment(char *name, PrefTypes_t type, void *pV) +void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV) { list::iterator iAssign; for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++) @@ -274,7 +274,7 @@ xmlNodePtr CXMLPropertyBag::EpairForName(const char *name) return ret; } -void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V) +void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V) { xmlNodePtr pNode = EpairForName( name ); if ( pNode ) @@ -296,9 +296,9 @@ void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V) PushAssignment(name, PREF_STR, pV); } -void CXMLPropertyBag::GetPref(char *name, int *pV, int V) +void CXMLPropertyBag::GetPref(const char *name, int *pV, int V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { *pV = atoi((char *)pNode->children->content); @@ -312,12 +312,12 @@ void CXMLPropertyBag::GetPref(char *name, int *pV, int V) *pV=V; } // push the pref assignment if needed - PushAssignment(name, PREF_INT, pV); + PushAssignment(name, PREF_INT, pV); } -void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V) +void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { if (!strcmp((char *)pNode->children->content, "true")) @@ -338,12 +338,12 @@ void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V) *pV=V; } // push the pref assignment - PushAssignment(name, PREF_BOOL, pV); + PushAssignment(name, PREF_BOOL, pV); } -void CXMLPropertyBag::GetPref(char *name, float *pV, float V) +void CXMLPropertyBag::GetPref(const char *name, float *pV, float V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { *pV = atof((char *)pNode->children->content); @@ -357,12 +357,12 @@ void CXMLPropertyBag::GetPref(char *name, float *pV, float V) *pV=V; } // push the pref assignment if needed - PushAssignment(name, PREF_FLOAT, pV); + PushAssignment(name, PREF_FLOAT, pV); } -void CXMLPropertyBag::GetPref(char *name, float* pV, float* V) +void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]); @@ -378,12 +378,12 @@ void CXMLPropertyBag::GetPref(char *name, float* pV, float* V) pV[2] = V[2]; } // push the pref assignment if needed - PushAssignment(name, PREF_VEC3, pV); + PushAssignment(name, PREF_VEC3, pV); } -void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position_t V) +void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V) { - xmlNodePtr pNode; + xmlNodePtr pNode; if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content) { WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content)); @@ -397,7 +397,7 @@ void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position *pV = V; } // push the pref assignment if needed - PushAssignment(name, PREF_WNDPOS, pV); + PushAssignment(name, PREF_WNDPOS, pV); } void CXMLPropertyBag::UpdatePrefTree() @@ -485,7 +485,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename) Sys_FPrintf(SYS_ERR, "Wrong version '%s' in node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL); xmlFreeDoc(mpDoc); mpDoc = NULL; - } + } Sys_Printf("Opened XML property file: '%s'\n", pFilename); } @@ -504,7 +504,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename) qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename) { int res = xmlSaveFormatFile(pFilename, mpDoc, 1); - + if(res == -1) return false; @@ -520,9 +520,9 @@ qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename) static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data) { PrefsDlg *dlg = (PrefsDlg*)data; - + const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, "Executable for Custom Editor"); - + if(filename != NULL) { dlg->m_strEditorCommand = filename; @@ -568,7 +568,7 @@ static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data) } } -static void OnButtonClean (GtkWidget *widget, gpointer data) +static void OnButtonClean (GtkWidget *widget, gpointer data) { // make sure this is what the user wants if (gtk_MessageBox (g_PrefsDlg.GetWidget (), "This will close Radiant and clean the corresponding registry entries.\n" @@ -698,7 +698,7 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile) { char *p, *prop; mpDoc = pDoc; - // read the user-friendly game name + // read the user-friendly game name xmlNodePtr pNode = mpDoc->children; while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next; @@ -918,8 +918,6 @@ CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass) void CGameDialog::LoadPrefs() { - bool bEmpty = false; - // if we already have a document loaded, we will free and reload from file if (mGlobalPrefs.InUse()) { @@ -962,10 +960,10 @@ void CGameDialog::SavePrefs() { // update the tree and save it mGlobalPrefs.UpdatePrefTree(); - + CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str; strGlobalPref += "global.pref"; - + if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) { Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer()); } @@ -981,14 +979,14 @@ void CGameDialog::DoGameInstall() { void CGameDialog::DoGameDialog() { // allow looping the game selection dialog with calls to the game configure dialog in between while ( m_bDoGameInstall ) { - + m_bDoGameInstall = false; if ( DoModal() == IDCANCEL ) { Error( "game selection dialog canceled, cannot continue" ); return; } - + if ( m_bDoGameInstall ) { DoGameInstall(); ScanForGames(); @@ -1037,7 +1035,7 @@ GtkWidget* CGameDialog::GetGlobalFrame() gtk_widget_show(check); gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL); - + text = gtk_label_new("(this frame is available in the prefs menu if you set auto-select)"); gtk_widget_show(text); gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0); @@ -1104,7 +1102,7 @@ void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) { void CGameDialog::BuildDialog() { GtkWidget *dlg, *vbox1, *button, *setup_button; - + dlg = m_pWidget; gtk_window_set_title( GTK_WINDOW( dlg ), "Select Game" ); @@ -1130,7 +1128,7 @@ void CGameDialog::BuildDialog() { gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); AddModalButton( button, IDCANCEL ); - + gtk_widget_set_usize( button, 60, -2 ); } @@ -1144,13 +1142,13 @@ void CGameDialog::UpdateGameCombo() { } // clear whatever is in - wtf no way to know how many text entries? - // use set/get active to track + // use set/get active to track gtk_combo_box_set_active( mGameCombo, 0 ); while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) { gtk_combo_box_remove_text( mGameCombo, 0 ); gtk_combo_box_set_active( mGameCombo, 0 ); } - + for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) { gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() ); } @@ -1304,7 +1302,7 @@ void CGameDialog::Init() #else g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer(); #endif - + g_pGameDescription->Dump(); } @@ -1330,8 +1328,8 @@ void CGameDialog::AddPacksURL(Str &URL) // FIXME: this is kinda hardcoded for now.. list::iterator iGame; for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++) - { - if ((*iGame)->mGameFile == "q3.game") + { + if ((*iGame)->mGameFile == "q3.game") URL += "&Games_dlup%5B%5D=1"; else if ((*iGame)->mGameFile == "wolf.game") URL += "&Games_dlup%5B%5D=2"; @@ -1448,16 +1446,16 @@ void PrefsDlg::Init() #endif // this is common to win32 and Linux init now m_rc_path = g_string_new (m_global_rc_path->str); - + // game sub-dir g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer()); g_string_append (m_rc_path, "/"); Q_mkdir (m_rc_path->str, 0775); - + // then the ini file m_inipath = g_string_new (m_rc_path->str); g_string_append (m_inipath, PREFS_LOCAL_FILENAME); - + } void PrefsDlg::UpdateData (bool retrieve) @@ -1494,7 +1492,7 @@ void PrefsDlg::showPrefPage(int prefpage) { if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage) gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage); - + return; } @@ -1521,20 +1519,20 @@ void PrefsDlg::BuildDialog () GtkWidget *check, *label, *scale, *hbox2, *combo, *table, *spin, *entry, *pixmap, *radio, *button, *pageframe, *vbox; - + GList *combo_list = (GList*)NULL; - + GtkObject *adj; - + dialog = m_pWidget; gtk_window_set_title(GTK_WINDOW(dialog), "GtkRadiant Preferences"); gtk_widget_realize(dialog); - + mainvbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(dialog), mainvbox); gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5); gtk_widget_show(mainvbox); - + hbox = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox); gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0); @@ -1556,11 +1554,11 @@ void PrefsDlg::BuildDialog () gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_set_usize (button, 60, -2); - + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0); gtk_widget_show(hbox); - + sc_win = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0); @@ -1631,7 +1629,7 @@ void PrefsDlg::BuildDialog () gtk_tree_store_set(store, &tab, 0, "Texture Settings", 1, (gpointer)PTAB_TEXTURE, -1); } } - + { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); @@ -1652,7 +1650,7 @@ void PrefsDlg::BuildDialog () gtk_tree_store_set(store, &tab, 0, "Editing", 1, (gpointer)PTAB_EDITING, -1); } } - + { GtkTreeIter group; gtk_tree_store_append(store, &group, NULL); @@ -1682,14 +1680,14 @@ void PrefsDlg::BuildDialog () } gtk_tree_view_expand_all(GTK_TREE_VIEW(view)); - + g_object_unref(G_OBJECT(store)); } - + /**********************************************************************/ /* build the prefs pages */ /**********************************************************************/ - + // Front page... // todo : add something interesting here // NOTE TTimo: tip of the day? or a logo? @@ -1703,7 +1701,7 @@ void PrefsDlg::BuildDialog () gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); /******** global preferences group ****************************/ @@ -1712,7 +1710,7 @@ void PrefsDlg::BuildDialog () pageframe = mGamesDialog.GetGlobalFrame(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** 2D prefs group (xy views/rendering options) *********/ preflabel = gtk_label_new("2D Display"); gtk_widget_show(preflabel); @@ -1723,26 +1721,26 @@ void PrefsDlg::BuildDialog () gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // OpenGL Display Lists check = gtk_check_button_new_with_label("OpenGL Display Lists"); gtk_widget_show(check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL); - + // Antialiased points & lines // Fishman - Add antialiazed points and lines support. 09/03/00 check = gtk_check_button_new_with_label ("OpenGL antialiased points and lines"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL); - + // Solid selection boxes check = gtk_check_button_new_with_label ("Solid selection boxes"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL); - + // Display size info check = gtk_check_button_new_with_label ("Display size info"); gtk_widget_show (check); @@ -1766,10 +1764,10 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL); #endif - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** 3D Camera view group *********/ preflabel = gtk_label_new("3D View"); gtk_widget_show(preflabel); @@ -1786,62 +1784,62 @@ void PrefsDlg::BuildDialog () hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label label = gtk_label_new("Movement Velocity"); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); - + // adjustment adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10); AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new(GTK_ADJUSTMENT(adj)); gtk_widget_show(scale); gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2); - + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); - + // Angular velocity (Rotational Velocity) // label container hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label label = gtk_label_new ("Rotational Velocity"); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show (label); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); - + // adjustment adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_widget_show (scale); gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2); - gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); // Text under the velocity sliders // container hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0); - + // label label = gtk_label_new ("slow"); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // label label = gtk_label_new ("fast"); gtk_widget_show (label); gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // Allow drag to select multiple faces/brushes // container table = gtk_table_new(2, 1, FALSE); @@ -1869,7 +1867,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE); - AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT); + AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT); // Freelook in Camera view check = gtk_check_button_new_with_label ("Freelook in Camera view"); @@ -1919,7 +1917,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Texture quality slider // label label = gtk_label_new ("Texture quality"); @@ -1927,11 +1925,11 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - + // adjustment adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1); AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT); - + // scale scale = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_widget_show (scale); @@ -1954,7 +1952,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL); - + // texture scrollbar check = gtk_check_button_new_with_label ("Texture scrollbar"); gtk_widget_show (check); @@ -2030,7 +2028,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - + // combo list combo_list = NULL; combo_list = g_list_append (combo_list, (void *)"None"); @@ -2050,10 +2048,10 @@ void PrefsDlg::BuildDialog () gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE); AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT); g_list_free (combo_list); - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Layout group *********/ preflabel = gtk_label_new("Layout"); gtk_widget_show(preflabel); @@ -2129,13 +2127,13 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT); - + // Floating Z window check = gtk_check_button_new_with_label ("Floating Z Window"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL); - + // show menu tear-off seperators check = gtk_check_button_new_with_label ("Detachable Menus"); gtk_widget_show (check); @@ -2179,11 +2177,11 @@ void PrefsDlg::BuildDialog () g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check); gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this ); AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL); -#endif +#endif // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Mouse group *********/ preflabel = gtk_label_new("Mouse"); gtk_widget_show(preflabel); @@ -2194,7 +2192,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Buttons // container hbox2 = gtk_hbox_new (FALSE, 5); @@ -2235,22 +2233,22 @@ void PrefsDlg::BuildDialog () hbox2 = gtk_hbox_new (FALSE, 5); gtk_widget_show (hbox2); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); - + // label label = gtk_label_new ("Wheel Mouse inc:"); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // entry entry = gtk_entry_new (); gtk_widget_show (entry); gtk_widget_set_usize (entry, 40, -2); gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0); - AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT); + AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT); // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Editing group *********/ preflabel = gtk_label_new("Editing"); gtk_widget_show(preflabel); @@ -2261,7 +2259,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Vertex editing splits faces check = gtk_check_button_new_with_label ("Vertex editing splits face"); gtk_widget_show (check); @@ -2273,7 +2271,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show (check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL); - + // Clipper tool uses caulk check = gtk_check_button_new_with_label ("Clipper tool uses caulk"); gtk_widget_show (check); @@ -2290,8 +2288,8 @@ void PrefsDlg::BuildDialog () check = gtk_check_button_new_with_label ("Select patches by bounding box"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); - AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL); - + AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL); + // Rotation increment // container table = gtk_table_new (2, 3, FALSE); @@ -2299,14 +2297,14 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label label = gtk_label_new ("Rotation increment:"); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2315,7 +2313,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT); - + // Undo levels // label label = gtk_label_new ("Undo Levels:"); @@ -2323,9 +2321,9 @@ void PrefsDlg::BuildDialog () gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // spinner (allows undo levels to be set to zero) - spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0); + spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0); gtk_widget_show (spin); gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), @@ -2340,7 +2338,7 @@ void PrefsDlg::BuildDialog () gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); - + // entry (spinner perhaps? [2-16]) entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2352,7 +2350,7 @@ void PrefsDlg::BuildDialog () // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Save/Load group *********/ preflabel = gtk_label_new("Startup/Auto save"); gtk_widget_show(preflabel); @@ -2369,7 +2367,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL); - + // load last project on open check = gtk_check_button_new_with_label ("Load last project on open"); gtk_widget_show (check); @@ -2388,28 +2386,28 @@ void PrefsDlg::BuildDialog () gtk_widget_show (hbox2); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0); - + // label check = gtk_check_button_new_with_label ("Auto save every"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0); AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL); - + // spinner spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0); gtk_widget_show (spin); gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0); gtk_widget_set_usize (spin, 60, -2); AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT); - + // label label = gtk_label_new ("minutes"); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0); - + // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Paths group *********/ preflabel = gtk_label_new("Paths"); gtk_widget_show(preflabel); @@ -2428,7 +2426,7 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label label = gtk_label_new ("Prefab path:"); gtk_widget_show (label); @@ -2436,7 +2434,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - + // path entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2447,7 +2445,7 @@ void PrefsDlg::BuildDialog () AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT); // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=805 -#if 0 +#if 0 // browse button button = gtk_button_new_with_label ("..."); gtk_widget_show (button); @@ -2465,7 +2463,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - + // user ini path entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2473,7 +2471,7 @@ void PrefsDlg::BuildDialog () (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 1, 0); AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT); - + // user ini browse button button = gtk_button_new_with_label ("..."); gtk_widget_show (button); @@ -2484,7 +2482,7 @@ void PrefsDlg::BuildDialog () // Add the page to the notebook gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel); - + /******** Misc group *********/ preflabel = gtk_label_new("Misc"); gtk_widget_show(preflabel); @@ -2495,7 +2493,7 @@ void PrefsDlg::BuildDialog () gtk_widget_show(vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(pageframe), vbox); - + // Light drawing check = gtk_check_button_new_with_label ("Light drawing"); gtk_widget_show (check); @@ -2544,7 +2542,7 @@ void PrefsDlg::BuildDialog () gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this); g_object_set_data (G_OBJECT(dialog), "check_customeditor", check); AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL); - + // custom shader editor executable // table table = gtk_table_new (3, 1, FALSE); @@ -2552,7 +2550,7 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); - + // label label = gtk_label_new("Custom Editor Command"); gtk_widget_show(label); @@ -2562,7 +2560,7 @@ void PrefsDlg::BuildDialog () gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); g_object_set_data (G_OBJECT(dialog), "label_customeditor", label); gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor); - + // custom editor command entry entry = gtk_entry_new (); gtk_widget_show (entry); @@ -2573,7 +2571,7 @@ void PrefsDlg::BuildDialog () AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT); gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor); g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry); - + // browse button button = gtk_button_new_with_label ("..."); gtk_widget_show (button); @@ -2621,15 +2619,15 @@ void PrefsDlg::BuildDialog () gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_runengine", check); gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this ); - AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL ); - + AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL ); + // sleep mode when running engine check = gtk_check_button_new_with_label ("Activate sleep mode when running the engine"); gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "check_sleep", check); AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL ); - + // use q3map2's texture projection check = gtk_check_button_new_with_label ("Texturing compatible with q3map2"); gtk_widget_show (check); @@ -2654,7 +2652,7 @@ void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName) memset(pTexdef, 0, sizeof(texdef_t)); sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY); - mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f); + mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f); sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY); mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f); @@ -2676,7 +2674,7 @@ void PrefsDlg::UpdateTextureCompression() Sys_Printf("OpenGL not ready - postpone texture compression capability check\n"); return; } - + if (g_qeglobals.bTextureCompressionSupported) { if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported) @@ -2755,7 +2753,7 @@ void PrefsDlg::UpdateATIHack() { } #endif -// TTimo: m_strEnginePath has a special status, if not found in registry we need to +// TTimo: m_strEnginePath has a special status, if not found in registry we need to // initiliaze it for sure. It is not totally failsafe but we can use the same // code than in q3map, expecting to find some "quake" above us. If not, we prompt // for the engine executable path @@ -2777,7 +2775,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE); mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF); m_nMouseButtons = m_nMouse ? 3 : 2; - + // project file // if it's not found here, mainframe.cpp will take care of finding one mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, ""); @@ -2827,7 +2825,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE); m_bDetachableMenus = m_bLatchedDetachableMenus; - + if (g_pGameDescription->mNoPatch) { m_bPatchToolbar = false; @@ -2840,7 +2838,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE); m_bWideToolbar = m_bLatchedWideToolbar; - + mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE); m_bPluginToolbar = m_bLatchedPluginToolbar; @@ -2911,7 +2909,7 @@ void PrefsDlg::LoadPrefs () mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE); mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64); mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE); - + // Gef: Kyro GL_POINT workaround mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE); @@ -2949,11 +2947,11 @@ void PrefsDlg::LoadPrefs () // menu stuff mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0); - for(i = 0; i < 4; i++) + for(i = 0; i < 4; i++) { char buf[64]; sprintf (buf, "%s%d", FILE_KEY, i); - mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], ""); + mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], ""); } // some platform specific prefs @@ -3126,7 +3124,7 @@ void PrefsDlg::DoSensitivity() Msg += g_PrefsDlg.m_strLastProject; Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly."; gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK ); - + m_bWarn = false; } @@ -3186,14 +3184,14 @@ void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) { Sys_Printf( "OnGameSelectChanged\n" ); CGameInstall* i = static_cast( data ); - i->UpdateData( TRUE ); + i->UpdateData( TRUE ); i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) ); i->UpdateData( FALSE ); } void CGameInstall::BuildDialog() { GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox; - + dlg = m_pWidget; gtk_window_set_title( GTK_WINDOW( dlg ), "Configure games" ); @@ -3244,7 +3242,7 @@ void CGameInstall::BuildDialog() { text = gtk_label_new( "Name:" ); gtk_widget_show( text ); gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 ); - + entry = gtk_entry_new(); gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 ); @@ -3257,7 +3255,7 @@ void CGameInstall::BuildDialog() { hbox = gtk_hbox_new( FALSE, 0 ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 ); - + entry = gtk_entry_new(); gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 ); @@ -3408,7 +3406,7 @@ void CGameInstall::Run() { /* =============== CGameInstall::ScanGames -scan for active games that can be installed, based on the presence +scan for active games that can be installed, based on the presence =============== */ void CGameInstall::ScanGames() { diff --git a/radiant/preferences.h b/radiant/preferences.h index 7042aa1b..9fc92ac2 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -50,7 +50,7 @@ public: PrefTypes_t mType; void *mVal; - CPrefAssignment(char *name, PrefTypes_t Type, void *Val) + CPrefAssignment(const char *name, PrefTypes_t Type, void *Val) { mName = name; mType = Type; mVal = Val; } @@ -86,7 +86,7 @@ private: /*! store assignment in the property list if not already there */ - void PushAssignment(char *name, PrefTypes_t type, void *pV); + void PushAssignment(const char *name, PrefTypes_t type, void *pV); /*! find the xmlnode relating to the epair name @@ -95,7 +95,7 @@ private: public: CXMLPropertyBag(); - virtual ~CXMLPropertyBag() + virtual ~CXMLPropertyBag() { if (InUse()) Clear(); @@ -110,12 +110,12 @@ public: (name, type and pointer to value) this is used in UpdatePrefTree */ - void GetPref(char *name, Str *pV, char *V); - void GetPref(char *name, int *pV, int V); - void GetPref(char *name, bool *pV, bool V); - void GetPref(char *name, float *pV, float V); - void GetPref(char *name, float *pV, float* V); - void GetPref(char *name, window_position_t* pV, window_position_t V); + void GetPref(const char *name, Str *pV, const char *V); + void GetPref(const char *name, int *pV, int V); + void GetPref(const char *name, bool *pV, bool V); + void GetPref(const char *name, float *pV, float V); + void GetPref(const char *name, float *pV, float* V); + void GetPref(const char *name, window_position_t* pV, window_position_t V); /*! returns whether or not the property bag is already open @@ -268,13 +268,13 @@ class CGameDialog : public Dialog CGameInstall mGameInstall; protected: - + int m_nComboSelect; ///< intermediate int value for combo in dialog box public: - /*! - those settings are saved in the global prefs file + /*! + those settings are saved in the global prefs file I'm too lazy to wrap behind protected access, not sure this needs to be public NOTE: those are preference settings. if you change them it is likely that you would have to restart the editor for them to take effect @@ -316,10 +316,10 @@ public: m_bDoGameInstall = true; // go through DoModal at least once mGameCombo = NULL; } - virtual ~CGameDialog(); + virtual ~CGameDialog(); void AddPacksURL( Str &s ); - + /*! intialize the game dialog, called at CPrefsDlg::Init will scan for games, load prefs, and do game selection dialog if needed @@ -332,7 +332,7 @@ public: void Reset(); /*! - run the dialog UI for the list of games + run the dialog UI for the list of games */ void DoGameDialog(); @@ -371,7 +371,7 @@ public: /*! read or set netrun (check file) - \param retrieve + \param retrieve if false, will check if netrun file is present and will set m_bNetRun if true, will create/erase the netrun file depending on m_bNetRun NOTE: this is not backwards, 'retrieve' means 'retrieve from settings dialog' - in terms of UI @@ -409,7 +409,7 @@ private: typedef struct { int nEntitySplit1; int nEntitySplit2; - + window_position_t position; window_position_t posEntityWnd; @@ -434,7 +434,7 @@ typedef struct { class PrefsDlg : public Dialog { - + public: /*! local prefs file @@ -444,10 +444,10 @@ public: // will enable/disable stuff according to the situation void DoSensitivity(); void PreModal() { DoSensitivity(); } - + // enable/disable custom editor entry void DoEditorSensitivity(); - + /*! this holds global level preferences */ @@ -456,7 +456,7 @@ protected: // warning about old project files bool m_bWarn; list mGames; - + public: // last light intensity used in the CLightPrompt dialog, stored in registry int m_iLastLightIntensity; @@ -468,15 +468,15 @@ public: /*! Preference notebook page numbers */ enum {PTAB_FRONT = 0, PTAB_GAME_SETTINGS, PTAB_2D, PTAB_CAMERA, PTAB_TEXTURE, PTAB_LAYOUT, PTAB_MOUSE, PTAB_EDITING, PTAB_STARTUP, PTAB_PATHS, PTAB_MISC, PTAB_BSPMONITOR} pref_tabs; - + GtkWidget *notebook; - + void UpdateTextureCompression(); #ifdef ATIHACK_812 void UpdateATIHack(); #endif - + void LoadPrefs(); void SavePrefs(); void LoadTexdefPref(texdef_t* pTexdef, char* pName); @@ -533,7 +533,7 @@ public: // path to the project loaded at startup // if g_PrefsDlg can't find the information in the ini file // it will try to guess and eventually ask the user - Str m_strLastProject; + Str m_strLastProject; /*! version of last loaded project file says -1 if there's no version loaded @@ -624,7 +624,7 @@ public: bool m_bRunQuake; // store prefs setting for automatic sleep mode activation bool m_bDoSleep; - + bool m_bClipCaulk; // make the texture increments match the grid changes @@ -673,7 +673,7 @@ public: int m_nTextureCompressionFormat; int m_nLightRadiuses; - + bool m_bQ3Map2Texturing; #ifdef ATIHACK_812 diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 71bb374b..418e9b33 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -27,7 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include -#include +#include +#include #include "gtkmisc.h" #if defined (__linux__) || defined (__APPLE__) #include @@ -103,7 +104,7 @@ void WINAPI QE_CheckOpenGLForErrors(void) if (i != GL_NO_ERROR) { if (i == GL_OUT_OF_MEMORY) - { + { sprintf(strMsg, "OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString((GLenum)i)); if (gtk_MessageBox(g_pParentWnd->m_pWidget, strMsg, "Radiant Error", MB_YESNO) == IDYES) { @@ -441,7 +442,7 @@ xmlDocPtr ParseXMLFile(const char* filename, bool validate = false) FileStream stream; if (stream.Open(filename, "r")) return ParseXMLStream(&stream, validate); - + Sys_FPrintf(SYS_ERR, "Failed to open file: %s\n",filename); return NULL; } @@ -493,7 +494,7 @@ void ReplaceTemplates(char* w, const char* r) r++; p = "$"; } - + while(*p!='\0') *w++ = *p++; } else *w++ = *r++; @@ -548,7 +549,7 @@ bool QE_LoadProject (const char *projectfile) } xmlFreeDoc(doc); - + // project file version checking // add a version checking to avoid people loading later versions of the project file and bitching int ver = IntForKey( g_qeglobals.d_project_entity, "version" ); @@ -563,7 +564,7 @@ bool QE_LoadProject (const char *projectfile) g_PrefsDlg.SavePrefs(); return false; } - + // set here some default project settings you need if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 ) { @@ -581,7 +582,7 @@ bool QE_LoadProject (const char *projectfile) // don't forget to create the dirs Q_mkdir(g_qeglobals.m_strHomeGame.GetBuffer(), 0775); Q_mkdir(g_qeglobals.m_strHomeMaps.GetBuffer(), 0775); - + // usefull for the log file and debuggin fucked up configurations from users: // output the basic information of the .qe4 project file // SPoG @@ -596,22 +597,22 @@ bool QE_LoadProject (const char *projectfile) if (ValueForKey(g_qeglobals.d_project_entity, "user_project")[0] == '\0') { Sys_Printf("Loaded a template project file\n"); - + // create the user_project key SetKeyValue( g_qeglobals.d_project_entity, "user_project", "1" ); - + // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=672 if (IntForKey( g_qeglobals.d_project_entity, "version" ) != PROJECT_VERSION) { char strMsg[2048]; - sprintf(strMsg, + sprintf(strMsg, "The template project '%s' has version %d. The editor binary is configured for version %d.\n" "This indicates a problem in your setup. See http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=672\n" "I will keep going with this project till you fix this", projectfile, IntForKey( g_qeglobals.d_project_entity, "version" ), PROJECT_VERSION); gtk_MessageBox (g_pParentWnd->m_pWidget, strMsg, "Can't load project file", MB_ICONERROR | MB_OK); } - + // create the writable project file path strcpy(buf, g_qeglobals.m_strHomeGame.GetBuffer()); strcat(buf, g_pGameDescription->mBaseGame.GetBuffer()); @@ -620,7 +621,7 @@ bool QE_LoadProject (const char *projectfile) int counter = 0; char pUser[PATH_MAX]; while (1) - { + { sprintf( pUser, "%suser%d." PROJECT_FILETYPE, buf, counter ); counter++; if (access( pUser, R_OK) != 0) @@ -632,7 +633,7 @@ bool QE_LoadProject (const char *projectfile) } // saving project will cause a save prefs g_PrefsDlg.m_strLastProject = buf; - g_PrefsDlg.m_nLastProjectVer = IntForKey( g_qeglobals.d_project_entity, "version" ); + g_PrefsDlg.m_nLastProjectVer = IntForKey( g_qeglobals.d_project_entity, "version" ); QE_SaveProject(buf); } else @@ -736,7 +737,7 @@ void ConnectEntities (void) Sys_Beep (); return; } - + target = ValueForKey (e1, "target"); if (target && target[0]) newtarg = g_strdup(target); @@ -755,7 +756,7 @@ void ConnectEntities (void) SetKeyValue(e2, "targetname", newtarg); g_free(newtarg); } - + Sys_UpdateWindows (W_XY | W_CAMERA); Select_Deselect(); @@ -804,7 +805,7 @@ void QE_InitVFS (void) // plugins, scripts and config files. // it also helps when testing maps, as you'll know your files won't/can't be used // by the game engine itself. - + // directory = g_pGameDescription->mGameToolsPath; vfsInitDirectory(directory.GetBuffer()); @@ -904,13 +905,13 @@ void QE_CountBrushesAndUpdateStatusBar( void ) { static int s_lastbrushcount, s_lastentitycount; static qboolean s_didonce; - + //entity_t *e; brush_t *b, *next; g_numbrushes = 0; g_numentities = 0; - + if ( active_brushes.next != NULL ) { for ( b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next) @@ -955,9 +956,9 @@ I_FloatTime double I_FloatTime (void) { time_t t; - + time (&t); - + return t; #if 0 // more precise, less portable @@ -966,13 +967,13 @@ double I_FloatTime (void) static int secbase; gettimeofday(&tp, &tzp); - + if (!secbase) { secbase = tp.tv_sec; return tp.tv_usec/1000000.0; } - + return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0; #endif } @@ -992,10 +993,10 @@ char *COM_Parse (char *data) len = 0; com_token[0] = 0; - + if (!data) return NULL; - + // skip whitespace skipwhite: while ( (c = *data) <= ' ') @@ -1007,7 +1008,7 @@ skipwhite: } data++; } - + // skip // comments if (c=='/' && data[1] == '/') { @@ -1015,7 +1016,7 @@ skipwhite: data++; goto skipwhite; } - + // handle quoted strings specially if (c == '\"') @@ -1053,7 +1054,7 @@ skipwhite: if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':') break; } while (c>32); - + com_token[len] = 0; return data; } @@ -1103,7 +1104,7 @@ void ParseCommandLine (char *lpCmdLine) *lpCmdLine = 0; lpCmdLine++; } - + } } } @@ -1118,7 +1119,7 @@ Checks for the given parameter in the program's command line arguments Returns the argument number (1 to argc-1) or 0 if not present ================= */ -int CheckParm (char *check) +int CheckParm (const char *check) { int i; @@ -1139,7 +1140,7 @@ int CheckParm (char *check) ParseNum / ParseHex ============== */ -int ParseHex (char *hex) +int ParseHex (const char *hex) { char *str; int num; @@ -1165,7 +1166,7 @@ int ParseHex (char *hex) } -int ParseNum (char *str) +int ParseNum (const char *str) { if (str[0] == '$') return ParseHex (str+1); @@ -1292,7 +1293,7 @@ void Sys_Beep (void) #if defined (__linux__) || defined (__APPLE__) gdk_beep (); #else - MessageBeep (MB_ICONASTERISK); + MessageBeep (MB_ICONASTERISK); #endif } @@ -1462,7 +1463,7 @@ FILE DIALOGS ====================================================================== */ - + qboolean ConfirmModified () { if (!modified) @@ -1478,10 +1479,10 @@ void ProjectDialog () const char *filename; char buffer[NAME_MAX]; - /* - * Obtain the system directory name and - * store it in buffer. - */ + /* + * Obtain the system directory name and + * store it in buffer. + */ strcpy(buffer, g_qeglobals.m_strHomeGame.GetBuffer()); strcat(buffer, g_pGameDescription->mBaseGame.GetBuffer()); @@ -1498,7 +1499,7 @@ void ProjectDialog () if (!QE_LoadProject(filename)) Sys_Printf ("Failed to load project from file: %s\n", filename); else - // FIXME TTimo QE_Init is probably broken if you don't call it during startup right now .. + // FIXME TTimo QE_Init is probably broken if you don't call it during startup right now .. QE_Init(); } @@ -1574,7 +1575,7 @@ void FillBSPMenu () { if (strncmp(ep->key, "bsp_", 4)==0) { - bsp_commands[i] = ep->key; + bsp_commands[i] = ep->key; item = gtk_menu_item_new_with_label (ep->key+4); gtk_widget_show (item); gtk_container_add (GTK_CONTAINER (menu), item); @@ -1653,7 +1654,7 @@ void Sys_LogFile (void) // the file handle is g_qeglobals.hLogFile // the log file is erased Str name; - name = g_strTempPath; + name = g_strTempPath; name += "radiant.log"; #if defined (__linux__) || defined (__APPLE__) g_qeglobals.hLogFile = open( name.GetBuffer(), O_TRUNC | O_CREAT | O_WRONLY, S_IREAD | S_IWRITE ); @@ -1701,7 +1702,7 @@ void Sys_ClearPrintf (void) extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) { char buf[BUFFER_SIZE]; - + buf[0] = 0; vsnprintf( buf, BUFFER_SIZE, text, args ); buf[BUFFER_SIZE-1] = 0; @@ -1721,7 +1722,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) { // TTimo: FIXME: killed the console to avoid GDI leak fuckup if ( g_qeglobals_gui.d_edit != NULL ) { GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_qeglobals_gui.d_edit)); - + GtkTextIter iter; gtk_text_buffer_get_end_iter(buffer, &iter); @@ -1764,7 +1765,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) { gtk_grab_remove(g_qeglobals_gui.d_edit); } } - } + } } // NOTE: this is the handler sent to synapse diff --git a/radiant/qe3.h b/radiant/qe3.h index e1b9d2bc..c4412cbd 100644 --- a/radiant/qe3.h +++ b/radiant/qe3.h @@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "qgl.h" #include +#include #include #include @@ -141,11 +142,11 @@ vec_t Rad_rint (vec_t in); double I_FloatTime (void); -void Error (char *error, ...); -int CheckParm (char *check); +void Error (const char *error, ...); +int CheckParm (const char *check); void ParseCommandLine (char *lpCmdLine); -int ParseNum (char *str); +int ParseNum (const char *str); char* COM_Parse (char *data); char* Get_COM_Token(); @@ -273,7 +274,7 @@ bool read_var (const char *filename, const char *section, const char *key, char // entityw.c // void FillClassList (void); -bool UpdateEntitySel(eclass_t *pec); +bool UpdateEntitySel(eclass_t *pec); void SetInspectorMode(int iType); void SetSpawnFlags(void); void GetSpawnFlags(void); @@ -367,7 +368,7 @@ qboolean IsBrushSelected(brush_t* bSel); // curve brushes -void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom, +void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom, qboolean s1, qboolean s2, qboolean s3, qboolean s4); void Curve_Invert (void); @@ -387,7 +388,7 @@ patchMesh_t* MakeNewPatch(); brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true); brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false); //void Patch_ReadFile (char *name); -//void Patch_WriteFile (char *name); +//void Patch_WriteFile (char *name); void Patch_BuildPoints (brush_t *b); void Patch_Move(patchMesh_t *p, const vec3_t vMove, bool bRebuild = false); //++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp) @@ -571,7 +572,7 @@ qboolean IsBrushPrimitMode(); // // eclass.cpp // -#include "ieclass.h" +#include "ieclass.h" /*! \todo those are at the eclass manager level, but some documentation about what they do will be helpful @@ -589,7 +590,7 @@ eclass_t** Get_EClass_E(); void Set_Eclass_Found(qboolean); qboolean Get_Parsing_Single(); -// .def loading, builtin module +// .def loading, builtin module #include "eclass_def.h" extern CSynapseBuiltinClientDef eclass_def; @@ -605,7 +606,7 @@ support for one additional/optional entity format extern bool g_bHaveEClassExt; extern _EClassTable g_EClassExtTable; - + #include "iplugin.h" // for interfaces, we require main plugin header included #include "qerplugin.h" diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 0d7e54c1..7d858949 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -33,14 +33,15 @@ Clean up texture menu. */ #ifdef _WIN32 -//#include -#include +//#include +#include #endif #if defined (__linux__) || defined (__APPLE__) #include #include #endif #include +#include #include #include #include "stdafx.h" @@ -521,10 +522,10 @@ void BuildShaderList() { GSList *tmp; bool found = false; - + // each token should be a shader filename sprintf(dirstring, "%s.shader", token); - + for (tmp = l_shaderfiles; tmp != NULL; tmp = tmp->next) { if (!strcmp (dirstring, (char*)tmp->data)) @@ -534,7 +535,7 @@ void BuildShaderList() break; } } - + if (!found) { l_shaderfiles = g_slist_append (l_shaderfiles, strdup (dirstring)); @@ -570,9 +571,6 @@ void FillTextureMenu (GSList** pArray) GSList *texdirs_tmp = NULL; GSList *p; char dirRoot[NAME_MAX]; - // this is an index used to count the number of texture items (for splitting/avoiding to get out of window) - // we start with a != 0 value to compensate for the initial number of items in the texture menu - int nMenuCount = 12; // delete everything menu = GTK_WIDGET (g_object_get_data (G_OBJECT (g_qeglobals_gui.d_main_window), "menu_textures")); @@ -763,11 +761,11 @@ void Texture_ShowDirectory () // if a texture is already in use to represent a shader, ignore it // need this function "GSList *lst SynapseServer::GetMinorList(char *major_name);" - + sprintf (dirstring, "textures/%s", texture_directory); g_ImageManager.BeginExtensionsScan(); const char* ext; - while(ext=g_ImageManager.GetNextExtension()) + while((ext=g_ImageManager.GetNextExtension()) != NULL) { files = g_slist_concat(files, vfsGetFileList (dirstring, ext)); } @@ -863,9 +861,9 @@ void Texture_ResetPosition() q = current_texture; // if the current texture never found (because // 'show shaders' is off, // for example), do nothing - if (!q) + if (!q) break; - + int nHeight = (int)(q->height * ((float)g_PrefsDlg.m_nTextureScale / 100)); // we have found when texdef->name and the shader name match // NOTE: as everywhere else for our comparisons, we are not case sensitive @@ -877,7 +875,7 @@ void Texture_ResetPosition() break; } // if the bottom of our selected texture will fit with origin 0, use that - // to prevent scrolling uglyness (stuff scrolled off screen when + // to prevent scrolling uglyness (stuff scrolled off screen when // everything would fit) if ( -(y -nHeight-2*FONT_HEIGHT) < g_qeglobals.d_texturewin.height) { g_qeglobals.d_texturewin.originy = 0; @@ -1372,7 +1370,7 @@ void SelectTexture (int mx, int my, bool bShift, bool bFitScale) return; } } - + Sys_Status("Did not select a texture", 0); } diff --git a/radiant/undo.cpp b/radiant/undo.cpp index 41bad9d8..104ccd1e 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -239,7 +239,7 @@ void Undo_GeneralStart(char *operation) } undo = (undo_t *) malloc(sizeof(undo_t)); - if (!undo) + if (!undo) return; memset(undo, 0, sizeof(undo_t)); undo->brushlist.next = &undo->brushlist; @@ -253,7 +253,7 @@ void Undo_GeneralStart(char *operation) undo->prev = g_lastundo; undo->next = NULL; g_lastundo = undo; - + undo->time = Sys_DoubleTime(); // if (g_undoId > g_undoMaxSize * 2) g_undoId = 1; @@ -335,7 +335,7 @@ int Undo_EntityInUndo(undo_t *undo, entity_t *ent) Undo_Start ============= */ -void Undo_Start(char *operation) +void Undo_Start(const char *operation) { // spog - disable undo if undo levels = 0 if (g_PrefsDlg.m_nUndoLevels == 0) @@ -345,7 +345,7 @@ void Undo_Start(char *operation) #endif return; } - + Undo_ClearRedo(); Undo_GeneralStart(operation); } @@ -365,7 +365,7 @@ void Undo_AddBrush(brush_t *pBrush) #endif return; } - + if (!g_lastundo) { Sys_Printf("Undo_AddBrushList: no last undo.\n"); @@ -409,7 +409,7 @@ void Undo_AddBrushList(brush_t *brushlist) #endif return; } - + brush_t *pBrush; if (!g_lastundo) @@ -461,7 +461,7 @@ void Undo_EndBrush(brush_t *pBrush) #endif return; } - + if (!g_lastundo) { @@ -491,7 +491,7 @@ void Undo_EndBrushList(brush_t *brushlist) #endif return; } - + if (!g_lastundo) { @@ -524,7 +524,7 @@ void Undo_AddEntity(entity_t *entity) #endif return; } - + entity_t* pClone; @@ -604,7 +604,7 @@ void Undo_End(void) #endif return; } - + if (!g_lastundo) { @@ -642,7 +642,7 @@ void Undo_Undo(boolean bSilent) Sys_Printf("Undo_Undo: undo is disabled.\n"); return; } - + undo_t *undo, *redo; brush_t *pBrush, *pNextBrush; entity_t *pEntity, *pNextEntity, *pUndoEntity; @@ -802,7 +802,7 @@ void Undo_Undo(boolean bSilent) g_undoId--; if (g_undoId <= 0) g_undoId = 2 * g_undoMaxSize; // - g_bScreenUpdates = true; + g_bScreenUpdates = true; UpdateSurfaceDialog(); Sys_UpdateWindows(W_ALL); } @@ -934,7 +934,7 @@ void Undo_Redo(void) // free the undo free(redo); // - g_bScreenUpdates = true; + g_bScreenUpdates = true; UpdateSurfaceDialog(); Sys_UpdateWindows(W_ALL); } diff --git a/radiant/undo.h b/radiant/undo.h index 5973202a..da91c2f2 100644 --- a/radiant/undo.h +++ b/radiant/undo.h @@ -23,10 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // // QERadiant Multilevel Undo/Redo // -// +// //start operation -void Undo_Start(char *operation); +void Undo_Start(const char *operation); //end operation void Undo_End(void); //add brush to the undo diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index b24cdc80..0ac6c974 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "stdafx.h" #include +#include #include #include @@ -140,7 +141,7 @@ void WXY_Print () img = (unsigned char*)malloc (width*height*3); qglReadPixels (0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,img); - FILE *fp; + FILE *fp; fp = fopen(filename, "wb"); if (fp) { @@ -179,7 +180,7 @@ void WXY_Print () unsigned long widthDW = (((width*24) + 31) / 32 * 4); long row, row_size = width*3; - for (row = 0; row < height; row++) + for (row = 0; row < height; row++) { unsigned char* buf = img+row*row_size; @@ -191,7 +192,7 @@ void WXY_Print () putc(buf[col+1], fp); putc(buf[col], fp); } - byteswritten += row_size; + byteswritten += row_size; unsigned long count; for (count = row_size; count < widthDW; count++) @@ -223,7 +224,7 @@ float Betwixt(float f1, float f2) void CleanList(brush_t* pList) { - brush_t* pBrush = pList->next; + brush_t* pBrush = pList->next; while (pBrush != NULL && pBrush != pList) { brush_t* pNext = pBrush->next; @@ -234,7 +235,7 @@ void CleanList(brush_t* pList) void Brush_CopyList (brush_t* pFrom, brush_t* pTo) { - brush_t* pBrush = pFrom->next; + brush_t* pBrush = pFrom->next; while (pBrush != NULL && pBrush != pFrom) { brush_t* pNext = pBrush->next; @@ -288,7 +289,7 @@ void DrawPathLines (void) { return; } - + num_entities = 0; for (te = entities.next ; te != &entities && num_entities != MAX_MAP_ENTITIES ; te = te->next) { @@ -299,53 +300,53 @@ void DrawPathLines (void) num_entities++; } } - + for (se = entities.next ; se != &entities ; se = se->next) { psz = ValueForKey(se, "targetname"); - + if (psz == NULL || psz[0] == '\0') continue; - + sb = se->brushes.onext; if (sb == &se->brushes) continue; - + for (k=0 ; kbrushes.onext; if (tb == &te->brushes) continue; - + for (i=0 ; i<3 ; i++) - mid[i] = (sb->mins[i] + sb->maxs[i])*0.5; - + mid[i] = (sb->mins[i] + sb->maxs[i])*0.5; + for (i=0 ; i<3 ; i++) - mid1[i] = (tb->mins[i] + tb->maxs[i])*0.5; - + mid1[i] = (tb->mins[i] + tb->maxs[i])*0.5; + VectorSubtract (mid1, mid, dir); len = VectorNormalize (dir, dir); s1[0] = -dir[1]*8 + dir[0]*8; s2[0] = dir[1]*8 + dir[0]*8; s1[1] = dir[0]*8 + dir[1]*8; s2[1] = -dir[0]*8 + dir[1]*8; - + qglColor3f (se->eclass->color[0], se->eclass->color[1], se->eclass->color[2]); - + qglBegin(GL_LINES); qglVertex3fv(mid); qglVertex3fv(mid1); - + arrows = (int)(len / 256) + 1; - + for (i=0 ; inext != pList) { Brush_CopyList(pList, &hold_brushes); @@ -893,7 +894,7 @@ void XYWnd::SetClipMode(bool bMode) CleanList(&g_brBackSplits); g_brFrontSplits.next = &g_brFrontSplits; g_brBackSplits.next = &g_brBackSplits; - + // ydnar: set clipper points based on first selected patch mesh if( selected_brushes.next != &selected_brushes ) { @@ -912,7 +913,7 @@ void XYWnd::SetClipMode(bool bMode) break; } } - + if( found ) { // SetClipMode( true ); @@ -962,9 +963,9 @@ void XYWnd::SetPointMode(bool b) g_nPointCount = 0; } -void XYWnd::SetViewType(int n) -{ - m_nViewType = n; +void XYWnd::SetViewType(int n) +{ + m_nViewType = n; if (g_pParentWnd->CurrentStyle() == MainFrame::eFloating) { char* str = "YZ Side"; @@ -1003,7 +1004,7 @@ bool XYWnd::SetRotateMode(bool bMode) Select_GetTrueMid(g_vRotateOrigin); g_vRotation[0] = g_vRotation[1] = g_vRotation[2] = 0.0; } - else + else { if (bMode) Sys_Printf("Need a brush selected to turn on Mouse Rotation mode\n"); @@ -1045,7 +1046,7 @@ void update_xor_rectangle_xy(XORRectangle& xor_rectangle) xor_rectangle.set(rectangle); } -void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy) +void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy) { // plugin entities // TODO TTimo handle return code @@ -1108,9 +1109,9 @@ void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy) g_strStatus.Format("x:: %.1f y:: %.1f z:: %.1f", tdp[0], tdp[1], tdp[2]); g_pParentWnd->SetStatusText(1, g_strStatus); - // i need to generalize the point code.. having 3 flavors pretty much sucks.. - // once the new curve stuff looks like it is going to stick i will - // rationalize this down to a single interface.. + // i need to generalize the point code.. having 3 flavors pretty much sucks.. + // once the new curve stuff looks like it is going to stick i will + // rationalize this down to a single interface.. if (PointMode()) { if (g_pMovingPoint && HasCapture ()) @@ -1209,7 +1210,7 @@ void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy) XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags); } } - else + else { XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags); } @@ -1244,7 +1245,7 @@ void XYWnd::OnMouseWheel(bool bUp) g_pParentWnd->OnTimer (); } -void XYWnd::OnTimer () +void XYWnd::OnTimer () { int nDim1 = (m_nViewType == YZ) ? 1 : 0; int nDim2 = (m_nViewType == XY) ? 1 : 2; @@ -1258,7 +1259,7 @@ void XYWnd::OnTimer () XY_MouseMoved (m_ptDragX, m_nHeight - 1 - m_ptDragY , m_nScrollFlags); } -void XYWnd::OnLButtonDown(guint32 flags, int pointx, int pointy) +void XYWnd::OnLButtonDown(guint32 flags, int pointx, int pointy) { g_pParentWnd->SetActiveXY(this); UndoCopy(); @@ -1283,14 +1284,14 @@ void XYWnd::OnMButtonDown(guint32 flags, int pointx, int pointy) OriginalButtonDown(flags, pointx, pointy); } -void XYWnd::OnRButtonDown(guint32 flags, int pointx, int pointy) +void XYWnd::OnRButtonDown(guint32 flags, int pointx, int pointy) { g_pParentWnd->SetActiveXY(this); m_ptDownX = pointx; m_ptDownY = pointy; m_bRButtonDown = true; - if (g_PrefsDlg.m_nMouseButtons == 3) // 3 button mouse + if (g_PrefsDlg.m_nMouseButtons == 3) // 3 button mouse { if (flags & MK_CONTROL) { @@ -1360,7 +1361,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) VectorClear(point); XY_ToPoint (x, y, point); - + VectorCopy (point, origin); VectorClear (dir); @@ -1368,20 +1369,20 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) { origin[2] = g_MaxWorldCoord; dir[2] = -1; - right[0] = 1 / m_fScale; - right[1] = 0; + right[0] = 1 / m_fScale; + right[1] = 0; right[2] = 0; - up[0] = 0; + up[0] = 0; up[1] = 1 / m_fScale; up[2] = 0; } - else if (m_nViewType == XZ) + else if (m_nViewType == XZ) { origin[1] = g_MinWorldCoord; // view facing dir = positive Y dir[1] = 1; right[0] = 1 / m_fScale; right[1] = 0; - right[2] = 0; + right[2] = 0; up[0] = 0; up[1] = 0; up[2] = 1 / m_fScale; @@ -1391,8 +1392,8 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) origin[0] = g_MaxWorldCoord; dir[0] = -1; right[0] = 0; - right[1] = 1 / m_fScale; - right[2] = 0; + right[1] = 1 / m_fScale; + right[2] = 0; up[0] = 0; up[1] = 0; up[2] = 1 / m_fScale; @@ -1408,7 +1409,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) || (buttons == (MK_LBUTTON | MK_SHIFT)) || (buttons == (MK_LBUTTON | MK_CONTROL)) || (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) ) - { + { Patch_SetView( (m_nViewType == XY) ? W_XY : (m_nViewType == YZ) ? W_YZ : W_XZ); Drag_Begin (x, y, buttons, right, up, origin, dir); return; @@ -1418,7 +1419,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) // control mbutton = move camera if (m_nButtonstate == (MK_CONTROL|nMouseButton) ) - { + { VectorCopyXY(point, g_pParentWnd->GetCamWnd()->Camera()->origin); Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); } @@ -1426,7 +1427,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons) // mbutton = angle camera if ((g_PrefsDlg.m_nMouseButtons == 3 && m_nButtonstate == MK_MBUTTON) || (g_PrefsDlg.m_nMouseButtons == 2 && m_nButtonstate == (MK_SHIFT|MK_CONTROL|MK_RBUTTON))) - { + { VectorSubtract (point, g_pParentWnd->GetCamWnd()->Camera()->origin, point); int n1 = (m_nViewType == XY) ? 1 : 2; @@ -1554,7 +1555,7 @@ void XYWnd::HandleDrop() */ create_menu_item_with_mnemonic (menu, "Ungroup Entity", GTK_SIGNAL_FUNC (HandleCommand), ID_SELECTION_UNGROUPENTITY); - + create_menu_item_with_mnemonic (menu, "Move into entity", GTK_SIGNAL_FUNC (HandleCommand), ID_SELECTION_MERGE); create_menu_item_with_mnemonic (menu, "Move into worldspawn", @@ -1611,7 +1612,7 @@ void XYWnd::HandleDrop() submenu_root = NULL; } strActive = strLeft; - + submenu = gtk_menu_new (); submenu_root = submenu; item = gtk_menu_item_new_with_label (strName); @@ -1636,7 +1637,7 @@ void XYWnd::HandleDrop() submenu_root = NULL; } strActive = ""; - + item = gtk_menu_item_new_with_label (strName); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (HandleCommand), GINT_TO_POINTER (nID++)); @@ -1667,7 +1668,7 @@ void XYWnd::NewBrushDrag (int x, int y) // delete the current selection if (selected_brushes.next != &selected_brushes) Brush_Free (selected_brushes.next); - + SnapToPoint (m_nPressx, m_nPressy, mins); int nDim = (m_nViewType == XY) ? 2 : (m_nViewType == YZ) ? 0 : 1; @@ -1861,7 +1862,7 @@ void XYWnd::XY_MouseMoved (int x, int y, int buttons) g_pParentWnd->OnViewZoomout (); else g_pParentWnd->OnViewZoomin (); - + Sys_SetCursorPos (m_ptCursorX, m_ptCursorY); } } @@ -1900,7 +1901,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy) g_Clip1.m_ptScreenX = pointx; g_Clip1.m_ptScreenY = pointy; } - else + else if (g_Clip2.Set() == false) { pPt = g_Clip2; @@ -1908,7 +1909,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy) g_Clip2.m_ptScreenX = pointx; g_Clip2.m_ptScreenY = pointy; } - else + else if (g_Clip3.Set() == false) { pPt = g_Clip3; @@ -1916,7 +1917,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy) g_Clip3.m_ptScreenX = pointx; g_Clip3.m_ptScreenY = pointy; } - else + else { RetainClipMode(true); pPt = g_Clip1; @@ -2045,7 +2046,7 @@ void XYWnd::PlanePointsFromClipPoints(vec3_t planepts[3], brush_t *pBrush) int n = (g_pParentWnd->ActiveXY()->GetViewType() == XY) ? 2 : (g_pParentWnd->ActiveXY()->GetViewType() == YZ) ? 0 : 1; int x = (n == 0) ? 1 : 0; int y = (n == 2) ? 1 : 2; - + if (n == 1) // on viewtype XZ, flip clip points { planepts[0][n] = pBrush->maxs[n]; @@ -2069,7 +2070,7 @@ void XYWnd::ProduceSplitLists() { bool bCaulk = false; int nFlags; - + if (AnyPatchesSelected()) { Sys_Printf("Deselecting patches for clip operation.\n"); @@ -2087,7 +2088,7 @@ void XYWnd::ProduceSplitLists() // ydnar: update the window if any patches are selected Sys_UpdateWindows( XY | W_CAMERA_IFON ); } - + CleanList(&g_brFrontSplits); CleanList(&g_brBackSplits); g_brFrontSplits.next = &g_brFrontSplits; @@ -2099,7 +2100,7 @@ void XYWnd::ProduceSplitLists() { brush_t* pFront = NULL; brush_t* pBack = NULL; - + face_t face; memset(&face,0,sizeof(face_t)); PlanePointsFromClipPoints(face.planepts, pBrush); @@ -2123,7 +2124,7 @@ void XYWnd::ProduceSplitLists() Brush_AddToList(pBack, &g_brBackSplits); if (pFront) Brush_AddToList(pFront, &g_brFrontSplits); - + } } } @@ -2358,16 +2359,16 @@ void XYWnd::XY_DrawGrid() if (!g_qeglobals.d_savedinfo.show_axis) { qglRasterPos2f ( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale ); - + char cView[20]; if (m_nViewType == XY) strcpy(cView, "XY Top"); - else + else if (m_nViewType == XZ) strcpy(cView, "XZ Front"); else strcpy(cView, "YZ Side"); - + gtk_glwidget_print_string(cView); } } @@ -2478,7 +2479,7 @@ void XYWnd::XY_DrawBlockGrid() qglLineWidth (2); qglBegin (GL_LINES); - + for (x=xb ; x<=xe ; x+=g_qeglobals.blockSize) { qglVertex2f (x, yb); @@ -2493,7 +2494,7 @@ void XYWnd::XY_DrawBlockGrid() qglVertex2f (xe, y); } } - + qglEnd (); qglLineWidth (1); @@ -2602,7 +2603,7 @@ void XYWnd::DrawCameraIcon() qglVertex3f (x-box,y,0); qglVertex3f (x+box,y,0); qglEnd (); - + qglBegin(GL_LINE_STRIP); qglVertex3f (x+fov*cos(a+Q_PI/4), y+fov*sin(a+Q_PI/4), 0); qglVertex3f (x, y, 0); @@ -2650,7 +2651,7 @@ void XYWnd::DrawZIcon (void) } } -// can be greatly simplified but per usual i am in a hurry +// can be greatly simplified but per usual i am in a hurry // which is not an excuse, just a fact void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds) { @@ -2662,7 +2663,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo vec3_t vSize; VectorSubtract(vMaxBounds, vMinBounds, vSize); - qglColor3f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] * .65, + qglColor3f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] * .65, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] * .65, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] * .65); @@ -2678,14 +2679,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglVertex3f(vMaxBounds[nDim1], vMinBounds[nDim2] - 6.0f / m_fScale, 0.0f); qglVertex3f(vMaxBounds[nDim1], vMinBounds[nDim2] - 10.0f / m_fScale, 0.0f); - + qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, vMinBounds[nDim2], 0.0f); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2], 0.0f); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2], 0.0f); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2], 0.0f); - + qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, vMaxBounds[nDim2], 0.0f); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2], 0.0f); @@ -2694,7 +2695,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglRasterPos3f (Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0 / m_fScale, 0.0f); g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); - + qglRasterPos3f (vMaxBounds[nDim1] + 16.0 / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2]), 0.0f); g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); @@ -2715,14 +2716,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglVertex3f(vMaxBounds[nDim1], 0,vMinBounds[nDim2] - 6.0f / m_fScale); qglVertex3f(vMaxBounds[nDim1], 0,vMinBounds[nDim2] - 10.0f / m_fScale); - + qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, 0,vMinBounds[nDim2]); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMinBounds[nDim2]); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMinBounds[nDim2]); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMaxBounds[nDim2]); - + qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, 0,vMaxBounds[nDim2]); qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMaxBounds[nDim2]); @@ -2731,7 +2732,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglRasterPos3f (Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), 0, vMinBounds[nDim2] - 20.0 / m_fScale); g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); - + qglRasterPos3f (vMaxBounds[nDim1] + 16.0 / m_fScale, 0, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2])); g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); @@ -2752,14 +2753,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglVertex3f(0, vMaxBounds[nDim1], vMinBounds[nDim2] - 6.0f / m_fScale); qglVertex3f(0, vMaxBounds[nDim1], vMinBounds[nDim2] - 10.0f / m_fScale); - + qglVertex3f(0, vMaxBounds[nDim1] + 6.0f / m_fScale, vMinBounds[nDim2]); qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2]); qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2]); qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2]); - + qglVertex3f(0, vMaxBounds[nDim1] + 6.0f / m_fScale, vMaxBounds[nDim2]); qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2]); @@ -2768,7 +2769,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo qglRasterPos3f (0, Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0 / m_fScale); g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); - + qglRasterPos3f (0, vMaxBounds[nDim1] + 16.0 / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2])); g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]); gtk_glwidget_print_string((char *) g_strDim.GetBuffer()); @@ -2839,7 +2840,7 @@ void XYWnd::XY_Draw() if (!active_brushes.next) return; // not valid yet - Patch_LODMatchAll(); // spog + Patch_LODMatchAll(); // spog if (m_bTiming) start = Sys_DoubleTime(); @@ -2924,7 +2925,7 @@ void XYWnd::XY_Draw() drawn = culled = 0; e = world_entity; - + if (m_bTiming) start2 = Sys_DoubleTime(); @@ -2933,9 +2934,9 @@ void XYWnd::XY_Draw() if (brush->bFiltered) continue; - if (brush->mins[nDim1] > maxs[0] || - brush->mins[nDim2] > maxs[1] || - brush->maxs[nDim1] < mins[0] || + if (brush->mins[nDim1] > maxs[0] || + brush->mins[nDim2] > maxs[1] || + brush->maxs[nDim1] < mins[0] || brush->maxs[nDim2] < mins[1]) { culled++; @@ -2963,7 +2964,7 @@ void XYWnd::XY_Draw() Brush_DrawXY(brush, m_nViewType); } - + if (m_bTiming) end2 = Sys_DoubleTime(); @@ -3006,9 +3007,9 @@ void XYWnd::XY_Draw() for (brush = selected_brushes.next ; brush != &selected_brushes ; brush=brush->next) { // spog - added culling of selected brushes in XY window - if (brush->mins[nDim1] > maxs[0] || - brush->mins[nDim2] > maxs[1] || - brush->maxs[nDim1] < mins[0] || + if (brush->mins[nDim1] > maxs[0] || + brush->mins[nDim2] > maxs[1] || + brush->maxs[nDim1] < mins[0] || brush->maxs[nDim2] < mins[1]) { culled++; @@ -3053,7 +3054,7 @@ void XYWnd::XY_Draw() // edge / vertex flags if (g_qeglobals.d_select_mode == sel_vertex) { - if(!g_PrefsDlg.m_bGlPtWorkaround) + if(!g_PrefsDlg.m_bGlPtWorkaround) { // brush verts qglPointSize (4); @@ -3062,7 +3063,7 @@ void XYWnd::XY_Draw() for (i=0 ; inext ) { - + } } @@ -3406,7 +3407,7 @@ void XYWnd::OnEntityCreate (const char* item) Sys_Printf("TODO: hook drop down group menu\n"); return; } - + if (strItem.Find("Smart_") >= 0) { CreateSmartEntity(this, m_ptDownX, m_ptDownY, strItem); @@ -3415,7 +3416,7 @@ void XYWnd::OnEntityCreate (const char* item) { CreateRightClickEntity(this, m_ptDownX, m_ptDownY, (char*)strItem.GetBuffer()); } - + Sys_UpdateWindows(W_ALL); //OnLButtonDown((MK_LBUTTON | MK_SHIFT), CPoint(m_ptDown.x+2, m_ptDown.y+2)); } -- 2.39.2