+
+/*
+============================================================
+CGameInstall
+============================================================
+*/
+
+void CGameInstall::BuildDialog() {
+ GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry;
+
+ dlg = m_pWidget;
+ gtk_window_set_title( GTK_WINDOW( dlg ), "Configure games" );
+
+ vbox1 = gtk_vbox_new( FALSE, 0 );
+ gtk_widget_show( vbox1 );
+ gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
+
+ text = gtk_label_new( "Select the game to configure" );
+ gtk_widget_show( text );
+ gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
+
+ combo = gtk_combo_new();
+ gtk_widget_show( combo );
+ gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
+
+ GList *combo_list = NULL;
+ combo_list = g_list_append( combo_list, "Quake III Arena and mods" );
+ combo_list = g_list_append( combo_list, "Urban Terror standalone" );
+ combo_list = g_list_append( combo_list, "Warsaw" );
+ gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list );
+ g_list_free( combo_list );
+ AddDialogData( combo, &m_nComboSelect, DLG_COMBO_INT );
+
+ 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 );
+ AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
+
+ text = gtk_label_new( "Engine directory:" );
+ 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 );
+ AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
+
+ // this gets done in the project stuff atm
+#if 0
+ text = gtk_label_new( "Mod subdirectory:" );
+ 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 );
+ AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
+#endif
+
+ button = gtk_button_new_with_label( "OK" );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
+ AddModalButton( button, IDOK );
+
+ gtk_widget_set_usize( button, 60, -2 );
+}
+
+void CGameInstall::Run() {
+ DoModal();
+ Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
+
+ // write out the game file
+ Str gameFilePath = g_strAppPath.GetBuffer();
+ gameFilePath += "games/";
+ gameFilePath += m_strName.GetBuffer();
+ gameFilePath += ".game";
+ Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
+
+ FILE *fg = fopen( gameFilePath.GetBuffer(), "w" );
+ if ( fg == NULL ) {
+ Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
+ }
+ fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
+ fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
+ fprintf( fg, " gametools=\"%sgames\"\n", g_strAppPath.GetBuffer() );
+ fprintf( fg, " enginepath=\"%s\"\n", m_strEngine.GetBuffer() );
+ switch ( m_nComboSelect ) {
+ case GAME_Q3:
+ fprintf( fg, " basegame=\"baseq3\"\n" );
+ break;
+ case GAME_URT:
+ fprintf( fg, " basegame=\"q3ut4\"\n" );
+ break;
+ case GAME_WARSOW:
+ fprintf( fg, " basegame=\"basewsw\"\n" );
+ break;
+ }
+ fprintf( fg, "/>\n" );
+ fclose( fg );
+}