#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