//
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "bkgrnd2d.h"
#include "dialog.h"
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)) {
}
strcpy(browsedir,ct);
- // make sure we have a trailing /
+ // make sure we have a trailing /
if(browsedir[strlen(browsedir) - 1] != '/')
strcat(browsedir,"/");
// 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
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);
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);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(pDialogWnd)->vbox), pNotebook, TRUE, TRUE, 0);
gtk_widget_show ( pNotebook );
-
+
gtk_widget_realize( pDialogWnd );
}
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#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
#define stricmp strcasecmp
#endif
-
+
#if defined(__cplusplus)
#ifndef _REFGUID_DEFINED
#define _REFGUID_DEFINED
class CCamera;
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "str.h"
*/
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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),
"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 "
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);
return FALSE;
}
return FALSE;
-
+
} /* AboutDlgProc */
void About()
}
}
-#endif
+#endif
*/
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
/*
vsprintf (string, format,argptr);
va_end (argptr);
- return string;
+ return string;
}
if (name != NULL)
{
- char key[32], text[32];
+ char key[32], text[32];
int i, j;
WriteIniFile (name);
#define _GENSURF_H_
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "qerplugin.h"
//#include "qertypes.h"
#define CLIP_RANGE "ClipRange"
#define CLIP "Clip"
-void InitInstance ()
+void InitInstance ()
{
#ifdef _WIN32
char fn[_MAX_PATH];
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)");
{
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
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;
}
}
break;
}
}
- }
+ }
if (!found)
{
if (strcmp (line, key) == 0)
break;
-
+
*ptr = '=';
fputs (line, rc);
}
while (fgets (line, 1024, old_rc) != NULL)
fputs (line, rc);
-
+
fclose (old_rc);
char *tmpname = g_strdup_printf ("%s.tmp", filename);
#endif
-int INIGetInt(char *key, int def)
+int INIGetInt(const char *key, int def)
{
#if defined(__linux__) || defined(__APPLE__)
char value[1024];
#endif
}
-void INISetInt(char *key, int val, char *comment /* = NULL */)
+void INISetInt(const char *key, int val, const char *comment /* = NULL */)
{
char s[1000];
//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";
}
// CSynapseClient API
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
-
+
CSynapseClientPrtView() { }
virtual ~CSynapseClientPrtView() { }
};
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);
#define __PRTVIEW_AFX_H__
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#if defined(__linux__) || defined(__APPLE__)
#include <GL/glx.h>
#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;
#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;
{
{
"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
},
#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);
#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
#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"
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
struct _QERTextureLoad // returned by a plugin
{
_QERTextureLoad()
- {
+ {
memset(reinterpret_cast<void*>(this), 0, sizeof(_QERTextureLoad));
};
// 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)();
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"
// 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
#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
// 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
// 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
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 **);
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);
vec3_t planepts[3];
texdef_t texdef;
plane_t plane;
-
+
// Nurail: Face Undo
int undoId;
int redoId;
#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;
// all are derived from brush_faces
qboolean patchBrush;
qboolean hiddenBrush;
-
+
//int nPatchID;
patchMesh_t *pPatch;
#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
IEdit *pEdit;
};
// MODEL END
-
+
typedef struct entity_s
{
struct entity_s *prev, *next;
// 5=brush->face->texdef.flags (q2)
// 6=brush->face->texdef.contents (q2)
int mask;
- char *string;
+ const char *string;
bool active;
};
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
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
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;
// 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;
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
int num_of_list_items = 0;
blank[0] = 0;
-
+
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
}
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
// 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);
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
-
+
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
-
+
IsFaceConflicting();
- PopulateTextureComboList();
+ PopulateTextureComboList();
ZeroOffsetValues();
}
{
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
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
-
+
ShowDlg();
SetTexMods ();
}
if (!g_surfwin)
return;
-
+
pt = &texturewin->texdef;
g_bListenChanged = false;
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];
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
GtkWidget* create_SurfaceInspector (void)
{
-
+
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
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);
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);
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);
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);
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);
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);
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);
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);
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);
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
-
-
+
+
return SurfaceInspector;
}
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
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;
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)
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)
}
GetTexMods();
}
-
+
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
-
+
+
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
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)
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)
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)
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)
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
int num_of_list_items = 0;
blank[0] = 0;
-
+
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
}
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
// 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);
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
-
+
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
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);
{
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
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
-
+
ShowDlg();
SetTexMods ();
}
if (!g_surfwin)
return;
-
+
pt = &texturewin->texdef;
g_bListenChanged = false;
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];
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
GtkWidget* create_SurfaceInspector (void)
{
-
+
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
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);
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);
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);
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);
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);
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);
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);
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);
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);
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
-
-
+
+
return SurfaceInspector;
}
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
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;
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)
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)
}
GetTexMods();
}
-
+
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
-
+
+
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
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)
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)
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)
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)
*/
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
user_data);
}
gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
-
+
g_free (result);
}
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
int num_of_list_items = 0;
blank[0] = 0;
-
+
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
}
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
// 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);
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
-
+
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
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);
{
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
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
-
+
ShowDlg();
SetTexMods ();
}
if (!g_surfwin)
return;
-
+
pt = &texturewin->texdef;
g_bListenChanged = false;
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];
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;
GtkWidget* create_SurfaceInspector (void)
{
-
+
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
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);
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);
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);
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);
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);
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);
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);
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);
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);
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
-
-
+
+
return SurfaceInspector;
}
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
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;
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)
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)
}
GetTexMods();
}
-
+
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
-
+
+
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
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)
}
GetTexMods();
}
-
+
}
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)
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)
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)
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)
*/
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
*/
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
// standard headers
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#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
// CSynapseClient API
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
-
+
CSynapseClientTexTool() { }
virtual ~CSynapseClientTexTool() { }
};
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);
}
int bestaxis;
float dot,best;
int i;
-
+
best = 0;
bestaxis = 0;
-
+
for (i=0 ; i<6 ; i++)
{
dot = DotProduct (pln->normal, baseaxis[i*3]);
bestaxis = i;
}
}
-
+
VectorCopy (baseaxis[bestaxis*3+1], xv);
VectorCopy (baseaxis[bestaxis*3+2], yv);
}
{
//return ShadeForNormal(p->normal);
-
+
int i;
float f;
// other
f= (lightaxis[0] + lightaxis[1] + lightaxis[2]) / 3;
return f;
-
+
}
vec3_t vecs[2];
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);
================
*/
/*!\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);
else if (td->rotate == 270)
{ sinv = -1 ; cosv = 0; }
else
- {
+ {
ang = td->rotate / 180 * Q_PI;
sinv = sin(ang);
cosv = cos(ang);
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];
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");
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);
// 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);
f->planepts[i][j] = floor (f->planepts[i][j] + 0.5);
}
}
-
+
/*
** Brush_Build
**
{
bool bLocalConvert;
-
+
#ifdef _DEBUG
if (!g_qeglobals.m_bBrushPrimitMode && bConvert)
Sys_Printf("Warning : conversion from brush primitive to old brush format not implemented\n");
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 !
}
}
-/*
+/*
=================
Brush_GetKeyValue
=================
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 );
// 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
}
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];
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;
}
b = Brush_Alloc();
-
+
// create top face
f = Face_Alloc();
f->texdef = *texdef;
//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);
// VectorSubtract(origin, p1, v2);
// CrossProduct(v1, v2, normal[2]);
//}
-
+
for (i=0; i<3; i++)
{
VectorNormalize(normal[i]);
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]);
{
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;
d1 = DotProduct (p1, dir);
*dist = d1;
-
+
// new test stuff for patches
if (!g_PrefsDlg.m_bPatchBBoxSelect && b->patchBrush)
{
// 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)
{
*dist = 0;
return NULL;
}
- }
+ }
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP)
{
if (strstr(firstface->texdef.GetName(), "clip"))
{
if (b->next || b->prev)
Error ("Brush_AddToList: already linked");
-
+
if (blist == &selected_brushes || blist == &active_brushes)
{
if (b->patchBrush && blist == &selected_brushes)
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);
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
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;
ConvertTexMatWithQTexture( brushprimit_texdef, NULL, &f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture() );
}
else
- {
+ {
if (bFitScale)
{
f->texdef = *texdef;
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)
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)
}
- // 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)
// any points on f will become new control points
for (i=0 ; i<w->numpoints ; 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;
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;
continue;
Brush_SelectFaceForDragging (b, f, shear);
- }
+ }
}
bool g_bBuildWindingsNoTexBuild = false;
if (!w)
continue;
-
+
for (i=0 ; i<w->numpoints ; i++)
{
// add to bounding box
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;
qglBegin(GL_TRIANGLE_FAN);
else
qglBegin(GL_POLYGON);
-
+
for (int i=0 ; i<w->numpoints ; i++)
{
if (nGLState & DRAW_GL_TEXTURE_2D)
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
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)
else
qglColor4fv(material);
}
-
+
// draw the polygon
Brush_FaceDraw(face, nGLState);
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))
Patch_DrawXY(b->pPatch);
if (!g_bPatchShowBounds)
return;
- }
+ }
if (b->owner->eclass->fixedsize)
{
if (face->plane.normal[1] >= 0) // stop axes being mirrored
continue;
}
- else
+ else
{
if (face->plane.normal[0] <= 0)
continue;
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)
{
{
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
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] );
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);
-
+
}
}
{ 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,
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
*/
}
#include "stdafx.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <GL/gl.h>
extern void DrawPathLines();
// 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;
g_qeglobals.bTextureCompressionSupported = 1;
g_qeglobals.m_bS3CompressionSupported = 1;
}
-
+
g_qeglobals.m_bOpenGLReady = true;
-
+
g_PrefsDlg.UpdateTextureCompression();
#ifdef ATIHACK_812
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;
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
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);
}
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;
xh = xl*2;
yl = m_Camera.height/3;
yh = yl*2;
-
+
xf *= 1.0 - fabs(yf);
if (xf < 0)
{
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 ();
widget = g_pParentWnd->m_pWidget;
window = widget->window;
}
-
+
if (m_bFreeMove)
{
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);
// 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
| 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);
}
}
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;
// 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
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];
material[3] = 1.0f;
qglColor4fv(material);
-
+
if (g_PrefsDlg.m_bNewLightDraw)
DrawLight(b->owner, nGLState, (IsBrushSelected(b)) ? g_PrefsDlg.m_nLightRadiuses : 0, 0);
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;
&& (b->owner->eclass->nShowFlags & ECLASS_ANGLE))
Brush_DrawFacingAngle(b, b->owner);
}
- }
+ }
// brushes
else
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)
break;
default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n");
}
-
+
qglDisable(GL_CULL_FACE);
Cam_DrawBrushes(DRAW_WIRE);
m_Camera.draw_glstate = DRAW_GL_WIRE;
break;
default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n");
- }
+ }
qglEnable(GL_BLEND);
//
// set up viewpoint
//
-
+
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
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]);
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];
//
Cam_DrawStuff();
-
+
qglEnableClientState(GL_VERTEX_ARRAY);
qglDisableClientState(GL_NORMAL_ARRAY);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
Brush_FaceDraw(face, DRAW_GL_FLAT);
}
}
-
+
int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0)
qglDisableClientState(GL_NORMAL_ARRAY);
qglDepthFunc (GL_LESS);
}
-
+
if (g_qeglobals.d_savedinfo.iSelectedOutlinesStyle & OUTLINE_ZBUF)
{
// non-zbuffered outline
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);
for (i=0 ; i<g_qeglobals.d_numpoints ; i++)
qglVertex3fv (g_qeglobals.d_points[i]);
qglEnd ();
-
+
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
qglVertex3fv (g_qeglobals.d_move_points[i]);
qglEnd();
}
-
+
qglPointSize (1);
}
else
for (i=0; i < g_qeglobals.d_numpoints; i++)
DrawAlternatePoint(g_qeglobals.d_points[i], 1.5);
qglEnd();
-
+
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
{
float *v1, *v2;
// GL_POINTS on Kyro Workaround
- if(!g_PrefsDlg.m_bGlPtWorkaround)
+ if(!g_PrefsDlg.m_bGlPtWorkaround)
{
qglPointSize (4);
qglColor3f (0,0,1);
brush->bCamCulled = false;
}
-void CamWnd::OnExpose ()
+void CamWnd::OnExpose ()
{
if (!MakeCurrent ())
{
{
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 ();
{
if (!MakeCurrent ())
Error ("glXMakeCurrent failed in Benchmark");
-
+
qglDrawBuffer (GL_FRONT);
double dStart = Sys_DoubleTime ();
for (int i=0 ; i < 100 ; i++)
#include "stdafx.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <stdlib.h>
#include <stdio.h>
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:
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;
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: {
#define _DIALOG_H_
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "str.h"
#include "gtkmisc.h"
Dialog ();
virtual ~Dialog ();
- /*!
+ /*!
start modal dialog box
you need to use AddModalButton to select IDOK IDCANCEL buttons
*/
#include "stdafx.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
//#include "qe3.h"
GtkWidget *g_dlgInfo;
*/
/*!
-\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
*/
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: " );
/*
va_start (argptr,error);
vsprintf (text, error,argptr);
va_end (argptr);
-
+
Error((const char *)text);
}
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"
// 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;
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);
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
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
return TRUE;
}
}
-
+
if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES )
{
if (pb->patchBrush)
return TRUE;
}
}
-
-
+
+
if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAILS )
{
if (!pb->patchBrush && pb->brush_faces->texdef.contents & CONTENTS_DETAIL )
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)
filterbrush=true;
break;
}
- // quake2 - 5 == surface flags, 6 == content flags
+ // quake2 - 5 == surface flags, 6 == content flags
}
else if (filters->attribute == 5)
{
break;
}
}
-
+
// exclude by attribute 2 (for patch) brush->pPatch->pShader->getFlags()
if (filters->active
&& filters->attribute == 2)
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;
break;
}
}
-
+
// exclude by attribute 4 brush->owner->eclass->nShowFlags
else if (filters->active
&& filters->attribute == 4)
#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);
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
GDK_GL_ATTRIB_LIST_NONE,
};
-const attribs_t configs_with_depth[] =
+const attribs_t configs_with_depth[] =
{
config_rgba32_depth32,
config_rgba32_depth24,
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;
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.
//
}
// SetSpawnFlags
-//
+//
// Update the checkboxes to reflect the flag state of the entity
//
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
if (multiple_entities)
{
brush_t *b;
-
+
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
DeleteKey (b->owner, "spawnflags");
}
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);
}
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;
SetKeyValue(edit_entity, key, value);
// refresh the prop listbox
- SetKeyValuePairs();
+ SetKeyValuePairs();
#ifdef USEPLUGINENTITIES
str = filename;
}
- gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
+ gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
AddProp();
}
}
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;
}
iType = W_GROUP;
else
iType = W_ENTITY;
- }
+ }
switch(iType)
{
}
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;
}
// 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))
{
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],
else
inspector_mode = W_GROUP;
}
-
+
if (inspector_mode == W_ENTITY)
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
else
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);
gtk_widget_show(view);
gtk_container_add(GTK_CONTAINER (scr), view);
-
+
g_object_unref(G_OBJECT(store));
EntWidgets[EntList] = view;
g_entlist_store = store;
{
// 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);
gtk_widget_show(view);
gtk_container_add(GTK_CONTAINER (scr), view);
-
+
g_object_unref(G_OBJECT(store));
EntWidgets[EntProps] = view;
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.
*/
//
#include "stdafx.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
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)
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));
}
// 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" )
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
*/
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);
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);
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);
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);
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);
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;
SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
}
}
-
+
// HACK: hardcoded wolf stuff
if (g_pGameDescription->mGameFile == "wolf.game")
{
SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
}
}
-
+
// RIANT
// STVEF HACK
if (g_pGameDescription->mGameFile == "stvef.game")
entitymap = g_slist_remove (entitymap, entitymap->data);
}
}
-
+
g_object_unref(G_OBJECT(store));
}
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);
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)
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,
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);
(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);
(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);
(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);
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);
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)
{
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;
}
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,
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);
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_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,
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_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,
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 (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);
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);
"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);
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,
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);
}
// =============================================================================
-// Command List dialog
+// Command List dialog
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 ());
if (fileout != NULL)
fclose (fileout);
}
-
+
g_object_unref(G_OBJECT(store));
}
}
// =============================================================================
-// Texture List dialog
+// Texture List dialog
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();
textures = g_slist_remove (textures, textures->data);
}
}
-
+
g_object_unref(G_OBJECT(store));
texture_list = view;
}
// =============================================================================
-// Cap dialog
+// Cap dialog
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",
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,
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);
// 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);
}
// =============================================================================
-// Scripts dialog
+// Scripts dialog
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();
fclose (f);
}
}
-
+
g_object_unref(G_OBJECT(store));
scripts_list = view;
}
// =============================================================================
-// dialog
+// dialog
int DoBSInputDlg (const char *fields[5], float values[5])
{
}
// =============================================================================
-// TextureLayout dialog
+// TextureLayout dialog
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,
}
// =============================================================================
-// Name dialog
+// Name dialog
char* DoNameDlg (const char* title)
{
}
// =============================================================================
-// NewProject dialog
+// NewProject dialog
char* DoNewProjectDlg ()
{
}
// =============================================================================
-// Text Editor dialog
+// Text Editor dialog
// master window widget
static GtkWidget *text_editor = NULL;
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)
}
}
#endif
-
+
DoGtkTextEditor (filename, cursorpos);
// old win32 code with EditPad bindings, broken
}
// =============================================================================
-// Light Intensity dialog
+// Light Intensity dialog
int DoLightIntensityDlg (int *intensity)
{
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.
*/
//
#endif
#include <gtk/gtk.h>
-
+#include <glib/gi18n.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
}
#ifdef DBG_WINDOWPOS
Sys_Printf("win32_get_window_pos %p %d,%d\n",widget,*x,*y);
-#endif
+#endif
}
#endif
return NULL;
}
- rc = fread(&g, 1, 1, fp);
+ rc = fread(&g, 1, 1, fp);
m_bytesRead++;
if (rc!=1)
{
return NULL;
}
- rc = fread(&r, 1, 1, fp);
+ rc = fread(&r, 1, 1, fp);
m_bytesRead++;
if (rc != 1)
{
return NULL;
}
- rc = fread(&dummy, 1, 1, fp);
+ rc = fread(&dummy, 1, 1, fp);
m_bytesRead++;
if (rc != 1)
{
imagebits = (unsigned char *)malloc(w * h * 3);
long row_size = w * 3;
- if (imagebits != NULL)
+ if (imagebits != NULL)
{
*width = w;
*height = h;
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)
{
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
*pp = colormap[c1].rgbGreen; pp++;
*pp = colormap[c1].rgbBlue; pp++;
}
-
+
if (c & 1)
getc(fp); // odd length run: read an extra pad byte
}
while (row < bmHeight)
{
c = getc(fp);
-
+
if (c)
{
// encoded mode
{
// c==0x00, escape codes
c = getc(fp);
-
+
if (c == 0x00) // end of line
{
row++;
*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
}
}
if (colormap)
delete [] colormap;
-
+
fclose(fp);
}
return imagebits;
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);
}
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;
}
}
// 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;
gdk_drawable_unref (mask);
return pixmap;
-}
+}
// =============================================================================
// Menu stuff
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;
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;
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;
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;
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");
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",
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",
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;
else
Sys_Printf("file_sel_callback != IDOK\n");
#endif
-
+
*loop = 0;
}
#ifdef _WIN32
#include <commdlg.h>
-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
ConstructGTKMasks();
ConstructWin32Filters();
}
-
+
filetype_t GetTypeForWin32Filter(const char *filter) const
{
for(int i=0; i<m_nTypes; i++)
delete[] *p;
delete[] m_pstrGTKMasks;
}
-
+
void ConstructGTKMasks()
{
const char *r;
Sys_Printf("Doing win32 file dialog...");
#endif
// do that the native way
- /* Place the terminating null character in the szFile. */
+ /* Place the terminating null character in the szFile. */
szFile[0] = '\0';
customfilter[0] = customfilter[1] = customfilter[2] = '\0';
-
- /* Set the members of the OPENFILENAME structure. */
- ofn.lStructSize = sizeof(OPENFILENAME);
+
+ /* Set the members of the OPENFILENAME structure. */
+ ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = (HWND)GDK_WINDOW_HWND (g_pParentWnd->m_pWidget->window);
if (pattern)
{
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)
{
}
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
if(pattern != NULL)
type = typelist.GetTypeForWin32Filter(customfilter+1);
-
+
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
// 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
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
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
-
+
if (!open)
{
#ifdef FILEDLG_DBG
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;
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 ();
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
-
+
gtk_grab_remove (file_sel);
gtk_widget_destroy (file_sel);
#ifdef _WIN32
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_
// 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);
#if defined (__linux__) || defined (__APPLE__)
#include <gdk/gdkx.h>
#include <pwd.h>
- #include <unistd.h>
+ #include <unistd.h>
#ifdef __linux__
#include <mntent.h>
#endif
#endif
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "stdafx.h"
#include <assert.h>
#include <sys/types.h>
endmntent( mountfp );
}
return(mounted);
-}
+}
#endif
-/*
+/*
This function gets the directory containing the running program.
argv0 - the 0'th argument to the program
*/
// (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;
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
#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;
_exit(-1);
}
#endif
-
+
g_qeglobals.disable_ini = false;
g_PrefsDlg.Init();
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
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
// 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')
{
{
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;
if (!hFile)
Error ("Can't write to %s", batpath);
fprintf (hFile, strSys.GetBuffer());
- fclose (hFile);
+ fclose (hFile);
#endif
Pointfile_Delete ();
0, // reserved
0, 0, 0 // layer masks ignored
}; //
- int pixelformat = 0;
+ int pixelformat = 0;
zbuffer = true;
if ( !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");
#include "stdafx.h"
#ifdef _WIN32
extern "C" {
-#include <gdk/gdkwin32.h>
+#include <gdk/gdkwin32.h>
#define COMPILE_MULTIMON_STUBS
#include <multimon.h>
}
#endif
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkprivate.h>
#include <sys/stat.h>
{"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},
void WINAPI Sys_UpdateWindows (int nBits)
{
g_nUpdateBits |= nBits;
-}
+}
// =============================================================================
// Static functions
#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;
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;
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:
// 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();
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
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?
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());
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);
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);
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)...",
return TRUE;
}
-struct monitorInfo_s {
+struct monitorInfo_s {
GdkRectangle *win_monitors;
int i_win_mon;
};
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,
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);
}
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++ ) {
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
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 ();
}
// remove the pid file
- remove (g_pidGameFile.GetBuffer ());
+ remove (g_pidGameFile.GetBuffer ());
Sys_Printf ("Entering message loop\n");
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;
if (CurrentStyle() == eSplit)
Sys_Iconify (m_pZWnd->m_pParent);
- Sys_Iconify (m_pWidget);
+ Sys_Iconify (m_pWidget);
Select_Deselect();
QERApp_FreeShaders ();
g_bScreenUpdates = false;
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)
QE_Init ();
}
-void MainFrame::OnTimer()
+void MainFrame::OnTimer()
{
GdkModifierType mask;
(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);
(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);
/*
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();
}
*/
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<gpointer>(const_cast<IToolbarButton*>(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);
}
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);
// =============================================================================
// Command handlers
-void MainFrame::OnFileNew()
+void MainFrame::OnFileNew()
{
if (ConfirmModified())
Map_New ();
}
-void MainFrame::OnFileOpen()
+void MainFrame::OnFileOpen()
{
if (!ConfirmModified())
return;
}
}
-void MainFrame::OnFileImportmap()
+void MainFrame::OnFileImportmap()
{
const char *str;
char buf[NAME_MAX];
}
}
-void MainFrame::OnFileSave()
+void MainFrame::OnFileSave()
{
if (!strcmp(currentmap, "unnamed.map"))
OnFileSaveas();
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);
}
}
-void MainFrame::OnFileExportmap()
+void MainFrame::OnFileExportmap()
{
const char* str;
char buf[NAME_MAX];
}
}
-void MainFrame::OnFileSaveregion()
+void MainFrame::OnFileSaveregion()
{
const char* str;
char buf[NAME_MAX];
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 ();
CString strProjToLoad;
CString strMapToLoad;
-
+
// if the dir exists, ask the user if they want to continue anyway
if (Q_mkdir (strNewBasePath.GetBuffer(), 0755) != 0)
{
return;
}
}
-
+
CString strDir;
strDir = strNewBasePath;
strDir += "maps/";
// 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
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();
}
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())
{
#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();
void MainFrame::OnEditPastebrushToCamera()
{
- Select_Deselect();
+ Select_Deselect();
if (ActiveXY())
{
vec3_t mid, camorigin, delta;
}
}
-void MainFrame::OnSelectionDelete()
+void MainFrame::OnSelectionDelete()
{
brush_t *brush;
//if (ActiveXY())
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;
}
}
-void MainFrame::OnEditSaveprefab()
+void MainFrame::OnEditSaveprefab()
{
const char *filename;
CString CurPath;
}
}
-void MainFrame::OnPrefs()
+void MainFrame::OnPrefs()
{
int nView = g_PrefsDlg.m_nView;
bool bToolbar = g_PrefsDlg.m_bWideToolbar;
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) ||
(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.");
}
}
-void MainFrame::OnTogglecamera()
+void MainFrame::OnTogglecamera()
{
if (CurrentStyle() == eFloating) // floating views
{
}
}
-void MainFrame::OnToggleconsole()
+void MainFrame::OnToggleconsole()
{
if (FloatingGroupDialog()) // QE4 style
{
// 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)
}
}
-void MainFrame::OnToggleview()
+void MainFrame::OnToggleview()
{
if (CurrentStyle() == eFloating) // QE4 style
{
}
}
-void MainFrame::OnToggleviewXz()
+void MainFrame::OnToggleviewXz()
{
if (CurrentStyle() == eFloating) // QE4 style
{
}
}
-void MainFrame::OnToggleviewYz()
+void MainFrame::OnToggleviewYz()
{
if (CurrentStyle() == eFloating) // QE4 style
{
}
}
-void MainFrame::OnTogglez()
+void MainFrame::OnTogglez()
{
if ( g_pParentWnd->FloatingGroupDialog() ) // QE4 style
{
}
}
-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);
}
}
}
-void MainFrame::OnViewNextview()
+void MainFrame::OnViewNextview()
{
if (CurrentStyle() == eSplit)
{
}
}
-void MainFrame::OnViewXy()
+void MainFrame::OnViewXy()
{
if(!FloatingGroupDialog())
{
Sys_UpdateWindows (W_XY);
}
-void MainFrame::OnViewSide()
+void MainFrame::OnViewSide()
{
if (!FloatingGroupDialog())
{
Sys_UpdateWindows (W_XY);
}
-void MainFrame::OnViewFront()
+void MainFrame::OnViewFront()
{
if (!FloatingGroupDialog())
{
Sys_UpdateWindows (W_XY);
}
-void MainFrame::OnView100()
+void MainFrame::OnView100()
{
if (m_pXYWnd)
m_pXYWnd->SetScale(1);
Sys_UpdateWindows (W_XY|W_XY_OVERLAY);
}
-void MainFrame::OnViewZoomin()
+void MainFrame::OnViewZoomin()
{
if (m_pXYWnd && m_pXYWnd->Active())
{
// 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())
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)
Sys_UpdateWindows (W_Z|W_Z_OVERLAY);
}
-void MainFrame::OnViewZzoomout()
+void MainFrame::OnViewZzoomout()
{
z.scale *= 4.0f/5;
if (z.scale < 0.125)
Sys_UpdateWindows (W_Z|W_Z_OVERLAY);
}
-void MainFrame::OnViewCubein()
+void MainFrame::OnViewCubein()
{
g_PrefsDlg.m_nCubicScale--;
if (g_PrefsDlg.m_nCubicScale < 1)
SetGridStatus();
}
-void MainFrame::OnViewCubeout()
+void MainFrame::OnViewCubeout()
{
g_PrefsDlg.m_nCubicScale++;
if (g_PrefsDlg.m_nCubicScale > 22)
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"));
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"));
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"));
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"));
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)
Sys_UpdateWindows(W_ALL);
}
-void MainFrame::OnViewCubicclipping()
+void MainFrame::OnViewCubicclipping()
{
GtkWidget *w;
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;
g_bIgnoreCommands--;
}
-void MainFrame::OnSelectionDragedges()
+void MainFrame::OnSelectionDragedges()
{
if (g_qeglobals.d_select_mode == sel_edge)
{
}
}
-void MainFrame::OnSelectionDragvertecies()
+void MainFrame::OnSelectionDragvertecies()
{
if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_curvepoint)
{
}
}
-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();
}
}
-void MainFrame::OnBrushFlipx()
+void MainFrame::OnBrushFlipx()
{
Undo_Start("flip X");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushFlipy()
+void MainFrame::OnBrushFlipy()
{
Undo_Start("flip Y");
Undo_AddBrushList(&selected_brushes);
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);
Undo_End();
}
-void MainFrame::OnBrushRotatex()
+void MainFrame::OnBrushRotatex()
{
Undo_Start("rotate X");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushRotatey()
+void MainFrame::OnBrushRotatey()
{
Undo_Start("rotate Y");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushRotatez()
+void MainFrame::OnBrushRotatez()
{
Undo_Start("rotate Z");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionArbitraryrotation()
+void MainFrame::OnSelectionArbitraryrotation()
{
Undo_Start("arbitrary rotation");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectScale()
+void MainFrame::OnSelectScale()
{
Undo_Start("scale");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionMakehollow()
+void MainFrame::OnSelectionMakehollow()
{
//if (ActiveXY())
// ActiveXY()->UndoCopy();
Undo_End();
}
-void MainFrame::OnSelectionCsgsubtract()
+void MainFrame::OnSelectionCsgsubtract()
{
Undo_Start("CSG subtract");
CSG_Subtract();
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++;
g_bIgnoreCommands--;
}
-void MainFrame::OnClipSelected()
+void MainFrame::OnClipSelected()
{
if (m_pActiveXY && m_pActiveXY->ClipMode())
{
}
}
-void MainFrame::OnSplitSelected()
+void MainFrame::OnSplitSelected()
{
if (m_pActiveXY)
{
}
}
-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);
Undo_End();
}
-void MainFrame::OnSelectionUngroupentity()
+void MainFrame::OnSelectionUngroupentity()
{
Undo_Start("ungroup selected entities");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionMergeentity()
+void MainFrame::OnSelectionMergeentity()
{
Undo_Start("merge entity");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionGroupworld()
+void MainFrame::OnSelectionGroupworld()
{
Undo_Start("group world");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionMakeDetail()
+void MainFrame::OnSelectionMakeDetail()
{
Undo_Start("make detail");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnSelectionMakeStructural()
+void MainFrame::OnSelectionMakeStructural()
{
Undo_Start("make structural");
Undo_AddBrushList(&selected_brushes);
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
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++)
{
}
}
-void MainFrame::OnGrid (unsigned int nID)
+void MainFrame::OnGrid (unsigned int nID)
{
if (nID == ID_GRID_025)
{
Sys_UpdateWindows (W_XY|W_Z);
}
-void MainFrame::OnSnaptogrid()
+void MainFrame::OnSnaptogrid()
{
g_PrefsDlg.m_bNoClamp ^= 1;
g_PrefsDlg.SavePrefs ();
g_bIgnoreCommands--;
}
-void MainFrame::OnTexturesShowinuse()
+void MainFrame::OnTexturesShowinuse()
{
Sys_BeginWait ();
Texture_ShowInuse ();
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;
SetGridStatus();
}
-void MainFrame::OnToggleRotatelock()
+void MainFrame::OnToggleRotatelock()
{
g_PrefsDlg.m_bRotateLock ^= 1;
// 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 <basepath>/textures/
-void MainFrame::OnTexturesLoad()
+void MainFrame::OnTexturesLoad()
{
char def_path[NAME_MAX];
Sys_FPrintf(SYS_WRN, "texture load dialog cancelled\n");
}
-void MainFrame::OnTexturesReloadshaders()
+void MainFrame::OnTexturesReloadshaders()
{
Sys_BeginWait ();
QERApp_ReloadShaders();
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"));
Texture_ResetPosition();
}
-void MainFrame::OnTexturewindowScaleup()
+void MainFrame::OnTexturewindowScaleup()
{
switch(g_PrefsDlg.m_nTextureScale) {
// 200, all the way in, don't do anything
}
}
-void MainFrame::OnTexturewindowScaledown()
+void MainFrame::OnTexturewindowScaledown()
{
switch(g_PrefsDlg.m_nTextureScale) {
case 200:
}
}
-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"));
FillTextureMenu();
}
-void MainFrame::OnTextureWad(unsigned int nID)
+void MainFrame::OnTextureWad(unsigned int nID)
{
Sys_BeginWait ();
Texture_ShowDirectory (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++)
{
Sys_UpdateWindows (W_ALL);
}
-void MainFrame::OnColorSetqer()
+void MainFrame::OnColorSetqer()
{
for (int i=0 ; i<3 ; i++)
{
Sys_UpdateWindows (W_ALL);
}
-void MainFrame::OnColorSetblack()
+void MainFrame::OnColorSetblack()
{
for (int i=0 ; i<3 ; i++)
{
}
/* ydnar: to emulate maya/max/lightwave color schemes */
-void MainFrame::OnColorSetydnar()
+void MainFrame::OnColorSetydnar()
{
for (int i=0 ; i<3 ; i++)
{
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();
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)
{
}
}
-void MainFrame::OnConvertcurves()
+void MainFrame::OnConvertcurves()
{
#if 0
Select_Deselect();
#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);
Undo_End();
}
-void MainFrame::OnBrush4sided()
+void MainFrame::OnBrush4sided()
{
Undo_Start("4 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrush5sided()
+void MainFrame::OnBrush5sided()
{
Undo_Start("5 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrush6sided()
+void MainFrame::OnBrush6sided()
{
Undo_Start("6 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrush7sided()
+void MainFrame::OnBrush7sided()
{
Undo_Start("7 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrush8sided()
+void MainFrame::OnBrush8sided()
{
Undo_Start("8 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrush9sided()
+void MainFrame::OnBrush9sided()
{
Undo_Start("9 sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushArbitrarysided()
+void MainFrame::OnBrushArbitrarysided()
{
Undo_Start("arbitrary sided");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushMakecone()
+void MainFrame::OnBrushMakecone()
{
Undo_Start("make cone");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnBrushPrimitivesSphere()
+void MainFrame::OnBrushPrimitivesSphere()
{
Undo_Start("make sphere");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchtube()
+void MainFrame::OnCurvePatchtube()
{
Undo_Start("make curve cylinder");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchdensetube()
+void MainFrame::OnCurvePatchdensetube()
{
Undo_Start("dense cylinder");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchverydensetube()
+void MainFrame::OnCurvePatchverydensetube()
{
Undo_Start("very dense cylinder");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchsquare()
+void MainFrame::OnCurvePatchsquare()
{
Undo_Start("square cylinder");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchendcap()
+void MainFrame::OnCurvePatchendcap()
{
Undo_Start("make end cap");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchbevel()
+void MainFrame::OnCurvePatchbevel()
{
Undo_Start("make bevel");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveMoreendcapsbevelsSquarebevel()
+void MainFrame::OnCurveMoreendcapsbevelsSquarebevel()
{
Undo_Start("square bevel");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveMoreendcapsbevelsSquareendcap()
+void MainFrame::OnCurveMoreendcapsbevelsSquareendcap()
{
Undo_Start("square endcap");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurvePatchcone()
+void MainFrame::OnCurvePatchcone()
{
Undo_Start("make curve cone");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveSimplepatchmesh()
+void MainFrame::OnCurveSimplepatchmesh()
{
Undo_Start("make simpe patch mesh");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveInsertInsertcolumn()
+void MainFrame::OnCurveInsertInsertcolumn()
{
Undo_Start("insert (2) columns");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveInsertAddcolumn()
+void MainFrame::OnCurveInsertAddcolumn()
{
Undo_Start("add (2) columns");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveInsertInsertrow()
+void MainFrame::OnCurveInsertInsertrow()
{
Undo_Start("insert (2) rows");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveInsertAddrow()
+void MainFrame::OnCurveInsertAddrow()
{
Undo_Start("add (2) rows");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveDeleteFirstcolumn()
+void MainFrame::OnCurveDeleteFirstcolumn()
{
Undo_Start("delete first (2) columns");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveDeleteLastcolumn()
+void MainFrame::OnCurveDeleteLastcolumn()
{
Undo_Start("delete last (2) columns");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveDeleteFirstrow()
+void MainFrame::OnCurveDeleteFirstrow()
{
Undo_Start("delete first (2) rows");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveDeleteLastrow()
+void MainFrame::OnCurveDeleteLastrow()
{
Undo_Start("delete last (2) rows");
Undo_AddBrushList(&selected_brushes);
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);
Undo_End();
}
-void MainFrame::OnCurveRedisperseIntermediateCols()
+void MainFrame::OnCurveRedisperseIntermediateCols()
{
Undo_Start("redisperse im cols");
Undo_AddBrushList(&selected_brushes);
Undo_End();
}
-void MainFrame::OnCurveRedisperseIntermediateRows()
+void MainFrame::OnCurveRedisperseIntermediateRows()
{
Undo_Start("redisperse im rows");
Undo_AddBrushList(&selected_brushes);
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);
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;
}
// FIXME: we'll go towards a unified help thing soon
-void MainFrame::OnHelpLinks()
+void MainFrame::OnHelpLinks()
{
Str link;
link = g_strAppPath;
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};
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);
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++;
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++;
g_bIgnoreCommands--;
}
-void MainFrame::OnScalelockx()
+void MainFrame::OnScalelockx()
{
GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelockx"));
g_bIgnoreCommands++;
g_bIgnoreCommands--;
}
-void MainFrame::OnScalelocky()
+void MainFrame::OnScalelocky()
{
GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelocky"));
g_bIgnoreCommands++;
g_bIgnoreCommands--;
}
-void MainFrame::OnScalelockz()
+void MainFrame::OnScalelockz()
{
GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_scalelockz"));
g_bIgnoreCommands++;
g_bIgnoreCommands--;
}
-void MainFrame::OnDontselectcurve()
+void MainFrame::OnDontselectcurve()
{
GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_dontselectcurve"));
g_bIgnoreCommands++;
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++;
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++;
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++;
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++;
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");
*/
}
-void MainFrame::OnDropGroupNewgroup()
+void MainFrame::OnDropGroupNewgroup()
{
}
-void MainFrame::OnDropGroupRemove()
+void MainFrame::OnDropGroupRemove()
{
/*
Select_AddToGroup("World");
SurfaceDlgFitAll();
}
-void MainFrame::OnDontselectmodel()
+void MainFrame::OnDontselectmodel()
{
GtkWidget *item = GTK_WIDGET (g_object_get_data (G_OBJECT (m_pWidget), "tb_dontselectmodel"));
g_bIgnoreCommands++;
g_bIgnoreCommands--;
}
-void MainFrame::OnViewTexture()
+void MainFrame::OnViewTexture()
{
if (FloatingGroupDialog()) // QE4 style
{
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);
Undo_End();
}
-void MainFrame::OnCurveDeletecolumn()
+void MainFrame::OnCurveDeletecolumn()
{
if (&selected_brushes == selected_brushes.next)
return;
Undo_End();
}
-void MainFrame::OnCurveDeleterow()
+void MainFrame::OnCurveDeleterow()
{
if (&selected_brushes == selected_brushes.next)
return;
Undo_End();
}
-void MainFrame::OnPatchTab()
+void MainFrame::OnPatchTab()
{
if (g_bPatchBendMode)
Patch_BendHandleTAB();
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;
}
}
-void MainFrame::OnCameraForward(bool keydown)
+void MainFrame::OnCameraForward(bool keydown)
{
if (g_PrefsDlg.m_bCamDiscrete && (m_pCamWnd && !m_pCamWnd->m_bFreeMove) )
{
}
}
-void MainFrame::OnCameraBack(bool keydown)
+void MainFrame::OnCameraBack(bool keydown)
{
if (g_PrefsDlg.m_bCamDiscrete && (m_pCamWnd && !m_pCamWnd->m_bFreeMove) )
{
}
}
-void MainFrame::OnCameraLeft(bool keydown)
+void MainFrame::OnCameraLeft(bool keydown)
{
if (m_pCamWnd)
{
}
}
-void MainFrame::OnCameraRight(bool keydown)
+void MainFrame::OnCameraRight(bool keydown)
{
if (m_pCamWnd)
{
}
}
-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)
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)
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)
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)
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)
Sys_UpdateWindows(W_XY | W_Z);
}
-void MainFrame::OnGridNext()
+void MainFrame::OnGridNext()
{
GtkWidget *item;
if (g_qeglobals.d_gridsize == 0.25)
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
Sys_UpdateWindows(W_XY | W_Z);
}
-void MainFrame::OnSelectionMovedown()
+void MainFrame::OnSelectionMovedown()
{
if (&selected_brushes == selected_brushes.next)
return;
Undo_End();
}
-void MainFrame::OnSelectionMoveup()
+void MainFrame::OnSelectionMoveup()
{
if (&selected_brushes == selected_brushes.next)
return;
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);
{
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
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
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++;
// =============================================================================
// leo: Unused functions, not called anywhere from the code (need to check)
-void MainFrame::OnViewConsole()
+void MainFrame::OnViewConsole()
{
if (FloatingGroupDialog()) // QE4 style
{
}
-void MainFrame::OnDropGroupAddtoWorld()
+void MainFrame::OnDropGroupAddtoWorld()
{
/*
Select_AddToGroup("World");
#include "gtkr_vector.h"
#ifdef __APPLE__
-#define __toascii(c) ((c) & 0x7f)
+#define __toascii(c) ((c) & 0x7f)
#endif
const int RAD_SHIFT = 0x01;
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;
};
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
{
/*!
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);
void ReleaseContexts ();
void CreateContexts ();
- void SetActiveXY(XYWnd* p)
+ void SetActiveXY(XYWnd* p)
{
if (m_pActiveXY)
m_pActiveXY->SetActive(false);
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];
Sys_EndWait();
}
-entity_t *Map_FindClass (char *cname)
+entity_t *Map_FindClass (const char *cname)
{
entity_t *ent;
num_brushes = 0;
e = (entity_t*)ents->GetAt(i);
brushes = (CPtrArray*)e->pData;
-
+
num_brushes = brushes->GetSize();
// link brushes into entity
for(j=0; j<num_brushes; j++)
#ifdef TERRAIN_HACK
if ((strcmp(ValueForKey(e, "terrain"),"1") == 0 && strcmp(e->eclass->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)
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)
{
}
}
}
-
+
// find the matching targeted entity(s)
if(bCollision)
{
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;
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
*/
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
//
/*!
\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?
*/
entity_t *e;
CPtrArray ents;
-
+
if (bRegionOnly && region_active)
AddRegionBrushes();
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);
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++)
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");
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;
void Map_ImportBuffer(char *buf)
{
Select_Deselect();
-
+
Undo_Start("import buffer");
MemStream stream;
stream.Write(buf, strlen(buf));
Map_Import(&stream, "xmap");
stream.Close();
-
+
Sys_UpdateWindows (W_ALL);
Sys_MarkMapModified();
-
+
Undo_End();
}
// 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");
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//
+//
// Preliminary patch stuff
//
-//
+//
#include "stdafx.h"
#include "gtkmisc.h"
// 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
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;
}
{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;
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<drawVert_t*>(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] );
}
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;
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;
}
}
-
+
for (f=b->brush_faces ; f ; f=next)
{
next = f->next;
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];
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;
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;
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;
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;
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;
}
{
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++)
{
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;
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];
{
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);
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
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);
}
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);
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)
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))
{
}
}
}
-
+
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)
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;
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];
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 ++)
{
p->ctrl[i][2].xyz[1] = yc;
}
}
-
+
b = AddBrushForPatch(p);
Select_Delete();
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)
{
}
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)
{
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))
{
{
}
}
-
+
//--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)
}
}
}
-#endif
+#endif
vec3_t vMin, vMax;
Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
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;
}
// interpolate the v value
- for (axis = 0 ; axis < 5 ; axis++)
+ for (axis = 0 ; axis < 5 ; axis++)
{
float a, b, c;
float qA, qB, qC;
L[1] = 1.0f;
L[2] = 1.0f;
-
+
// quick diffuse shading
f = DotProduct(L, normal);
//if (f < 0.0f) f = 0.0f;
f += 0.5f;
-
+
return f;
}
// float a, b;
drawVert_t v1, v2, v3;
// vec3_t v4;
-
+
for (i=0; i<3; i++)
{
// xyz
float index, dot;
VectorClear(vClear);
-
+
VectorSubtract(vCurve[2], vCurve[0], vTemp);
VectorSubtract(vCurve[1], vCurve[0], v1);
VectorSubtract(vCurve[2], vCurve[1], v2);
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;
// 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;
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;
//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));
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;
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);
}
{
// 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);
}
{
int row, pos;
patch->colDirty[(col-1)/2] = true;
-
+
if (start == 0)
{
for (row=0; row<patch->height; row++)
{
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;
}
BTListList_t *LODLists;
LODLists = NULL;
-
+
pBTList = NULL;
patch->bDirty = false;
patch->LODUpdated = true;
-
+
for(col=1; col<patch->width; col+=2)
{
if (patch->colDirty[(col-1)/2]) continue;
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
{
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]);
{
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]);
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
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);
VectorSubtract(ctrl[2][0], ctrl[0][0], v2);
}
else
-
+
b = Patch_DegenCurve(ctrl[2][0], ctrl[2][1], ctrl[2][2]);
if (b == 0)
{
Patch_BezierInterpolate(vCurve, pMid);
VectorSubtract(pMid, ctrl[0][0], v2);
}
-
+
}
*/
if (VectorCompare(ctrl[0][0], ctrl[2][0])) // bottom degen
if (pBTMid->left != NULL && pBTMid->right != NULL)
{
vec3_t normal;
-
+
if (noleft) // left curve is degenerate
{
if (nomid) // mid curve is degenerate
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);
{
for(row=0; row+2<patch->height; 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;
{
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);
}
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);
}
}
/*
-// 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];}
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
{
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;
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;
}
bIntersect = true;
if (*t < tBest)
tBest = *t;
- }
+ }
if (Triangle_Ray(origin, dir, false, (*i3).xyz, (*i4).xyz, (*i2).xyz, t, u, v))
{
bIntersect = true;
Patch_DeleteDrawLists(pm);
Patch_CreateDrawLists(pm);
-
+
Patch_DrawLODPatchMesh(pm);
if (pm->nListID > 0)
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
}
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();
}
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);
qglEnd();
qglLineWidth(1.0);
}
-
+
if (g_nPatchBendState == BEND_SELECT_EDGE || g_nPatchBendState == BEND_BENDIT || g_nPatchBendState == BEND_SELECT_ORIGIN)
{
if(!g_PrefsDlg.m_bGlPtWorkaround)
}
}
}
- else
+ else
{
//qglDisable(GL_TEXTURE_2D); // stops point colours being multiplied by texture colour..
//draw CV lattice - could be made optional
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);
qglDisable (GL_POLYGON_OFFSET_LINE);
//if (g_PrefsDlg.m_bNoStipple == FALSE)
// qglEnable (GL_LINE_STIPPLE);
-
+
// draw selection handles
if(!g_PrefsDlg.m_bGlPtWorkaround)
{
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);
}
}
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);
qglColor3f(1, 0, 1);
else
qglColor3f(0, 1, 0);
-
+
// draw verts
DrawAlternatePoint(pm->ctrl[i][j].xyz, 0);
}
}
}
}
- qglEnd();
+ qglEnd();
qglLineWidth(1.0);
}
}
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);
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);
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
}
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;
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++)
//--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)
*/
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;
// delete display list associated with patch
if (p->nListID != -1)
qglDeleteLists (p->nListID, 1); // list#, number of lists
-
+
// delete LOD drawLists
Patch_DeleteDrawLists(p);
free(p);
p = NULL;
-
+
UpdatePatchInspector();
}
return false;
}
}
-
+
for (i=0 ; i<3 ; i++)
vMid[i] = (vMin[i] + ((vMax[i] - vMin[i]) / 2));
VectorSubtract(vMax, vMin, vTemp);
Patch_CalcBounds(p, vMin, vMax);
-
+
VectorSubtract(vMax, vMin, vMid);
VectorSubtract(vMid, vTemp, vTemp);
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++)
{
{
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);
}
{
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);
}
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++)
{
{
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);
}
{
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);
}
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)
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++)
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();
}
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)
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++)
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)
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
}
}
- 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);
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 ++)
//{
}
}
- 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);
{
vec3_t vTemp, vTemp2;
int i, w, h;
-
-
+
+
for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
{
if (pb->patchBrush)
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);
-
+
}
}
}
{
vec3_t vTemp, vTemp2;
int i, w, h;
-
-
+
+
for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
{
if (pb->patchBrush)
// 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);
}
{
vec3_t vTemp, vTemp2;
int i, w, h;
-
-
+
+
for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
{
if (pb->patchBrush)
// 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);
}
{
Patch_AdjustRows(pb->pPatch, nRows);
}
-
+
if (nCols != 0)
{
Patch_AdjustColumns(pb->pPatch, nCols);
/*
==================
-Patch_Write
+Patch_Write
==================
*/
void Patch_Write (patchMesh_t *p, MemStream *file)
if (fy == 0)
fy = 1.0;
}
-
+
for (int w = 0; w < p->width; w++)
{
for (int h = 0; h < p->height; h++)
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++)
{
}
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++)
{
==================
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)
{
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);
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
SelectColumn(p, g_nPatchAxisIndex, false);
}
- //FIXME: this only needs to be set once...
+ //FIXME: this only needs to be set once...
Patch_SetBendRotateOrigin(p);
}
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)
{
{
patchMesh_t* p = MakeNewPatch();
memcpy(p, pFrom , sizeof(patchMesh_t));
-
+
// spog - initialise patch LOD pointers (again)
Patch_InitialiseLODPointers(p);
p->drawLists = NULL;
p->bOverlay = false;
p->nListID = -1;
AddBrushForPatch(p);
-
+
return p;
}
{
// 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);
Patch_Naturalize(pSeam);
brushes.Add(b);
}
-
+
//--{
// otherwise we will add one per end
b = Patch_GenericMesh(p->width, 3, 2, false, true);
Select_Brush(reinterpret_cast<brush_t*>(brushes.GetAt(i)));
}
- if(bGroupResult)
+ if(bGroupResult)
{
entity_t *e = Entity_Alloc();
SetKeyValue(e, "classname", "func_group");
Select_GroupEntity(e);
Entity_AddToList(e, &entities);
}
-
+
UpdatePatchInspector();
}
{
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));
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; i<g_qeglobals.d_num_move_points; i++)
for (j = 0; j < 3; j++)
g_qeglobals.d_move_points[i][j] = floor(g_qeglobals.d_move_points[i][j] / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize;
-
+
// else snap all patch points
else
for (i = 0; i < p->width; 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);
//Patch_Naturalize(p);
- // brush_t *b =
+ // brush_t *b =
AddBrushForPatch(p);
}
}
}
-/*
+/*
=================
Patch_GetKeyValue
=================
// 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<CPrefAssignment>::iterator iAssign;
for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
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 )
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);
*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"))
*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);
*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]);
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));
*pV = V;
}
// push the pref assignment if needed
- PushAssignment(name, PREF_WNDPOS, pV);
+ PushAssignment(name, PREF_WNDPOS, pV);
}
void CXMLPropertyBag::UpdatePrefTree()
Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> 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);
}
qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
{
int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
-
+
if(res == -1)
return false;
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;
}
}
-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"
{
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;
void CGameDialog::LoadPrefs()
{
- bool bEmpty = false;
-
// if we already have a document loaded, we will free and reload from file
if (mGlobalPrefs.InUse())
{
{
// 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());
}
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();
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);
void CGameDialog::BuildDialog() {
GtkWidget *dlg, *vbox1, *button, *setup_button;
-
+
dlg = m_pWidget;
gtk_window_set_title( GTK_WINDOW( dlg ), "Select Game" );
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 );
}
}
// 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() );
}
#else
g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
#endif
-
+
g_pGameDescription->Dump();
}
// FIXME: this is kinda hardcoded for now..
list<CGameDescription *>::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";
#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)
{
if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
-
+
return;
}
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);
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);
gtk_tree_store_set(store, &tab, 0, "Texture Settings", 1, (gpointer)PTAB_TEXTURE, -1);
}
}
-
+
{
GtkTreeIter group;
gtk_tree_store_append(store, &group, NULL);
gtk_tree_store_set(store, &tab, 0, "Editing", 1, (gpointer)PTAB_EDITING, -1);
}
}
-
+
{
GtkTreeIter group;
gtk_tree_store_append(store, &group, NULL);
}
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?
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 ****************************/
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);
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);
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);
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);
(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");
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");
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);
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);
(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");
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);
(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);
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);
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);
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);
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);
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);
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);
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);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
-
+
// Undo levels
// label
label = gtk_label_new ("Undo Levels:");
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),
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);
// 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);
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);
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);
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);
(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);
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);
(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);
(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);
// 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);
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);
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);
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);
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);
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);
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);
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);
Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
return;
}
-
+
if (g_qeglobals.bTextureCompressionSupported)
{
if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
}
#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
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, "");
mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
m_bDetachableMenus = m_bLatchedDetachableMenus;
-
+
if (g_pGameDescription->mNoPatch)
{
m_bPatchToolbar = false;
mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
m_bWideToolbar = m_bLatchedWideToolbar;
-
+
mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
m_bPluginToolbar = m_bLatchedPluginToolbar;
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);
// 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
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;
}
Sys_Printf( "OnGameSelectChanged\n" );
CGameInstall* i = static_cast<CGameInstall*>( 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" );
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 );
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 );
/*
===============
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() {
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;
}
/*!
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
public:
CXMLPropertyBag();
- virtual ~CXMLPropertyBag()
+ virtual ~CXMLPropertyBag()
{
if (InUse())
Clear();
(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
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
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
void Reset();
/*!
- run the dialog UI for the list of games
+ run the dialog UI for the list of games
*/
void DoGameDialog();
/*!
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
typedef struct {
int nEntitySplit1;
int nEntitySplit2;
-
+
window_position_t position;
window_position_t posEntityWnd;
class PrefsDlg : public Dialog
{
-
+
public:
/*!
local prefs file
// 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
*/
// warning about old project files
bool m_bWarn;
list<CGameDescription *> mGames;
-
+
public:
// last light intensity used in the CLightPrompt dialog, stored in registry
int m_iLastLightIntensity;
/*! 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);
// 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
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
int m_nTextureCompressionFormat;
int m_nLightRadiuses;
-
+
bool m_bQ3Map2Texturing;
#ifdef ATIHACK_812
#include "stdafx.h"
#include <gtk/gtk.h>
-#include <sys/stat.h>
+#include <glib/gi18n.h>
+#include <sys/stat.h>
#include "gtkmisc.h"
#if defined (__linux__) || defined (__APPLE__)
#include <unistd.h>
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)
{
FileStream stream;
if (stream.Open(filename, "r"))
return ParseXMLStream(&stream, validate);
-
+
Sys_FPrintf(SYS_ERR, "Failed to open file: %s\n",filename);
return NULL;
}
r++;
p = "$";
}
-
+
while(*p!='\0') *w++ = *p++;
}
else *w++ = *r++;
}
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" );
g_PrefsDlg.SavePrefs();
return false;
}
-
+
// set here some default project settings you need
if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 )
{
// 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
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());
int counter = 0;
char pUser[PATH_MAX];
while (1)
- {
+ {
sprintf( pUser, "%suser%d." PROJECT_FILETYPE, buf, counter );
counter++;
if (access( pUser, R_OK) != 0)
}
// 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
Sys_Beep ();
return;
}
-
+
target = ValueForKey (e1, "target");
if (target && target[0])
newtarg = g_strdup(target);
SetKeyValue(e2, "targetname", newtarg);
g_free(newtarg);
}
-
+
Sys_UpdateWindows (W_XY | W_CAMERA);
Select_Deselect();
// 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.
-
+
// <gametools>
directory = g_pGameDescription->mGameToolsPath;
vfsInitDirectory(directory.GetBuffer());
{
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)
double I_FloatTime (void)
{
time_t t;
-
+
time (&t);
-
+
return t;
#if 0
// more precise, less portable
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
}
len = 0;
com_token[0] = 0;
-
+
if (!data)
return NULL;
-
+
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
}
data++;
}
-
+
// skip // comments
if (c=='/' && data[1] == '/')
{
data++;
goto skipwhite;
}
-
+
// handle quoted strings specially
if (c == '\"')
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
break;
} while (c>32);
-
+
com_token[len] = 0;
return data;
}
*lpCmdLine = 0;
lpCmdLine++;
}
-
+
}
}
}
Returns the argument number (1 to argc-1) or 0 if not present
=================
*/
-int CheckParm (char *check)
+int CheckParm (const char *check)
{
int i;
ParseNum / ParseHex
==============
*/
-int ParseHex (char *hex)
+int ParseHex (const char *hex)
{
char *str;
int num;
}
-int ParseNum (char *str)
+int ParseNum (const char *str)
{
if (str[0] == '$')
return ParseHex (str+1);
#if defined (__linux__) || defined (__APPLE__)
gdk_beep ();
#else
- MessageBeep (MB_ICONASTERISK);
+ MessageBeep (MB_ICONASTERISK);
#endif
}
======================================================================
*/
-
+
qboolean ConfirmModified ()
{
if (!modified)
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());
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();
}
{
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);
// 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 );
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;
// 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);
gtk_grab_remove(g_qeglobals_gui.d_edit);
}
}
- }
+ }
}
// NOTE: this is the handler sent to synapse
#include "qgl.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <math.h>
#include <stdlib.h>
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();
// 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);
// 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);
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)
//
// 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
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;
extern bool g_bHaveEClassExt;
extern _EClassTable g_EClassExtTable;
-
+
#include "iplugin.h"
// for interfaces, we require main plugin header included
#include "qerplugin.h"
*/
#ifdef _WIN32
-//#include <gdk/win32/gdkwin32.h>
-#include <gdk/gdkwin32.h>
+//#include <gdk/win32/gdkwin32.h>
+#include <gdk/gdkwin32.h>
#endif
#if defined (__linux__) || defined (__APPLE__)
#include <gdk/gdkx.h>
#include <dirent.h>
#endif
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <assert.h>
#include <sys/stat.h>
#include "stdafx.h"
{
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))
break;
}
}
-
+
if (!found)
{
l_shaderfiles = g_slist_append (l_shaderfiles, strdup (dirstring));
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"));
// 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));
}
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
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;
return;
}
}
-
+
Sys_Status("Did not select a texture", 0);
}
}
undo = (undo_t *) malloc(sizeof(undo_t));
- if (!undo)
+ if (!undo)
return;
memset(undo, 0, sizeof(undo_t));
undo->brushlist.next = &undo->brushlist;
undo->prev = g_lastundo;
undo->next = NULL;
g_lastundo = undo;
-
+
undo->time = Sys_DoubleTime();
//
if (g_undoId > g_undoMaxSize * 2) g_undoId = 1;
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)
#endif
return;
}
-
+
Undo_ClearRedo();
Undo_GeneralStart(operation);
}
#endif
return;
}
-
+
if (!g_lastundo)
{
Sys_Printf("Undo_AddBrushList: no last undo.\n");
#endif
return;
}
-
+
brush_t *pBrush;
if (!g_lastundo)
#endif
return;
}
-
+
if (!g_lastundo)
{
#endif
return;
}
-
+
if (!g_lastundo)
{
#endif
return;
}
-
+
entity_t* pClone;
#endif
return;
}
-
+
if (!g_lastundo)
{
Sys_Printf("Undo_Undo: undo is disabled.\n");
return;
}
-
+
undo_t *undo, *redo;
brush_t *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity, *pUndoEntity;
g_undoId--;
if (g_undoId <= 0) g_undoId = 2 * g_undoMaxSize;
//
- g_bScreenUpdates = true;
+ g_bScreenUpdates = true;
UpdateSurfaceDialog();
Sys_UpdateWindows(W_ALL);
}
// free the undo
free(redo);
//
- g_bScreenUpdates = true;
+ g_bScreenUpdates = true;
UpdateSurfaceDialog();
Sys_UpdateWindows(W_ALL);
}
//
// 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
#include "stdafx.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <assert.h>
#include <GL/gl.h>
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)
{
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;
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++)
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;
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;
{
return;
}
-
+
num_entities = 0;
for (te = entities.next ; te != &entities && num_entities != MAX_MAP_ENTITIES ; te = te->next)
{
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 ; k<num_entities ; k++)
{
if (strcmp (ent_target[k], psz))
continue;
-
+
te = ent_entity[k];
tb = te->brushes.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 ; i<arrows ; i++)
{
f = len * (i + 0.5) / arrows;
-
+
for (j=0 ; j<3 ; j++)
mid1[j] = mid[j] + f*dir[j];
qglVertex3fv (mid1);
qglVertex3fv (mid1);
qglVertex3f (mid1[0] + s2[0], mid1[1] + s2[1], mid1[2]);
}
-
+
qglEnd();
}
}
m_vOrigin[2] = org[2];
}
-void XYWnd::OnSize(int cx, int cy)
+void XYWnd::OnSize(int cx, int cy)
{
m_nWidth = cx;
m_nHeight = cy;
pList = (!g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
else
pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
-
+
if (pList->next != pList)
{
Brush_CopyList(pList, &hold_brushes);
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 )
{
break;
}
}
-
+
if( found )
{
// SetClipMode( true );
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";
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");
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
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 ())
XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags);
}
}
- else
+ else
{
XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags);
}
g_pParentWnd->OnTimer ();
}
-void XYWnd::OnTimer ()
+void XYWnd::OnTimer ()
{
int nDim1 = (m_nViewType == YZ) ? 1 : 0;
int nDim2 = (m_nViewType == XY) ? 1 : 2;
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();
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)
{
VectorClear(point);
XY_ToPoint (x, y, point);
-
+
VectorCopy (point, origin);
VectorClear (dir);
{
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;
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;
|| (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;
// control mbutton = move camera
if (m_nButtonstate == (MK_CONTROL|nMouseButton) )
- {
+ {
VectorCopyXY(point, g_pParentWnd->GetCamWnd()->Camera()->origin);
Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY);
}
// 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;
*/
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",
submenu_root = NULL;
}
strActive = strLeft;
-
+
submenu = gtk_menu_new ();
submenu_root = submenu;
item = gtk_menu_item_new_with_label (strName);
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++));
// 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;
g_pParentWnd->OnViewZoomout ();
else
g_pParentWnd->OnViewZoomin ();
-
+
Sys_SetCursorPos (m_ptCursorX, m_ptCursorY);
}
}
g_Clip1.m_ptScreenX = pointx;
g_Clip1.m_ptScreenY = pointy;
}
- else
+ else
if (g_Clip2.Set() == false)
{
pPt = g_Clip2;
g_Clip2.m_ptScreenX = pointx;
g_Clip2.m_ptScreenY = pointy;
}
- else
+ else
if (g_Clip3.Set() == false)
{
pPt = g_Clip3;
g_Clip3.m_ptScreenX = pointx;
g_Clip3.m_ptScreenY = pointy;
}
- else
+ else
{
RetainClipMode(true);
pPt = g_Clip1;
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];
{
bool bCaulk = false;
int nFlags;
-
+
if (AnyPatchesSelected())
{
Sys_Printf("Deselecting patches for clip operation.\n");
// 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;
{
brush_t* pFront = NULL;
brush_t* pBack = NULL;
-
+
face_t face;
memset(&face,0,sizeof(face_t));
PlanePointsFromClipPoints(face.planepts, pBrush);
Brush_AddToList(pBack, &g_brBackSplits);
if (pFront)
Brush_AddToList(pFront, &g_brFrontSplits);
-
+
}
}
}
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);
}
}
qglLineWidth (2);
qglBegin (GL_LINES);
-
+
for (x=xb ; x<=xe ; x+=g_qeglobals.blockSize)
{
qglVertex2f (x, yb);
qglVertex2f (xe, y);
}
}
-
+
qglEnd ();
qglLineWidth (1);
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);
}
}
-// 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)
{
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);
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);
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());
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]);
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());
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]);
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());
if (!active_brushes.next)
return; // not valid yet
- Patch_LODMatchAll(); // spog
+ Patch_LODMatchAll(); // spog
if (m_bTiming)
start = Sys_DoubleTime();
drawn = culled = 0;
e = world_entity;
-
+
if (m_bTiming)
start2 = Sys_DoubleTime();
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++;
Brush_DrawXY(brush, m_nViewType);
}
-
+
if (m_bTiming)
end2 = Sys_DoubleTime();
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++;
// 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);
for (i=0 ; i<g_qeglobals.d_numpoints ; i++)
qglVertex3fv (g_qeglobals.d_points[i]);
qglEnd ();
-
+
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
for (i=0; i < g_qeglobals.d_numpoints; i++)
DrawAlternatePoint(g_qeglobals.d_points[i], m_fScale);
qglEnd();
-
+
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
else if (g_qeglobals.d_select_mode == sel_edge)
{
float *v1, *v2;
- if(!g_PrefsDlg.m_bGlPtWorkaround)
+ if(!g_PrefsDlg.m_bGlPtWorkaround)
{
qglPointSize (4);
qglColor3f (0,0,1);
return RotateMode() ? false : ScaleMode() ? false : true;
}
-void XYWnd::OnCreate ()
+void XYWnd::OnCreate ()
{
if (!MakeCurrent ())
Error ("glXMakeCurrent failed");
qglRotatef (-90, 0, 1, 0); // put Z going up
qglRotatef (-90, 1, 0, 0); // put Z going up
}
-
+
if (g_bCrossHairs)
{
qglColor4f(0.2f, 0.9f, 0.2f, 0.8f);
}
}
}
-
+
if (PathMode())
{
int n;
brush_t *b;
for( b = selected_brushes.next; b != &selected_brushes; b = b->next )
{
-
+
}
}
Sys_Printf("TODO: hook drop down group menu\n");
return;
}
-
+
if (strItem.Find("Smart_") >= 0)
{
CreateSmartEntity(this, m_ptDownX, m_ptDownY, strItem);
{
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));
}